allow currentelements to use conditions

This commit is contained in:
louis 2015-06-05 17:32:24 +02:00
parent b6a6ea2f6b
commit 64b131e6b0
7 changed files with 53 additions and 8 deletions

View File

@ -363,4 +363,6 @@ Version 0.5.2
- only close OSD when a skin is successfully updated from Git - only close OSD when a skin is successfully updated from Git
- refresh custom token display with each custom token change - refresh custom token display with each custom token change
- added recording shorttext, description and scraper poster tokens
to displaymenurecordings listelement
- allow currentelements to use conditions

View File

@ -170,6 +170,7 @@ bool cSDDisplayMenu::SetItemRecording(const cRecording *Recording, int Index, bo
cDisplayMenuListView *list = rootView->GetListView(); cDisplayMenuListView *list = rootView->GetListView();
if (!list) if (!list)
return false; return false;
list->AddRecordingMenuItem(Index, Recording, Level, Total, New, Current, Selectable); list->AddRecordingMenuItem(Index, Recording, Level, Total, New, Current, Selectable);
if (state == vsIdle) if (state == vsIdle)
state = vsMenuUpdate; state = vsMenuUpdate;

View File

@ -430,6 +430,7 @@
<!ATTLIST currentelement <!ATTLIST currentelement
delay CDATA #REQUIRED delay CDATA #REQUIRED
fadetime CDATA #IMPLIED fadetime CDATA #IMPLIED
condition CDATA #IMPLIED
debug CDATA #IMPLIED debug CDATA #IMPLIED
> >

View File

@ -1245,6 +1245,7 @@ cTemplateViewMenu::cTemplateViewMenu(void) {
attributes.insert("debug"); attributes.insert("debug");
attributes.insert("delay"); attributes.insert("delay");
attributes.insert("fadetime"); attributes.insert("fadetime");
attributes.insert("condition");
funcsAllowed.insert(pair< string, set<string> >("currentelement", attributes)); funcsAllowed.insert(pair< string, set<string> >("currentelement", attributes));
//definition of allowed parameters for viewtab //definition of allowed parameters for viewtab

View File

@ -3,6 +3,9 @@
<!-- Available Variables recordings menu listelement: <!-- Available Variables recordings menu listelement:
{nummenuitem} number of item in list, starts with 1 {nummenuitem} number of item in list, starts with 1
{name} Name of recording {name} Name of recording
{epgname} Name of recording (Name from EPG)
{shorttext} Short Text of recording
{description} Descrption of recording
{date} Date of recording (day dd.mm.yyyy) {date} Date of recording (day dd.mm.yyyy)
{time} Time of recording {time} Time of recording
{daynumeric} day as number {daynumeric} day as number
@ -17,6 +20,7 @@
{current} true if item is currently selected {current} true if item is currently selected
{new} true if recording is new {new} true if recording is new
{percentseen} percent already watched, -1 for VDR < 2.1.8 {percentseen} percent already watched, -1 for VDR < 2.1.8
{watched} true if percentseen > 85% including MarginStop of not cutted recording
{cutted} true if recording is cutted {cutted} true if recording is cutted
{folder} true if item is a folder {folder} true if item is a folder
{numrecordingsfolder} if item is a folder, number of recordings in this folder {numrecordingsfolder} if item is a folder, number of recordings in this folder
@ -25,6 +29,10 @@
{thumbnailbwidth} width of scraped poster thumbnail {thumbnailbwidth} width of scraped poster thumbnail
{thumbnailheight} height of scraped poster thumbnail {thumbnailheight} height of scraped poster thumbnail
{thumbnailpath} absolute path of scraped poster thumbnail {thumbnailpath} absolute path of scraped poster thumbnail
{hasposter} true if a scraped poster is available for recording
{posterwidth} width of scraped poster
{posterheight} height of scraped poster
{posterpath} absolute path of scraped poster
--> -->
<listelement> <listelement>
<!-- Background --> <!-- Background -->

View File

@ -4,6 +4,8 @@
{nummenuitem} number of item in list, starts with 1 {nummenuitem} number of item in list, starts with 1
{name} Real Name of recording (Name of Recording Folder) {name} Real Name of recording (Name of Recording Folder)
{epgname} Name of recording (Name from EPG) {epgname} Name of recording (Name from EPG)
{shorttext} Short Text of recording
{description} Descrption of recording
{date} Date of recording {date} Date of recording
{time} Time of recording {time} Time of recording
{daynumeric} day as number {daynumeric} day as number
@ -27,6 +29,10 @@
{thumbnailbwidth} width of scraped poster thumbnail {thumbnailbwidth} width of scraped poster thumbnail
{thumbnailheight} height of scraped poster thumbnail {thumbnailheight} height of scraped poster thumbnail
{thumbnailpath} absolute path of scraped poster thumbnail {thumbnailpath} absolute path of scraped poster thumbnail
{hasposter} true if a scraped poster is available for recording
{posterwidth} width of scraped poster
{posterheight} height of scraped poster
{posterpath} absolute path of scraped poster
--> -->
<listelement> <listelement>
</listelement> </listelement>

View File

@ -227,7 +227,7 @@ void cDisplayMenuItemMainView::Render(void) {
if (current) { if (current) {
cTemplateViewElement *tmplCurrent = tmplList->GetListElementCurrent(); cTemplateViewElement *tmplCurrent = tmplList->GetListElementCurrent();
if (tmplCurrent) { if (tmplCurrent && tmplCurrent->Execute()) {
currentView = new cDisplayMenuItemCurrentMainView(tmplCurrent, number, label, icon); currentView = new cDisplayMenuItemCurrentMainView(tmplCurrent, number, label, icon);
currentView->SetPosMenuItem(pos); currentView->SetPosMenuItem(pos);
currentView->Start(); currentView->Start();
@ -418,7 +418,7 @@ void cDisplayMenuItemSchedulesView::Render(void) {
if (current) { if (current) {
cTemplateViewElement *tmplCurrent = tmplList->GetListElementCurrent(); cTemplateViewElement *tmplCurrent = tmplList->GetListElementCurrent();
if (tmplCurrent) { if (tmplCurrent && tmplCurrent->Execute()) {
currentView = new cDisplayMenuItemCurrentSchedulesView(tmplCurrent, event, channel, timerMatch, cat, isEpgSearchFav); currentView = new cDisplayMenuItemCurrentSchedulesView(tmplCurrent, event, channel, timerMatch, cat, isEpgSearchFav);
currentView->Start(); currentView->Start();
} }
@ -526,7 +526,7 @@ void cDisplayMenuItemChannelsView::Render(void) {
if (current) { if (current) {
cTemplateViewElement *tmplCurrent = tmplList->GetListElementCurrent(); cTemplateViewElement *tmplCurrent = tmplList->GetListElementCurrent();
if (tmplCurrent) { if (tmplCurrent && tmplCurrent->Execute()) {
currentView = new cDisplayMenuItemCurrentChannelView(tmplCurrent, channel); currentView = new cDisplayMenuItemCurrentChannelView(tmplCurrent, channel);
currentView->Start(); currentView->Start();
} }
@ -657,7 +657,7 @@ void cDisplayMenuItemTimersView::Render(void) {
if (current) { if (current) {
cTemplateViewElement *tmplCurrent = tmplList->GetListElementCurrent(); cTemplateViewElement *tmplCurrent = tmplList->GetListElementCurrent();
if (tmplCurrent) { if (tmplCurrent && tmplCurrent->Execute()) {
currentView = new cDisplayMenuItemCurrentTimerView(tmplCurrent, timer); currentView = new cDisplayMenuItemCurrentTimerView(tmplCurrent, timer);
currentView->Start(); currentView->Start();
} }
@ -805,6 +805,9 @@ void cDisplayMenuItemRecordingView::SetTokens(void) {
intTokens.insert(pair<string,int>("durationeventhours", duration / 60)); intTokens.insert(pair<string,int>("durationeventhours", duration / 60));
stringTokens.insert(pair<string,string>("durationeventminutes", *cString::sprintf("%.2d", duration%60))); stringTokens.insert(pair<string,string>("durationeventminutes", *cString::sprintf("%.2d", duration%60)));
stringTokens.insert(pair<string,string>("shorttext", info->ShortText() ? info->ShortText() : ""));
stringTokens.insert(pair<string,string>("description", info->Description() ? info->Description() : ""));
static cPlugin *pScraper = GetScraperPlugin(); static cPlugin *pScraper = GetScraperPlugin();
if (!pScraper || !usedRecording) { if (!pScraper || !usedRecording) {
intTokens.insert(pair<string,int>("hasposterthumbnail", false)); intTokens.insert(pair<string,int>("hasposterthumbnail", false));
@ -828,6 +831,29 @@ void cDisplayMenuItemRecordingView::SetTokens(void) {
intTokens.insert(pair<string,int>("thumbnailheight", -1)); intTokens.insert(pair<string,int>("thumbnailheight", -1));
stringTokens.insert(pair<string,string>("thumbnailpath", "")); stringTokens.insert(pair<string,string>("thumbnailpath", ""));
} }
if (!pScraper || !usedRecording) {
intTokens.insert(pair<string,int>("hasposter", false));
intTokens.insert(pair<string,int>("posterwidth", -1));
intTokens.insert(pair<string,int>("posterheight", -1));
stringTokens.insert(pair<string,string>("posterpath", ""));
return;
}
ScraperGetPoster call2;
call2.event = NULL;
call2.recording = usedRecording;
if (pScraper->Service("GetPoster", &call2)) {
intTokens.insert(pair<string,int>("hasposter", FileExists(call2.poster.path)));
intTokens.insert(pair<string,int>("posterwidth", call2.poster.width));
intTokens.insert(pair<string,int>("posterheight", call2.poster.height));
stringTokens.insert(pair<string,string>("posterpath", call2.poster.path));
} else {
intTokens.insert(pair<string,int>("hasposter", false));
intTokens.insert(pair<string,int>("posterwidth", -1));
intTokens.insert(pair<string,int>("posterheight", -1));
stringTokens.insert(pair<string,string>("posterpath", ""));
}
} }
@ -841,7 +867,7 @@ void cDisplayMenuItemRecordingView::Render(void) {
if (current) { if (current) {
cTemplateViewElement *tmplCurrent = tmplList->GetListElementCurrent(); cTemplateViewElement *tmplCurrent = tmplList->GetListElementCurrent();
if (tmplCurrent) { if (tmplCurrent && tmplCurrent->Execute()) {
currentView = new cDisplayMenuItemCurrentRecordingView(tmplCurrent, recording, level, total, newRecs); currentView = new cDisplayMenuItemCurrentRecordingView(tmplCurrent, recording, level, total, newRecs);
currentView->Start(); currentView->Start();
} }
@ -898,7 +924,7 @@ void cDisplayMenuItemPluginView::Render(void) {
if (current) { if (current) {
cTemplateViewElement *tmplCurrent = tmplList->GetListElementCurrent(); cTemplateViewElement *tmplCurrent = tmplList->GetListElementCurrent();
if (tmplCurrent) { if (tmplCurrent && tmplCurrent->Execute()) {
currentView = new cDisplayMenuItemCurrentPluginView(tmplCurrent, stringTokens, intTokens, loopTokens); currentView = new cDisplayMenuItemCurrentPluginView(tmplCurrent, stringTokens, intTokens, loopTokens);
currentView->Start(); currentView->Start();
} }