aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Sommerfeld <kai.sommerfeld@gmx.com>2020-05-15 22:54:09 +0200
committerKai Sommerfeld <kai.sommerfeld@gmx.com>2020-05-19 18:42:50 +0200
commit490ce64f04df680212d59b05452ffc2e31aee334 (patch)
tree0f7cd073cdc1bdb96fe5a6c8531b5858f7bf6fad
parent5c2abf56751fff35a793555901a07f90e52d3d63 (diff)
[PVR][Estuary] Dynamic PVR categories for Estuary home screen.
-rw-r--r--addons/skin.estuary/media/DefaultPVRChannels.pngbin0 -> 2897 bytes
-rw-r--r--addons/skin.estuary/media/DefaultPVRGuide.png (renamed from addons/skin.estuary/media/icons/pvr/epg.png)bin1115 -> 1115 bytes
-rw-r--r--addons/skin.estuary/media/DefaultPVRRecordings.png (renamed from addons/skin.estuary/media/icons/pvr/recording.png)bin1817 -> 1817 bytes
-rw-r--r--addons/skin.estuary/media/DefaultPVRSearch.pngbin0 -> 1981 bytes
-rw-r--r--addons/skin.estuary/media/DefaultPVRTimerRules.png (renamed from addons/skin.estuary/media/icons/pvr/timer-rule.png)bin3838 -> 3838 bytes
-rw-r--r--addons/skin.estuary/media/DefaultPVRTimers.png (renamed from addons/skin.estuary/media/icons/pvr/timer.png)bin3310 -> 3310 bytes
-rw-r--r--addons/skin.estuary/xml/Home.xml9
-rw-r--r--addons/skin.estuary/xml/Includes_Home.xml48
-rw-r--r--xbmc/pvr/addons/PVRClients.cpp24
-rw-r--r--xbmc/pvr/addons/PVRClients.h11
-rw-r--r--xbmc/pvr/filesystem/PVRGUIDirectory.cpp98
-rw-r--r--xbmc/pvr/timers/PVRTimersPath.cpp4
-rw-r--r--xbmc/pvr/timers/PVRTimersPath.h4
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRChannels.cpp11
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRGuide.cpp12
15 files changed, 166 insertions, 55 deletions
diff --git a/addons/skin.estuary/media/DefaultPVRChannels.png b/addons/skin.estuary/media/DefaultPVRChannels.png
new file mode 100644
index 0000000000..86e98fd590
--- /dev/null
+++ b/addons/skin.estuary/media/DefaultPVRChannels.png
Binary files differ
diff --git a/addons/skin.estuary/media/icons/pvr/epg.png b/addons/skin.estuary/media/DefaultPVRGuide.png
index d7370669ee..d7370669ee 100644
--- a/addons/skin.estuary/media/icons/pvr/epg.png
+++ b/addons/skin.estuary/media/DefaultPVRGuide.png
Binary files differ
diff --git a/addons/skin.estuary/media/icons/pvr/recording.png b/addons/skin.estuary/media/DefaultPVRRecordings.png
index e42f344f58..e42f344f58 100644
--- a/addons/skin.estuary/media/icons/pvr/recording.png
+++ b/addons/skin.estuary/media/DefaultPVRRecordings.png
Binary files differ
diff --git a/addons/skin.estuary/media/DefaultPVRSearch.png b/addons/skin.estuary/media/DefaultPVRSearch.png
new file mode 100644
index 0000000000..7a74fb7499
--- /dev/null
+++ b/addons/skin.estuary/media/DefaultPVRSearch.png
Binary files differ
diff --git a/addons/skin.estuary/media/icons/pvr/timer-rule.png b/addons/skin.estuary/media/DefaultPVRTimerRules.png
index 3942d4a270..3942d4a270 100644
--- a/addons/skin.estuary/media/icons/pvr/timer-rule.png
+++ b/addons/skin.estuary/media/DefaultPVRTimerRules.png
Binary files differ
diff --git a/addons/skin.estuary/media/icons/pvr/timer.png b/addons/skin.estuary/media/DefaultPVRTimers.png
index 6328fdd15e..6328fdd15e 100644
--- a/addons/skin.estuary/media/icons/pvr/timer.png
+++ b/addons/skin.estuary/media/DefaultPVRTimers.png
Binary files differ
diff --git a/addons/skin.estuary/xml/Home.xml b/addons/skin.estuary/xml/Home.xml
index a639eddfa0..b5e1290f52 100644
--- a/addons/skin.estuary/xml/Home.xml
+++ b/addons/skin.estuary/xml/Home.xml
@@ -402,11 +402,12 @@
</control>
</control>
<include content="WidgetListCategories" condition="System.HasPVRAddon">
+ <param name="content_path" value="pvr://tv/"/>
<param name="widget_header" value="$LOCALIZE[31148]"/>
+ <param name="widget_target" value="pvr"/>
<param name="list_id" value="12900"/>
- <param name="pvr_submenu" value="true"/>
- <param name="pvr_type" value="TV"/>
</include>
+
<include content="WidgetListChannels" condition="System.HasPVRAddon">
<param name="content_path" value="pvr://channels/tv/*?view=lastplayed"/>
<param name="sortby" value="lastplayed"/>
@@ -482,10 +483,10 @@
</control>
</control>
<include content="WidgetListCategories" condition="System.HasPVRAddon">
+ <param name="content_path" value="pvr://radio/"/>
<param name="widget_header" value="$LOCALIZE[31148]"/>
+ <param name="widget_target" value="pvr"/>
<param name="list_id" value="13900"/>
- <param name="pvr_submenu" value="true"/>
- <param name="pvr_type" value="Radio"/>
</include>
<include content="WidgetListChannels" condition="System.HasPVRAddon">
<param name="content_path" value="pvr://channels/radio/*?view=lastplayed"/>
diff --git a/addons/skin.estuary/xml/Includes_Home.xml b/addons/skin.estuary/xml/Includes_Home.xml
index 857e3b2724..d3c24b2b81 100644
--- a/addons/skin.estuary/xml/Includes_Home.xml
+++ b/addons/skin.estuary/xml/Includes_Home.xml
@@ -307,10 +307,8 @@
<param name="item_limit">20</param>
<param name="icon">$INFO[ListItem.Icon]</param>
<param name="icon_height">120</param>
- <param name="pvr_submenu">false</param>
<param name="additional_movie_items">false</param>
<param name="additional_tvshow_items">false</param>
- <param name="pvr_type">TV</param>
<param name="visible">true</param>
<definition>
<include content="CategoryLabel">
@@ -408,56 +406,12 @@
</control>
</control>
</focusedlayout>
- <include condition="!$PARAM[pvr_submenu]" content="SubmenuContent">
- <param name="widget_target" value="$PARAM[widget_target]"/>
- <param name="item_limit" value="$PARAM[item_limit]"/>
- <param name="content_path" value="$PARAM[content_path]"/>
- </include>
- <include condition="$PARAM[pvr_submenu]" content="PVRSubMenuContent">
- <param name="pvr_type" value="$PARAM[pvr_type]"/>
- </include>
+ <content target="$PARAM[widget_target]" limit="$PARAM[item_limit]">$PARAM[content_path]</content>
<include condition="$PARAM[additional_movie_items]" content="MovieSubmenuItems" />
<include condition="$PARAM[additional_tvshow_items]" content="TVShowSubmenuItems" />
</control>
</definition>
</include>
- <include name="SubmenuContent">
- <content target="$PARAM[widget_target]" limit="$PARAM[item_limit]">$PARAM[content_path]</content>
- </include>
- <include name="PVRSubMenuContent">
- <content>
- <item>
- <label>$LOCALIZE[19019]</label>
- <onclick>ActivateWindow($PARAM[pvr_type]Channels)</onclick>
- <thumb>DefaultAddonPeripheral.png</thumb>
- </item>
- <item>
- <label>$LOCALIZE[19069]</label>
- <onclick>ActivateWindow($PARAM[pvr_type]Guide)</onclick>
- <thumb>icons/pvr/epg.png</thumb>
- </item>
- <item>
- <label>$LOCALIZE[19017]</label>
- <onclick>ActivateWindow($PARAM[pvr_type]Recordings)</onclick>
- <thumb>icons/pvr/recording.png</thumb>
- </item>
- <item>
- <label>$LOCALIZE[19040]</label>
- <onclick>ActivateWindow($PARAM[pvr_type]Timers)</onclick>
- <thumb>icons/pvr/timer.png</thumb>
- </item>
- <item>
- <label>$LOCALIZE[19138]</label>
- <onclick>ActivateWindow($PARAM[pvr_type]TimerRules)</onclick>
- <thumb>icons/pvr/timer-rule.png</thumb>
- </item>
- <item>
- <label>$LOCALIZE[137]</label>
- <onclick>ActivateWindow($PARAM[pvr_type]Search)</onclick>
- <thumb>DefaultAddonsSearch.png</thumb>
- </item>
- </content>
- </include>
<include name="MovieSubmenuItems">
<content>
<item>
diff --git a/xbmc/pvr/addons/PVRClients.cpp b/xbmc/pvr/addons/PVRClients.cpp
index 1d6ad65b66..971655fea1 100644
--- a/xbmc/pvr/addons/PVRClients.cpp
+++ b/xbmc/pvr/addons/PVRClients.cpp
@@ -563,6 +563,30 @@ bool CPVRClients::AnyClientSupportingRecordingsSize() const
return recordingSizeClients.size() != 0;
}
+bool CPVRClients::AnyClientSupportingEPG() const
+{
+ bool bHaveSupportingClient = false;
+ ForCreatedClients(__FUNCTION__,
+ [&bHaveSupportingClient](const std::shared_ptr<CPVRClient>& client) {
+ if (client->GetClientCapabilities().SupportsEPG())
+ bHaveSupportingClient = true;
+ return PVR_ERROR_NO_ERROR;
+ });
+ return bHaveSupportingClient;
+}
+
+bool CPVRClients::AnyClientSupportingRecordings() const
+{
+ bool bHaveSupportingClient = false;
+ ForCreatedClients(__FUNCTION__,
+ [&bHaveSupportingClient](const std::shared_ptr<CPVRClient>& client) {
+ if (client->GetClientCapabilities().SupportsRecordings())
+ bHaveSupportingClient = true;
+ return PVR_ERROR_NO_ERROR;
+ });
+ return bHaveSupportingClient;
+}
+
void CPVRClients::OnSystemSleep()
{
ForCreatedClients(__FUNCTION__, [](const std::shared_ptr<CPVRClient>& client) {
diff --git a/xbmc/pvr/addons/PVRClients.h b/xbmc/pvr/addons/PVRClients.h
index 1b3dcd8ea1..50288ecd56 100644
--- a/xbmc/pvr/addons/PVRClients.h
+++ b/xbmc/pvr/addons/PVRClients.h
@@ -273,6 +273,17 @@ namespace PVR
*/
bool AnyClientSupportingRecordingsSize() const;
+ /*!
+ * @brief Get whether or not any client supports EPG.
+ * @return True if any client supports EPG.
+ */
+ bool AnyClientSupportingEPG() const;
+
+ /*!
+ * @brief Get whether or not any client supports recordings.
+ * @return True if any client supports recordings.
+ */
+ bool AnyClientSupportingRecordings() const;
//@}
/*! @name Power management methods */
diff --git a/xbmc/pvr/filesystem/PVRGUIDirectory.cpp b/xbmc/pvr/filesystem/PVRGUIDirectory.cpp
index 5d6daa2991..89a952f045 100644
--- a/xbmc/pvr/filesystem/PVRGUIDirectory.cpp
+++ b/xbmc/pvr/filesystem/PVRGUIDirectory.cpp
@@ -11,7 +11,10 @@
#include "FileItem.h"
#include "ServiceBroker.h"
#include "guilib/LocalizeStrings.h"
+#include "guilib/WindowIDs.h"
+#include "input/WindowTranslator.h"
#include "pvr/PVRManager.h"
+#include "pvr/addons/PVRClients.h"
#include "pvr/channels/PVRChannel.h"
#include "pvr/channels/PVRChannelGroup.h"
#include "pvr/channels/PVRChannelGroups.h"
@@ -53,6 +56,85 @@ bool CPVRGUIDirectory::SupportsWriteFileOperations() const
return URIUtils::IsPVRRecording(filename);
}
+namespace
+{
+
+bool GetRootDirectory(bool bRadio, CFileItemList& results)
+{
+ std::shared_ptr<CFileItem> item;
+
+ const std::shared_ptr<CPVRClients> clients = CServiceBroker::GetPVRManager().Clients();
+
+ // Channels
+ item.reset(new CFileItem(
+ bRadio ? CPVRChannelsPath::PATH_RADIO_CHANNELS : CPVRChannelsPath::PATH_TV_CHANNELS, true));
+ item->SetLabel(g_localizeStrings.Get(19019)); // Channels
+ item->SetProperty("node.target", CWindowTranslator::TranslateWindow(bRadio ? WINDOW_RADIO_CHANNELS
+ : WINDOW_TV_CHANNELS));
+ item->SetArt("icon", "DefaultPVRChannels.png");
+ results.Add(item);
+
+ // EPG
+ const bool bAnyClientSupportingEPG = clients->AnyClientSupportingEPG();
+ if (bAnyClientSupportingEPG)
+ {
+ item.reset(
+ new CFileItem(StringUtils::Format("pvr://guide/%s/", bRadio ? "radio" : "tv"), true));
+ item->SetLabel(g_localizeStrings.Get(19069)); // Guide
+ item->SetProperty("node.target", CWindowTranslator::TranslateWindow(bRadio ? WINDOW_RADIO_GUIDE
+ : WINDOW_TV_GUIDE));
+ item->SetArt("icon", "DefaultPVRGuide.png");
+ results.Add(item);
+ }
+
+ // Recordings
+ if (clients->AnyClientSupportingRecordings())
+ {
+ item.reset(new CFileItem(bRadio ? CPVRRecordingsPath::PATH_ACTIVE_RADIO_RECORDINGS
+ : CPVRRecordingsPath::PATH_ACTIVE_TV_RECORDINGS,
+ true));
+ item->SetLabel(g_localizeStrings.Get(19017)); // Recordings
+ item->SetProperty("node.target", CWindowTranslator::TranslateWindow(
+ bRadio ? WINDOW_RADIO_RECORDINGS : WINDOW_TV_RECORDINGS));
+ item->SetArt("icon", "DefaultPVRRecordings.png");
+ results.Add(item);
+ }
+
+ // Timers/Timer rules
+ // - always present, because Reminders are always available, no client support needed for this
+ item.reset(new CFileItem(
+ bRadio ? CPVRTimersPath::PATH_RADIO_TIMERS : CPVRTimersPath::PATH_TV_TIMERS, true));
+ item->SetLabel(g_localizeStrings.Get(19040)); // Timers
+ item->SetProperty("node.target", CWindowTranslator::TranslateWindow(bRadio ? WINDOW_RADIO_TIMERS
+ : WINDOW_TV_TIMERS));
+ item->SetArt("icon", "DefaultPVRTimers.png");
+ results.Add(item);
+
+ item.reset(new CFileItem(
+ bRadio ? CPVRTimersPath::PATH_RADIO_TIMER_RULES : CPVRTimersPath::PATH_TV_TIMER_RULES, true));
+ item->SetLabel(g_localizeStrings.Get(19138)); // Timer rules
+ item->SetProperty("node.target", CWindowTranslator::TranslateWindow(
+ bRadio ? WINDOW_RADIO_TIMER_RULES : WINDOW_TV_TIMER_RULES));
+ item->SetArt("icon", "DefaultPVRTimerRules.png");
+ results.Add(item);
+
+ // Search
+ if (bAnyClientSupportingEPG)
+ {
+ item.reset(
+ new CFileItem(StringUtils::Format("pvr://search/%s/", bRadio ? "radio" : "tv"), true));
+ item->SetLabel(g_localizeStrings.Get(137)); // Search
+ item->SetProperty("node.target", CWindowTranslator::TranslateWindow(bRadio ? WINDOW_RADIO_SEARCH
+ : WINDOW_TV_SEARCH));
+ item->SetArt("icon", "DefaultPVRSearch.png");
+ results.Add(item);
+ }
+
+ return true;
+}
+
+} // unnamed namespace
+
bool CPVRGUIDirectory::GetDirectory(CFileItemList& results) const
{
std::string base = m_url.Get();
@@ -89,6 +171,22 @@ bool CPVRGUIDirectory::GetDirectory(CFileItemList& results) const
}
return true;
}
+ else if (StringUtils::StartsWith(fileName, "tv"))
+ {
+ if (CServiceBroker::GetPVRManager().IsStarted())
+ {
+ return GetRootDirectory(false, results);
+ }
+ return true;
+ }
+ else if (StringUtils::StartsWith(fileName, "radio"))
+ {
+ if (CServiceBroker::GetPVRManager().IsStarted())
+ {
+ return GetRootDirectory(true, results);
+ }
+ return true;
+ }
else if (StringUtils::StartsWith(fileName, "recordings"))
{
if (CServiceBroker::GetPVRManager().IsStarted())
diff --git a/xbmc/pvr/timers/PVRTimersPath.cpp b/xbmc/pvr/timers/PVRTimersPath.cpp
index bad8f3977d..05c368003f 100644
--- a/xbmc/pvr/timers/PVRTimersPath.cpp
+++ b/xbmc/pvr/timers/PVRTimersPath.cpp
@@ -19,6 +19,10 @@ using namespace PVR;
const std::string CPVRTimersPath::PATH_ADDTIMER = "pvr://timers/addtimer/";
const std::string CPVRTimersPath::PATH_NEW = "pvr://timers/new/";
+const std::string CPVRTimersPath::PATH_TV_TIMERS = "pvr://timers/tv/timers/";
+const std::string CPVRTimersPath::PATH_TV_TIMER_RULES = "pvr://timers/radio/timers/";
+const std::string CPVRTimersPath::PATH_RADIO_TIMERS = "pvr://timers/tv/rules/";
+const std::string CPVRTimersPath::PATH_RADIO_TIMER_RULES = "pvr://timers/radio/rules/";
CPVRTimersPath::CPVRTimersPath(const std::string& strPath)
{
diff --git a/xbmc/pvr/timers/PVRTimersPath.h b/xbmc/pvr/timers/PVRTimersPath.h
index a577692e07..a5acb81c3c 100644
--- a/xbmc/pvr/timers/PVRTimersPath.h
+++ b/xbmc/pvr/timers/PVRTimersPath.h
@@ -17,6 +17,10 @@ namespace PVR
public:
static const std::string PATH_ADDTIMER;
static const std::string PATH_NEW;
+ static const std::string PATH_TV_TIMERS;
+ static const std::string PATH_TV_TIMER_RULES;
+ static const std::string PATH_RADIO_TIMERS;
+ static const std::string PATH_RADIO_TIMER_RULES;
explicit CPVRTimersPath(const std::string& strPath);
CPVRTimersPath(const std::string& strPath, int iClientId, int iParentId);
diff --git a/xbmc/pvr/windows/GUIWindowPVRChannels.cpp b/xbmc/pvr/windows/GUIWindowPVRChannels.cpp
index 8e68d1b5a2..5714338b6c 100644
--- a/xbmc/pvr/windows/GUIWindowPVRChannels.cpp
+++ b/xbmc/pvr/windows/GUIWindowPVRChannels.cpp
@@ -132,9 +132,16 @@ bool CGUIWindowPVRChannelsBase::OnMessage(CGUIMessage& message)
switch (message.GetMessage())
{
case GUI_MSG_WINDOW_INIT:
- // if a path to a channel group is given we must init that group instead of last played/selected group
- m_channelGroupPath = message.GetStringParam(0);
+ {
+ const CPVRChannelsPath path(message.GetStringParam(0));
+ if (path.IsValid() && path.IsChannelGroup())
+ {
+ // if a path to a channel group is given we must init
+ // that group instead of last played/selected group
+ m_channelGroupPath = message.GetStringParam(0);
+ }
break;
+ }
case GUI_MSG_CLICKED:
if (message.GetSenderId() == m_viewControl.GetCurrentControl())
diff --git a/xbmc/pvr/windows/GUIWindowPVRGuide.cpp b/xbmc/pvr/windows/GUIWindowPVRGuide.cpp
index b7ad0e3c9d..eedd212b09 100644
--- a/xbmc/pvr/windows/GUIWindowPVRGuide.cpp
+++ b/xbmc/pvr/windows/GUIWindowPVRGuide.cpp
@@ -27,6 +27,7 @@
#include "pvr/channels/PVRChannel.h"
#include "pvr/channels/PVRChannelGroup.h"
#include "pvr/channels/PVRChannelGroupsContainer.h"
+#include "pvr/channels/PVRChannelsPath.h"
#include "pvr/epg/EpgChannelData.h"
#include "pvr/epg/EpgContainer.h"
#include "pvr/epg/EpgInfoTag.h"
@@ -368,9 +369,16 @@ bool CGUIWindowPVRGuideBase::OnMessage(CGUIMessage& message)
switch (message.GetMessage())
{
case GUI_MSG_WINDOW_INIT:
- // if a path to a channel group is given we must init that group instead of last played/selected group
- m_channelGroupPath = message.GetStringParam(0);
+ {
+ const CPVRChannelsPath path(message.GetStringParam(0));
+ if (path.IsValid() && path.IsChannelGroup())
+ {
+ // if a path to a channel group is given we must init
+ // that group instead of last played/selected group
+ m_channelGroupPath = message.GetStringParam(0);
+ }
break;
+ }
case GUI_MSG_ITEM_SELECTED:
message.SetParam1(GetCurrentListItemIndex(GetCurrentListItem()));