Merge branch 'pbiering/skindesigner-add-menurecording-recchannel-and-add-fallback'

This commit is contained in:
kamel5 2021-01-24 13:06:13 +01:00
commit 3255936658
7 changed files with 80 additions and 19 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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