From b9b82875bad96d69e895d54ef0f88be998d12be2 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Sat, 23 Jan 2021 23:19:16 +0100 Subject: [PATCH] expose to displaymenurecordings: recchannelname, recchannelid, recchannelnumber add fallback to get name/id from 'info' in case channel is no longer in active channel list --- coreengine/definitions.h | 6 +++ coreengine/listelements.c | 42 +++++++++++++++++++ coreengine/viewdetail.c | 4 ++ coreengine/viewelementsdisplaymenu.c | 4 ++ .../xmlfiles/displaymenurecordings.xml | 6 +++ 5 files changed, 62 insertions(+) diff --git a/coreengine/definitions.h b/coreengine/definitions.h index 6de0fdd..57ce803 100644 --- a/coreengine/definitions.h +++ b/coreengine/definitions.h @@ -1139,6 +1139,8 @@ enum class eLeMenuRecordingsST { durationeventminutes, thumbnailpath, posterpath, + recchannelname, + recchannelid, count }; @@ -1166,6 +1168,7 @@ enum class eLeMenuRecordingsIT { hasposter, posterwidth, posterheight, + recchannelnumber, framesPerSecond, isHD, isUHD, @@ -1184,6 +1187,8 @@ enum class eCeMenuRecordingsST { durationeventminutes, thumbnailpath, posterpath, + recchannelname, + recchannelid, count }; @@ -1213,6 +1218,7 @@ enum class eCeMenuRecordingsIT { hasposter, posterwidth, posterheight, + recchannelnumber, framesPerSecond, isHD, isUHD, diff --git a/coreengine/listelements.c b/coreengine/listelements.c index 0599124..6f66097 100644 --- a/coreengine/listelements.c +++ b/coreengine/listelements.c @@ -1754,6 +1754,9 @@ void cLeMenuRecordings::SetTokenContainer(void) { tokenContainer->DefineIntToken("{isHD}", (int)eLeMenuRecordingsIT::isHD); tokenContainer->DefineIntToken("{isUHD}", (int)eLeMenuRecordingsIT::isUHD); tokenContainer->DefineIntToken("{isRadio}", (int)eLeMenuRecordingsIT::isRadio); + tokenContainer->DefineStringToken("{recchannelname}", (int)eLeMenuRecordingsST::recchannelname); + tokenContainer->DefineStringToken("{recchannelid}", (int)eLeMenuRecordingsST::recchannelid); + tokenContainer->DefineIntToken("{recchannelnumber}", (int)eLeMenuRecordingsIT::recchannelnumber); InheritTokenContainer(); } @@ -1852,6 +1855,24 @@ bool cLeMenuRecordings::Parse(bool forced) { tokenContainer->AddStringToken((int)eLeMenuRecordingsST::epgname, info->Title() ? info->Title() : recName); delete[] recName; + if (info) { +#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) + LOCK_CHANNELS_READ; + const cChannel *channel = Channels->GetByChannelID(info->ChannelID()); +#else + const cChannel *channel = Channels.GetByChannelID(info->ChannelID()); +#endif + if (channel) { + tokenContainer->AddStringToken((int)eLeMenuRecordingsST::recchannelname, channel->Name()); + tokenContainer->AddStringToken((int)eLeMenuRecordingsST::recchannelid, *channel->GetChannelID().ToString()); + tokenContainer->AddIntToken((int)eLeMenuRecordingsIT::recchannelnumber, channel->Number()); + } else { + // fallback to information provided in 'info' if channel is no longer found in active channels + tokenContainer->AddStringToken((int)eCeMenuRecordingsST::recchannelname, info->ChannelName()); + tokenContainer->AddStringToken((int)eCeMenuRecordingsST::recchannelid, info->ChannelID().ToString()); + } + } + cString recDate = event->GetDateString(); cString recTime = event->GetTimeString(); if (strstr(*recDate, "1970")) { @@ -2008,6 +2029,9 @@ void cCeMenuRecordings::SetTokenContainer(void) { tokenContainer->DefineIntToken("{isHD}", (int)eCeMenuRecordingsIT::isHD); tokenContainer->DefineIntToken("{isUHD}", (int)eCeMenuRecordingsIT::isUHD); tokenContainer->DefineIntToken("{isRadio}", (int)eCeMenuRecordingsIT::isRadio); + tokenContainer->DefineStringToken("{recchannelname}", (int)eCeMenuRecordingsST::recchannelname); + tokenContainer->DefineStringToken("{recchannelid}", (int)eCeMenuRecordingsST::recchannelid); + tokenContainer->DefineIntToken("{recchannelnumber}", (int)eCeMenuRecordingsIT::recchannelnumber); InheritTokenContainer(); } @@ -2112,6 +2136,24 @@ bool cCeMenuRecordings::Parse(bool forced) { event = info->GetEvent(); if (!event) return true; + if (info) { +#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) + LOCK_CHANNELS_READ; + const cChannel *channel = Channels->GetByChannelID(info->ChannelID()); +#else + const cChannel *channel = Channels.GetByChannelID(info->ChannelID()); +#endif + if (channel) { + tokenContainer->AddStringToken((int)eCeMenuRecordingsST::recchannelname, channel->Name()); + tokenContainer->AddStringToken((int)eCeMenuRecordingsST::recchannelid, *channel->GetChannelID().ToString()); + tokenContainer->AddIntToken((int)eCeMenuRecordingsIT::recchannelnumber, channel->Number()); + } else { + // fallback to information provided in 'info' if channel is no longer found in active channels + tokenContainer->AddStringToken((int)eCeMenuRecordingsST::recchannelname, info->ChannelName()); + tokenContainer->AddStringToken((int)eCeMenuRecordingsST::recchannelid, info->ChannelID().ToString()); + } + } + tokenContainer->AddStringToken((int)eCeMenuRecordingsST::epgname, info->Title() ? info->Title() : buffer.c_str()); cString recDate = event->GetDateString(); cString recTime = event->GetTimeString(); diff --git a/coreengine/viewdetail.c b/coreengine/viewdetail.c index bb6d8b5..e4791c6 100644 --- a/coreengine/viewdetail.c +++ b/coreengine/viewdetail.c @@ -822,6 +822,10 @@ void cViewDetailRec::SetRecInfos(void) { tokenContainer->AddStringToken((int)eDmDetailedRecST::recchannelname, channel->Name()); tokenContainer->AddStringToken((int)eDmDetailedRecST::recchannelid, *channel->GetChannelID().ToString()); tokenContainer->AddIntToken((int)eDmDetailedRecIT::recchannelnumber, channel->Number()); + } else { + // fallback to information provided in 'info' if channel is no longer found in active channels + tokenContainer->AddStringToken((int)eDmDetailedRecST::recchannelname, info->ChannelName()); + tokenContainer->AddStringToken((int)eDmDetailedRecST::recchannelid, info->ChannelID().ToString()); } } diff --git a/coreengine/viewelementsdisplaymenu.c b/coreengine/viewelementsdisplaymenu.c index 650fae7..dad279a 100644 --- a/coreengine/viewelementsdisplaymenu.c +++ b/coreengine/viewelementsdisplaymenu.c @@ -1230,6 +1230,10 @@ bool cVeDmDetailheaderRec::Parse(bool forced) { tokenContainer->AddStringToken((int)eDmDetailedHeaderRecST::recchannelname, channel->Name()); tokenContainer->AddStringToken((int)eDmDetailedHeaderRecST::recchannelid, *channel->GetChannelID().ToString()); tokenContainer->AddIntToken((int)eDmDetailedHeaderRecIT::recchannelnumber, channel->Number()); + } else { + // fallback to information provided in 'info' if channel is no longer found in active channels + tokenContainer->AddStringToken((int)eDmDetailedHeaderRecST::recchannelname, info->ChannelName()); + tokenContainer->AddStringToken((int)eDmDetailedHeaderRecST::recchannelid, info->ChannelID().ToString()); } } string recImage = ""; diff --git a/skinskeleton/xmlfiles/displaymenurecordings.xml b/skinskeleton/xmlfiles/displaymenurecordings.xml index 2a5ce3c..9bde817 100644 --- a/skinskeleton/xmlfiles/displaymenurecordings.xml +++ b/skinskeleton/xmlfiles/displaymenurecordings.xml @@ -33,6 +33,9 @@ {posterwidth} width of scraped poster {posterheight} height of scraped poster {posterpath} absolute path of scraped poster + {recchannelname} name of channel from which was recorded + {recchannelid} id of channel from which was recorded + {recchannelnumber} number of channel from which was recorded {framesPerSecond} frames per second (from EPG info) {isHD} true if recording is HD/UHD (from EPG info) {isUHD} true if recording is UHD (from EPG info) @@ -76,6 +79,9 @@ {bannerwidth} width of scraped banner {bannerheight} height of scraped banner {bannerpath} absolute path of scraped banner + {recchannelname} name of channel from which was recorded + {recchannelid} id of channel from which was recorded + {recchannelnumber} number of channel from which was recorded {framesPerSecond} frames per second (from EPG info) {isHD} true if recording is HD/UHD (from EPG info) {isUHD} true if recording is UHD (from EPG info)