expose to displaymenurecordings: recchannelname, recchannelid, recchannelnumber

add fallback to get name/id from 'info' in case channel is no longer in active channel list
This commit is contained in:
Peter Bieringer 2021-01-23 23:19:16 +01:00
parent 16eb7e8e53
commit b9b82875ba
5 changed files with 62 additions and 0 deletions

View File

@ -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,

View File

@ -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();

View File

@ -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());
}
}

View File

@ -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 = "";

View File

@ -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)