- retrieve ChannelName from 'info' and fallback via ChannelID from active channel list (reverse mechanism)

- remove exposing ChannelID (senseless as default 'info' is not containing it)
This commit is contained in:
kamel5 2021-01-24 13:02:35 +01:00
parent b9b82875ba
commit c9c2d953a5
5 changed files with 55 additions and 58 deletions

View File

@ -1168,7 +1168,6 @@ enum class eLeMenuRecordingsIT {
hasposter, hasposter,
posterwidth, posterwidth,
posterheight, posterheight,
recchannelnumber,
framesPerSecond, framesPerSecond,
isHD, isHD,
isUHD, isUHD,
@ -1218,7 +1217,6 @@ enum class eCeMenuRecordingsIT {
hasposter, hasposter,
posterwidth, posterwidth,
posterheight, posterheight,
recchannelnumber,
framesPerSecond, framesPerSecond,
isHD, isHD,
isUHD, isUHD,

View File

@ -1756,7 +1756,6 @@ void cLeMenuRecordings::SetTokenContainer(void) {
tokenContainer->DefineIntToken("{isRadio}", (int)eLeMenuRecordingsIT::isRadio); tokenContainer->DefineIntToken("{isRadio}", (int)eLeMenuRecordingsIT::isRadio);
tokenContainer->DefineStringToken("{recchannelname}", (int)eLeMenuRecordingsST::recchannelname); tokenContainer->DefineStringToken("{recchannelname}", (int)eLeMenuRecordingsST::recchannelname);
tokenContainer->DefineStringToken("{recchannelid}", (int)eLeMenuRecordingsST::recchannelid); tokenContainer->DefineStringToken("{recchannelid}", (int)eLeMenuRecordingsST::recchannelid);
tokenContainer->DefineIntToken("{recchannelnumber}", (int)eLeMenuRecordingsIT::recchannelnumber);
InheritTokenContainer(); InheritTokenContainer();
} }
@ -1856,21 +1855,21 @@ bool cLeMenuRecordings::Parse(bool forced) {
delete[] recName; delete[] recName;
if (info) { 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) #if defined (APIVERSNUM) && (APIVERSNUM >= 20301)
LOCK_CHANNELS_READ; LOCK_CHANNELS_READ;
const cChannel *channel = Channels->GetByChannelID(info->ChannelID()); const cChannel *channel = Channels->GetByChannelID(info->ChannelID());
#else #else
const cChannel *channel = Channels.GetByChannelID(info->ChannelID()); const cChannel *channel = Channels.GetByChannelID(info->ChannelID());
#endif #endif
if (channel) { if (channel) {
tokenContainer->AddStringToken((int)eLeMenuRecordingsST::recchannelname, channel->Name()); tokenContainer->AddStringToken((int)eLeMenuRecordingsST::recchannelname, channel->Name());
tokenContainer->AddStringToken((int)eLeMenuRecordingsST::recchannelid, *channel->GetChannelID().ToString()); 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 recDate = event->GetDateString();
@ -2031,7 +2030,6 @@ void cCeMenuRecordings::SetTokenContainer(void) {
tokenContainer->DefineIntToken("{isRadio}", (int)eCeMenuRecordingsIT::isRadio); tokenContainer->DefineIntToken("{isRadio}", (int)eCeMenuRecordingsIT::isRadio);
tokenContainer->DefineStringToken("{recchannelname}", (int)eCeMenuRecordingsST::recchannelname); tokenContainer->DefineStringToken("{recchannelname}", (int)eCeMenuRecordingsST::recchannelname);
tokenContainer->DefineStringToken("{recchannelid}", (int)eCeMenuRecordingsST::recchannelid); tokenContainer->DefineStringToken("{recchannelid}", (int)eCeMenuRecordingsST::recchannelid);
tokenContainer->DefineIntToken("{recchannelnumber}", (int)eCeMenuRecordingsIT::recchannelnumber);
InheritTokenContainer(); InheritTokenContainer();
} }
@ -2137,21 +2135,21 @@ bool cCeMenuRecordings::Parse(bool forced) {
if (!event) return true; if (!event) return true;
if (info) { if (info) {
#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) if (info->ChannelName() && (strlen(info->ChannelName()) > 0)) {
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::recchannelname, info->ChannelName());
tokenContainer->AddStringToken((int)eCeMenuRecordingsST::recchannelid, info->ChannelID().ToString()); 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()); tokenContainer->AddStringToken((int)eCeMenuRecordingsST::epgname, info->Title() ? info->Title() : buffer.c_str());

View File

@ -812,24 +812,25 @@ void cViewDetailRec::SetRecInfos(void) {
const cRecordingInfo *info = recording->Info(); const cRecordingInfo *info = recording->Info();
if (info) { if (info) {
#if defined (APIVERSNUM) && (APIVERSNUM >= 20301) if (info->ChannelName() && (strlen(info->ChannelName()) > 0)) {
LOCK_CHANNELS_READ;
const cChannel *channel = Channels->GetByChannelID(info->ChannelID());
#else
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());
} 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::recchannelname, info->ChannelName());
tokenContainer->AddStringToken((int)eDmDetailedRecST::recchannelid, info->ChannelID().ToString()); 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());
#else
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 (index) { if (index) {
int nLastIndex = index->Last(); int nLastIndex = index->Last();
if (nLastIndex) { if (nLastIndex) {

View File

@ -1219,22 +1219,24 @@ bool cVeDmDetailheaderRec::Parse(bool forced) {
tokenContainer->AddIntToken((int)eDmDetailedHeaderRecIT::isUHD, RecordingIsUHD(event)); // detect UHD from 'info' 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 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) #if defined (APIVERSNUM) && (APIVERSNUM >= 20301)
LOCK_CHANNELS_READ; LOCK_CHANNELS_READ;
const cChannels* channels = Channels; const cChannel *channel = Channels->GetByChannelID(info->ChannelID());
#else #else
cChannels* channels = &Channels; const cChannel *channel = Channels.GetByChannelID(info->ChannelID());
#endif #endif
const cChannel *channel = channels->GetByChannelID(info->ChannelID()); if (channel) {
if (channel) { tokenContainer->AddStringToken((int)eDmDetailedRecST::recchannelname, channel->Name());
tokenContainer->AddStringToken((int)eDmDetailedHeaderRecST::recchannelname, channel->Name()); tokenContainer->AddStringToken((int)eDmDetailedRecST::recchannelid, *channel->GetChannelID().ToString());
tokenContainer->AddStringToken((int)eDmDetailedHeaderRecST::recchannelid, *channel->GetChannelID().ToString()); tokenContainer->AddIntToken((int)eDmDetailedRecIT::recchannelnumber, channel->Number());
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 = ""; string recImage = "";
string path = recording->FileName() ? recording->FileName() : ""; string path = recording->FileName() ? recording->FileName() : "";

View File

@ -35,7 +35,6 @@
{posterpath} absolute path of scraped poster {posterpath} absolute path of scraped poster
{recchannelname} name of channel from which was recorded {recchannelname} name of channel from which was recorded
{recchannelid} id 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) {framesPerSecond} frames per second (from EPG info)
{isHD} true if recording is HD/UHD (from EPG info) {isHD} true if recording is HD/UHD (from EPG info)
{isUHD} true if recording is UHD (from EPG info) {isUHD} true if recording is UHD (from EPG info)
@ -81,7 +80,6 @@
{bannerpath} absolute path of scraped banner {bannerpath} absolute path of scraped banner
{recchannelname} name of channel from which was recorded {recchannelname} name of channel from which was recorded
{recchannelid} id 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) {framesPerSecond} frames per second (from EPG info)
{isHD} true if recording is HD/UHD (from EPG info) {isHD} true if recording is HD/UHD (from EPG info)
{isUHD} true if recording is UHD (from EPG info) {isUHD} true if recording is UHD (from EPG info)