diff --git a/HISTORY b/HISTORY index e6b5e0f..07eb0e3 100644 --- a/HISTORY +++ b/HISTORY @@ -465,3 +465,5 @@ Version 1.2.9 Version 1.2.10 - [pbiering] added tokens for recordings: isUHD, isRadio - [pbiering] added token for channels: isUHD +- [pbiering] expose to displaymenurecordings: recchannelname, recchannelid, recchannelnumber +- [pbiering] add fallback to get name/id from 'info' in case channel is no longer in active channel list diff --git a/coreengine/definitions.h b/coreengine/definitions.h index 6de0fdd..534f154 100644 --- a/coreengine/definitions.h +++ b/coreengine/definitions.h @@ -1139,6 +1139,8 @@ enum class eLeMenuRecordingsST { durationeventminutes, thumbnailpath, posterpath, + recchannelname, + recchannelid, count }; @@ -1184,6 +1186,8 @@ enum class eCeMenuRecordingsST { durationeventminutes, thumbnailpath, posterpath, + recchannelname, + recchannelid, count }; diff --git a/coreengine/listelements.c b/coreengine/listelements.c index 0599124..6c500bf 100644 --- a/coreengine/listelements.c +++ b/coreengine/listelements.c @@ -1754,6 +1754,8 @@ 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); InheritTokenContainer(); } @@ -1852,6 +1854,24 @@ bool cLeMenuRecordings::Parse(bool forced) { tokenContainer->AddStringToken((int)eLeMenuRecordingsST::epgname, info->Title() ? info->Title() : recName); delete[] recName; + if (info) { + if (info->ChannelName() && (strlen(info->ChannelName()) > 0)) { + tokenContainer->AddStringToken((int)eLeMenuRecordingsST::recchannelname, info->ChannelName()); + tokenContainer->AddStringToken((int)eLeMenuRecordingsST::recchannelid, info->ChannelID().ToString()); + } else { +#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()); + } + } + } + cString recDate = event->GetDateString(); cString recTime = event->GetTimeString(); if (strstr(*recDate, "1970")) { @@ -2008,6 +2028,8 @@ 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); InheritTokenContainer(); } @@ -2112,6 +2134,24 @@ bool cCeMenuRecordings::Parse(bool forced) { event = info->GetEvent(); if (!event) return true; + if (info) { + if (info->ChannelName() && (strlen(info->ChannelName()) > 0)) { + tokenContainer->AddStringToken((int)eCeMenuRecordingsST::recchannelname, info->ChannelName()); + tokenContainer->AddStringToken((int)eCeMenuRecordingsST::recchannelid, info->ChannelID().ToString()); + } else { +#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->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..b63e9df 100644 --- a/coreengine/viewdetail.c +++ b/coreengine/viewdetail.c @@ -812,20 +812,25 @@ void cViewDetailRec::SetRecInfos(void) { const cRecordingInfo *info = recording->Info(); if (info) { + if (info->ChannelName() && (strlen(info->ChannelName()) > 0)) { + tokenContainer->AddStringToken((int)eDmDetailedRecST::recchannelname, info->ChannelName()); + tokenContainer->AddStringToken((int)eDmDetailedRecST::recchannelid, info->ChannelID().ToString()); + tokenContainer->AddIntToken((int)eDmDetailedRecIT::recchannelnumber, 0); // cannot be provided, for backward compatibility only + } else { #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) - LOCK_CHANNELS_READ; - const cChannel *channel = Channels->GetByChannelID(info->ChannelID()); + LOCK_CHANNELS_READ; + const cChannel *channel = Channels->GetByChannelID(info->ChannelID()); #else - const cChannel *channel = Channels.GetByChannelID(info->ChannelID()); + const cChannel *channel = Channels.GetByChannelID(info->ChannelID()); #endif - if (channel) { - tokenContainer->AddStringToken((int)eDmDetailedRecST::recchannelname, channel->Name()); - tokenContainer->AddStringToken((int)eDmDetailedRecST::recchannelid, *channel->GetChannelID().ToString()); - tokenContainer->AddIntToken((int)eDmDetailedRecIT::recchannelnumber, channel->Number()); - } + if (channel) { + tokenContainer->AddStringToken((int)eDmDetailedRecST::recchannelname, channel->Name()); + tokenContainer->AddStringToken((int)eDmDetailedRecST::recchannelid, *channel->GetChannelID().ToString()); + tokenContainer->AddIntToken((int)eDmDetailedRecIT::recchannelnumber, channel->Number()); + } + } } - if (index) { int nLastIndex = index->Last(); if (nLastIndex) { diff --git a/coreengine/viewelementsdisplaymenu.c b/coreengine/viewelementsdisplaymenu.c index 650fae7..5887f26 100644 --- a/coreengine/viewelementsdisplaymenu.c +++ b/coreengine/viewelementsdisplaymenu.c @@ -1219,18 +1219,24 @@ bool cVeDmDetailheaderRec::Parse(bool forced) { tokenContainer->AddIntToken((int)eDmDetailedHeaderRecIT::isUHD, RecordingIsUHD(event)); // detect UHD from 'info' tokenContainer->AddIntToken((int)eDmDetailedHeaderRecIT::isRadio, RecordingIsRadio(event, info->FramesPerSecond())); // detect Radio from 'info' and FPS } + + if (info->ChannelName() && (strlen(info->ChannelName()) > 0)) { + tokenContainer->AddStringToken((int)eDmDetailedRecST::recchannelname, info->ChannelName()); + tokenContainer->AddStringToken((int)eDmDetailedRecST::recchannelid, info->ChannelID().ToString()); + tokenContainer->AddIntToken((int)eDmDetailedRecIT::recchannelnumber, 0); // cannot be provided, for backward compatibility only + } else { #if defined (APIVERSNUM) && (APIVERSNUM >= 20301) - LOCK_CHANNELS_READ; - const cChannels* channels = Channels; + LOCK_CHANNELS_READ; + const cChannel *channel = Channels->GetByChannelID(info->ChannelID()); #else - cChannels* channels = &Channels; + const cChannel *channel = Channels.GetByChannelID(info->ChannelID()); #endif - const cChannel *channel = channels->GetByChannelID(info->ChannelID()); - if (channel) { - tokenContainer->AddStringToken((int)eDmDetailedHeaderRecST::recchannelname, channel->Name()); - tokenContainer->AddStringToken((int)eDmDetailedHeaderRecST::recchannelid, *channel->GetChannelID().ToString()); - tokenContainer->AddIntToken((int)eDmDetailedHeaderRecIT::recchannelnumber, channel->Number()); - } + if (channel) { + tokenContainer->AddStringToken((int)eDmDetailedRecST::recchannelname, channel->Name()); + tokenContainer->AddStringToken((int)eDmDetailedRecST::recchannelid, *channel->GetChannelID().ToString()); + tokenContainer->AddIntToken((int)eDmDetailedRecIT::recchannelnumber, channel->Number()); + } + } } string recImage = ""; string path = recording->FileName() ? recording->FileName() : ""; diff --git a/skindesigner.c b/skindesigner.c index 33f249b..c3f3e66 100644 --- a/skindesigner.c +++ b/skindesigner.c @@ -21,7 +21,7 @@ #endif -static const char *VERSION = "1.2.9"; +static const char *VERSION = "1.2.10"; static const char *DESCRIPTION = trNOOP("Skin Designer"); class cPluginSkinDesigner : public cPlugin, public skindesignerapi::SkindesignerAPI { diff --git a/skinskeleton/xmlfiles/displaymenurecordings.xml b/skinskeleton/xmlfiles/displaymenurecordings.xml index 2a5ce3c..e46fd12 100644 --- a/skinskeleton/xmlfiles/displaymenurecordings.xml +++ b/skinskeleton/xmlfiles/displaymenurecordings.xml @@ -33,6 +33,8 @@ {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 {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 +78,8 @@ {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 {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)