summaryrefslogtreecommitdiffstats
path: root/xbmc/pvr/epg/EpgSearchPath.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
commitc04dcc2e7d834218ef2d4194331e383402495ae1 (patch)
tree7333e38d10d75386e60f336b80c2443c1166031d /xbmc/pvr/epg/EpgSearchPath.cpp
parentInitial commit. (diff)
downloadkodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz
kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xbmc/pvr/epg/EpgSearchPath.cpp')
-rw-r--r--xbmc/pvr/epg/EpgSearchPath.cpp64
1 files changed, 64 insertions, 0 deletions
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 <cstdlib>
+#include <string>
+#include <vector>
+
+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<std::string> 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;
+}