From c04dcc2e7d834218ef2d4194331e383402495ae1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 10 Apr 2024 20:07:22 +0200 Subject: Adding upstream version 2:20.4+dfsg. Signed-off-by: Daniel Baumann --- xbmc/pvr/epg/EpgSearchPath.cpp | 64 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 xbmc/pvr/epg/EpgSearchPath.cpp (limited to 'xbmc/pvr/epg/EpgSearchPath.cpp') diff --git a/xbmc/pvr/epg/EpgSearchPath.cpp b/xbmc/pvr/epg/EpgSearchPath.cpp new file mode 100644 index 0000000..9b24e10 --- /dev/null +++ b/xbmc/pvr/epg/EpgSearchPath.cpp @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2012-2021 Team Kodi + * This file is part of Kodi - https://kodi.tv + * + * SPDX-License-Identifier: GPL-2.0-or-later + * See LICENSES/README.md for more information. + */ + +#include "EpgSearchPath.h" + +#include "pvr/epg/EpgSearchFilter.h" +#include "utils/StringUtils.h" +#include "utils/URIUtils.h" + +#include +#include +#include + +using namespace PVR; + +const std::string CPVREpgSearchPath::PATH_SEARCH_DIALOG = "pvr://search/search_dialog"; +const std::string CPVREpgSearchPath::PATH_TV_SEARCH = "pvr://search/tv/"; +const std::string CPVREpgSearchPath::PATH_TV_SAVEDSEARCHES = "pvr://search/tv/savedsearches/"; +const std::string CPVREpgSearchPath::PATH_RADIO_SEARCH = "pvr://search/radio/"; +const std::string CPVREpgSearchPath::PATH_RADIO_SAVEDSEARCHES = "pvr://search/radio/savedsearches/"; + +CPVREpgSearchPath::CPVREpgSearchPath(const std::string& strPath) +{ + Init(strPath); +} + +CPVREpgSearchPath::CPVREpgSearchPath(const CPVREpgSearchFilter& search) + : m_path(StringUtils::Format("pvr://search/{}/savedsearches/{}", + search.IsRadio() ? "radio" : "tv", + search.GetDatabaseId())), + m_bValid(true), + m_bRoot(false), + m_bRadio(search.IsRadio()), + m_bSavedSearchesRoot(false) +{ +} + +bool CPVREpgSearchPath::Init(const std::string& strPath) +{ + std::string strVarPath(strPath); + URIUtils::RemoveSlashAtEnd(strVarPath); + + m_path = strVarPath; + const std::vector segments = URIUtils::SplitPath(m_path); + + m_bValid = + ((segments.size() >= 3) && (segments.size() <= 5) && (segments.at(1) == "search") && + ((segments.at(2) == "radio") || (segments.at(2) == "tv") || (segments.at(2) == "search")) && + ((segments.size() == 3) || (segments.at(3) == "savedsearches"))); + m_bRoot = (m_bValid && (segments.size() == 3) && (segments.at(2) != "search")); + m_bRadio = (m_bValid && (segments.at(2) == "radio")); + m_bSavedSearchesRoot = + (m_bValid && (segments.size() == 4) && (segments.at(3) == "savedsearches")); + m_bSavedSearch = (m_bValid && (segments.size() == 5)); + if (m_bSavedSearch) + m_iId = std::stoi(segments.at(4)); + + return m_bValid; +} -- cgit v1.2.3