summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouis <louis.braun@gmx.de>2015-04-01 10:14:26 +0200
committerlouis <louis.braun@gmx.de>2015-04-01 10:14:26 +0200
commitb98fee9668de46a82148bc6c3569e69c8819baed (patch)
treeca46242c6c184b66beb0a2e8bd234ae916362cc2
parent203754e2047998185a177b177c5c46ccb265318e (diff)
downloadvdr-plugin-skindesigner-b98fee9668de46a82148bc6c3569e69c8819baed.tar.gz
vdr-plugin-skindesigner-b98fee9668de46a82148bc6c3569e69c8819baed.tar.bz2
use recording info for <currentschedule> viewelement in main menu if recording is replayed
-rw-r--r--HISTORY4
-rw-r--r--displaymenu.c18
-rw-r--r--displaymenu.h1
-rw-r--r--skins/blackhole/themes/default/icons/ico_sort_name.pngbin0 -> 2748 bytes
-rw-r--r--skins/blackhole/themes/default/icons/ico_sort_number.pngbin0 -> 2613 bytes
-rw-r--r--skins/blackhole/themes/default/icons/ico_sort_provider.pngbin0 -> 3814 bytes
-rw-r--r--skins/blackhole/themes/default/icons/ico_sort_time.pngbin0 -> 2949 bytes
-rw-r--r--skins/metrixhd/themes/default/icons/ico_sort_name.pngbin0 -> 2748 bytes
-rw-r--r--skins/metrixhd/themes/default/icons/ico_sort_number.pngbin0 -> 2613 bytes
-rw-r--r--skins/metrixhd/themes/default/icons/ico_sort_provider.pngbin0 -> 3814 bytes
-rw-r--r--skins/metrixhd/themes/default/icons/ico_sort_time.pngbin0 -> 2949 bytes
-rw-r--r--skinskeleton/xmlfiles/displaymenumain.xml10
-rw-r--r--views/displaymenurootview.c3
-rw-r--r--views/displaymenurootview.h2
-rw-r--r--views/displaymenuview.c7
-rw-r--r--views/displaymenuview.h3
-rw-r--r--views/displayviewelements.c5
-rw-r--r--views/displayviewelements.h3
-rw-r--r--views/viewhelpers.c161
-rw-r--r--views/viewhelpers.h4
20 files changed, 173 insertions, 48 deletions
diff --git a/HISTORY b/HISTORY
index b077372..375e574 100644
--- a/HISTORY
+++ b/HISTORY
@@ -251,5 +251,5 @@ Version 0.3.3
- added viewelement <sortmode> in displaymenu to display the sort
mode of the currently displayed menu. <sortmode> can be used in
any list menu, implementation in displaymenu.xml is default
-
-
+- use recording info for <currentschedule> viewelement in main menu
+ if recording is replayed. New token {islivetv} indicates this.
diff --git a/displaymenu.c b/displaymenu.c
index c1c83d5..241503b 100644
--- a/displaymenu.c
+++ b/displaymenu.c
@@ -1,3 +1,4 @@
+#include <vdr/player.h>
#include "displaymenu.h"
#include "libcore/helpers.h"
@@ -19,6 +20,7 @@ cSDDisplayMenu::cSDDisplayMenu(cTemplate *menuTemplate) {
doOutput = false;
return;
}
+ SetCurrentRecording();
}
cSDDisplayMenu::~cSDDisplayMenu() {
@@ -312,3 +314,19 @@ void cSDDisplayMenu::Flush(void) {
}
state = vsIdle;
}
+
+void cSDDisplayMenu::SetCurrentRecording(void) {
+ cControl *control = cControl::Control();
+ if (!control) {
+ return;
+ }
+ const cRecording *recording = control->GetRecording();
+ if (!recording) {
+ return;
+ }
+ string recFileName = "";
+ if (recording->FileName()) {
+ recFileName = recording->FileName();
+ }
+ rootView->SetCurrentRecording(recFileName);
+}
diff --git a/displaymenu.h b/displaymenu.h
index c30ce17..f1edbaa 100644
--- a/displaymenu.h
+++ b/displaymenu.h
@@ -21,6 +21,7 @@ private:
int pluginMenu;
ePluginMenuType pluginMenuType;
mutable cFont *textAreaFont;
+ void SetCurrentRecording(void);
protected:
int Tab(int n);
public:
diff --git a/skins/blackhole/themes/default/icons/ico_sort_name.png b/skins/blackhole/themes/default/icons/ico_sort_name.png
new file mode 100644
index 0000000..bef06d5
--- /dev/null
+++ b/skins/blackhole/themes/default/icons/ico_sort_name.png
Binary files differ
diff --git a/skins/blackhole/themes/default/icons/ico_sort_number.png b/skins/blackhole/themes/default/icons/ico_sort_number.png
new file mode 100644
index 0000000..4084ba5
--- /dev/null
+++ b/skins/blackhole/themes/default/icons/ico_sort_number.png
Binary files differ
diff --git a/skins/blackhole/themes/default/icons/ico_sort_provider.png b/skins/blackhole/themes/default/icons/ico_sort_provider.png
new file mode 100644
index 0000000..fe5cc64
--- /dev/null
+++ b/skins/blackhole/themes/default/icons/ico_sort_provider.png
Binary files differ
diff --git a/skins/blackhole/themes/default/icons/ico_sort_time.png b/skins/blackhole/themes/default/icons/ico_sort_time.png
new file mode 100644
index 0000000..a8f3515
--- /dev/null
+++ b/skins/blackhole/themes/default/icons/ico_sort_time.png
Binary files differ
diff --git a/skins/metrixhd/themes/default/icons/ico_sort_name.png b/skins/metrixhd/themes/default/icons/ico_sort_name.png
new file mode 100644
index 0000000..bef06d5
--- /dev/null
+++ b/skins/metrixhd/themes/default/icons/ico_sort_name.png
Binary files differ
diff --git a/skins/metrixhd/themes/default/icons/ico_sort_number.png b/skins/metrixhd/themes/default/icons/ico_sort_number.png
new file mode 100644
index 0000000..4084ba5
--- /dev/null
+++ b/skins/metrixhd/themes/default/icons/ico_sort_number.png
Binary files differ
diff --git a/skins/metrixhd/themes/default/icons/ico_sort_provider.png b/skins/metrixhd/themes/default/icons/ico_sort_provider.png
new file mode 100644
index 0000000..fe5cc64
--- /dev/null
+++ b/skins/metrixhd/themes/default/icons/ico_sort_provider.png
Binary files differ
diff --git a/skins/metrixhd/themes/default/icons/ico_sort_time.png b/skins/metrixhd/themes/default/icons/ico_sort_time.png
new file mode 100644
index 0000000..a8f3515
--- /dev/null
+++ b/skins/metrixhd/themes/default/icons/ico_sort_time.png
Binary files differ
diff --git a/skinskeleton/xmlfiles/displaymenumain.xml b/skinskeleton/xmlfiles/displaymenumain.xml
index 61816bb..13af71f 100644
--- a/skinskeleton/xmlfiles/displaymenumain.xml
+++ b/skinskeleton/xmlfiles/displaymenumain.xml
@@ -88,15 +88,17 @@
</temperatures>
<!-- Available Variables currentschedule:
+ if a recording is displayed, info of this recording is used
+ {islivetv} true if info is from livetv, false if recording is displayed
{title} Title of the current Schedule
{subtitle} Subtitle of the current Schedule
- {start} Start of current Schedule in hh:mm
- {stop} End of current Schedule in hh:mm
+ {start} Start of current Schedule in hh:mm (empty for recordings)
+ {stop} End of current Schedule in hh:mm (empty for recordings)
{duration} Duration of current Schedule in min
{durationhours} Duration, full hours
{minutes} Duration, rest of minutes
- {elapsed} Elapsed time of current Schedule in min
- {remaining} Remaining time of current Schedule in min
+ {elapsed} Elapsed time of current Schedule in min (0 for recordings)
+ {remaining} Remaining time of current Schedule in min (0 for recordings)
{hasPoster} true if poster is available
{posterpath} Full Path of Poster to use in image path attribute
{posterwidth} width of poster in pixel
diff --git a/views/displaymenurootview.c b/views/displaymenurootview.c
index 3455d09..3a5ee90 100644
--- a/views/displaymenurootview.c
+++ b/views/displaymenurootview.c
@@ -10,6 +10,7 @@ cDisplayMenuRootView::cDisplayMenuRootView(cTemplateView *rootView) : cView(root
sortMode = msmUnknown;
sortModeLast = msmUnknown;
menuTitle = "";
+ currentRecording = "";
viewType = svUndefined;
subView = NULL;
subViewAvailable = false;
@@ -186,7 +187,7 @@ void cDisplayMenuRootView::SetMenu(eMenuCategory menuCat, bool menuInit) {
//Create new View
switch (newViewType) {
case svMenuMain:
- view = new cDisplayMenuMainView(subView, menuInit);
+ view = new cDisplayMenuMainView(subView, menuInit, currentRecording);
break;
case svMenuSchedules:
if (subViewAvailable)
diff --git a/views/displaymenurootview.h b/views/displaymenurootview.h
index f636d90..3ec009f 100644
--- a/views/displaymenurootview.h
+++ b/views/displaymenurootview.h
@@ -27,6 +27,7 @@ private:
cDisplayMenuView *view;
cDisplayMenuListView *listView;
cDisplayMenuDetailView *detailView;
+ string currentRecording;
string menuTitle;
string buttonTexts[4];
bool defaultBackgroundDrawn;
@@ -50,6 +51,7 @@ public:
bool createOsd(void);
void SetMenu(eMenuCategory menuCat, bool menuInit);
void SetSortMode(eMenuSortMode sortMode);
+ void SetCurrentRecording(string rec) { currentRecording = rec; };
void CorrectDefaultMenu(void);
void SetPluginMenu(string name, int menu, int type);
void SetTitle(const char *title);
diff --git a/views/displaymenuview.c b/views/displaymenuview.c
index 88192fa..31b691a 100644
--- a/views/displaymenuview.c
+++ b/views/displaymenuview.c
@@ -227,7 +227,8 @@ void cDisplayMenuView::Action(void) {
* cDisplayMenuMainView
************************************************************************/
-cDisplayMenuMainView::cDisplayMenuMainView(cTemplateView *tmplView, bool menuInit) : cDisplayMenuView(tmplView, menuInit) {
+cDisplayMenuMainView::cDisplayMenuMainView(cTemplateView *tmplView, bool menuInit, string currentRecording) : cDisplayMenuView(tmplView, menuInit) {
+ this->currentRecording = currentRecording;
initial = true;
InitDevices();
}
@@ -458,7 +459,7 @@ void cDisplayMenuMainView::DrawCurrentSchedule(void) {
if (DetachViewElement(veCurrentSchedule)) {
cViewElement *viewElement = GetViewElement(veCurrentSchedule);
if (!viewElement) {
- viewElement = new cViewElementCurrentSchedule(tmplView->GetViewElement(veCurrentSchedule));
+ viewElement = new cViewElementCurrentSchedule(tmplView->GetViewElement(veCurrentSchedule), currentRecording);
AddViewElement(veCurrentSchedule, viewElement);
viewElement->Start();
} else {
@@ -468,7 +469,7 @@ void cDisplayMenuMainView::DrawCurrentSchedule(void) {
} else {
map < string, string > stringTokens;
map < string, int > intTokens;
- SetCurrentSchedule(stringTokens, intTokens);
+ SetCurrentSchedule(currentRecording, stringTokens, intTokens);
ClearViewElement(veCurrentSchedule);
DrawViewElement(veCurrentSchedule, &stringTokens, &intTokens);
}
diff --git a/views/displaymenuview.h b/views/displaymenuview.h
index e75973b..d0d4b44 100644
--- a/views/displaymenuview.h
+++ b/views/displaymenuview.h
@@ -51,6 +51,7 @@ public:
class cDisplayMenuMainView : public cDisplayMenuView {
private:
bool initial;
+ string currentRecording;
void DrawTimers(void);
void DrawLastRecordings(void);
void DrawDiscUsage(void);
@@ -62,7 +63,7 @@ private:
void DrawCurrentWeather(void);
void DrawCustomTokens(void);
public:
- cDisplayMenuMainView(cTemplateView *tmplView, bool menuInit);
+ cDisplayMenuMainView(cTemplateView *tmplView, bool menuInit, string currentRecording);
virtual ~cDisplayMenuMainView();
void DrawStaticViewElements(void);
bool DrawDynamicViewElements(void);
diff --git a/views/displayviewelements.c b/views/displayviewelements.c
index 8f2b476..73b4b3b 100644
--- a/views/displayviewelements.c
+++ b/views/displayviewelements.c
@@ -212,12 +212,13 @@ bool cViewElementTemperature::Render(void) {
/********************************************************************************************************************/
-cViewElementCurrentSchedule::cViewElementCurrentSchedule(cTemplateViewElement *tmplViewElement) : cViewElement(tmplViewElement) {
+cViewElementCurrentSchedule::cViewElementCurrentSchedule(cTemplateViewElement *tmplViewElement, string currentRecording) : cViewElement(tmplViewElement) {
+ this->currentRecording = currentRecording;
}
bool cViewElementCurrentSchedule::Render(void) {
ClearTokens();
- SetCurrentSchedule(stringTokens, intTokens);
+ SetCurrentSchedule(currentRecording, stringTokens, intTokens);
ClearViewElement(veCurrentSchedule);
DrawViewElement(veCurrentSchedule, &stringTokens, &intTokens);
return true;
diff --git a/views/displayviewelements.h b/views/displayviewelements.h
index 5ccf2d9..500be9e 100644
--- a/views/displayviewelements.h
+++ b/views/displayviewelements.h
@@ -120,8 +120,9 @@ public:
class cViewElementCurrentSchedule : public cViewElement, public cViewHelpers {
private:
+ string currentRecording;
public:
- cViewElementCurrentSchedule(cTemplateViewElement *tmplViewElement);
+ cViewElementCurrentSchedule(cTemplateViewElement *tmplViewElement, string currentRecording);
virtual ~cViewElementCurrentSchedule() {};
bool Render(void);
};
diff --git a/views/viewhelpers.c b/views/viewhelpers.c
index a41c71c..9ad437b 100644
--- a/views/viewhelpers.c
+++ b/views/viewhelpers.c
@@ -801,15 +801,62 @@ bool cViewHelpers::SetSystemTemperatures(map < string, string > &stringTokens, m
return true;
}
-void cViewHelpers::SetCurrentSchedule(map < string, string > &stringTokens, map < string, int > &intTokens) {
+void cViewHelpers::SetCurrentSchedule(string recName, map < string, string > &stringTokens, map < string, int > &intTokens) {
cDevice *device = cDevice::PrimaryDevice();
const cChannel *channel = NULL;
if (!device->Replaying() || device->Transferring()) {
channel = Channels.GetByNumber(device->CurrentChannel());
}
- if (!channel)
+ if (channel) {
+ SetCurrentScheduleFromChannel(channel, stringTokens, intTokens);
+ } else {
+ if (recName.size() == 0)
+ return;
+ const cRecording *recording = new cRecording(recName.c_str());
+ if (recording) {
+ SetCurrentScheduleFromRecording(recording, stringTokens, intTokens);
+ delete recording;
+ }
+ }
+}
+
+void cViewHelpers::RecName(string &path, string &name, string &folder) {
+ size_t delim = path.find_last_of('~');
+ if (delim == string::npos) {
+ name = path;
+ if (name.find('%') == 0) {
+ name = name.substr(1);
+ }
+ return;
+ }
+ name = path.substr(delim+1);
+ if (name.find('%') == 0) {
+ name = name.substr(1);
+ }
+ folder = path.substr(0, delim);
+ size_t delim2 = folder.find_last_of('~');
+ if (delim2 == string::npos) {
return;
+ }
+ folder = folder.substr(delim2+1);
+}
+void cViewHelpers::RecPoster(const cRecording *rec, int &posterWidth, int &posterHeight, string &path, bool &hasPoster) {
+ static cPlugin *pScraper = GetScraperPlugin();
+ if (!pScraper)
+ return;
+ ScraperGetPoster callPoster;
+ callPoster.event = NULL;
+ callPoster.recording = rec;
+ if (pScraper->Service("GetPoster", &callPoster)) {
+ posterWidth = callPoster.poster.width;
+ posterHeight = callPoster.poster.height;
+ path = callPoster.poster.path;
+ hasPoster = true;
+ }
+}
+
+void cViewHelpers::SetCurrentScheduleFromChannel(const cChannel *channel, map < string, string > &stringTokens, map < string, int > &intTokens) {
const cEvent *event = NULL;
cSchedulesLock SchedulesLock;
if (const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock))
@@ -818,6 +865,7 @@ void cViewHelpers::SetCurrentSchedule(map < string, string > &stringTokens, map
if (!event)
return;
+ intTokens.insert(pair<string,int>("islivetv", 1));
stringTokens.insert(pair<string,string>("title", (event->Title())?event->Title():""));
stringTokens.insert(pair<string,string>("subtitle", (event->ShortText())?event->ShortText():""));
stringTokens.insert(pair<string,string>("start", *event->GetTimeString()));
@@ -888,39 +936,86 @@ void cViewHelpers::SetCurrentSchedule(map < string, string > &stringTokens, map
intTokens.insert(pair<string,int>("hasbanner", hasBanner));
}
-void cViewHelpers::RecName(string &path, string &name, string &folder) {
- size_t delim = path.find_last_of('~');
- if (delim == string::npos) {
- name = path;
- if (name.find('%') == 0) {
- name = name.substr(1);
- }
- return;
- }
- name = path.substr(delim+1);
- if (name.find('%') == 0) {
- name = name.substr(1);
- }
- folder = path.substr(0, delim);
- size_t delim2 = folder.find_last_of('~');
- if (delim2 == string::npos) {
- return;
+void cViewHelpers::SetCurrentScheduleFromRecording(const cRecording *recording, map < string, string > &stringTokens, map < string, int > &intTokens) {
+ intTokens.insert(pair<string,int>("islivetv", 0));
+
+ string recFullName = recording->Name() ? recording->Name() : "";
+ string recName = "";
+ string recFolder = "";
+ RecName(recFullName, recName, recFolder);
+
+ stringTokens.insert(pair<string,string>("title", recName));
+ const cRecordingInfo *info = recording->Info();
+ if (info) {
+ stringTokens.insert(pair<string,string>("subtitle", info->ShortText() ? info->ShortText() : ""));
+ } else {
+ stringTokens.insert(pair<string,string>("subtitle", recFolder));
}
- folder = folder.substr(delim2+1);
-}
+ stringTokens.insert(pair<string,string>("start", ""));
+ stringTokens.insert(pair<string,string>("stop", ""));
+ intTokens.insert(pair<string,int>("duration", recording->LengthInSeconds() / 60));
+ intTokens.insert(pair<string,int>("durationhours", recording->LengthInSeconds() / 3600));
+ stringTokens.insert(pair<string,string>("durationminutes", *cString::sprintf("%.2d", (recording->LengthInSeconds() / 60)%60)));
+ intTokens.insert(pair<string,int>("elapsed", 0));
+ intTokens.insert(pair<string,int>("remaining", 0));
-void cViewHelpers::RecPoster(const cRecording *rec, int &posterWidth, int &posterHeight, string &path, bool &hasPoster) {
+ int mediaWidth = 0;
+ int mediaHeight = 0;
+ string mediaPath = "";
+ bool isBanner = false;
+ int posterWidth = 0;
+ int posterHeight = 0;
+ string posterPath = "";
+ bool hasPoster = false;
+ int bannerWidth = 0;
+ int bannerHeight = 0;
+ string bannerPath = "";
+ bool hasBanner = false;
static cPlugin *pScraper = GetScraperPlugin();
- if (!pScraper)
- return;
- ScraperGetPoster callPoster;
- callPoster.event = NULL;
- callPoster.recording = rec;
- if (pScraper->Service("GetPoster", &callPoster)) {
- posterWidth = callPoster.poster.width;
- posterHeight = callPoster.poster.height;
- path = callPoster.poster.path;
- hasPoster = true;
+ if (pScraper) {
+ ScraperGetPosterBannerV2 call;
+ call.event = NULL;
+ call.recording = recording;
+ if (pScraper->Service("GetPosterBannerV2", &call)) {
+ if ((call.type == tSeries) && call.banner.path.size() > 0) {
+ mediaWidth = call.banner.width;
+ mediaHeight = call.banner.height;
+ mediaPath = call.banner.path;
+ isBanner = true;
+ bannerWidth = mediaWidth;
+ bannerHeight = mediaHeight;
+ bannerPath = mediaPath;
+ hasBanner = true;
+ ScraperGetPoster callPoster;
+ callPoster.event = NULL;
+ callPoster.recording = recording;
+ if (pScraper->Service("GetPoster", &callPoster)) {
+ posterWidth = callPoster.poster.width;
+ posterHeight = callPoster.poster.height;
+ posterPath = callPoster.poster.path;
+ hasPoster = true;
+ }
+ } else if (call.type == tMovie && call.poster.path.size() > 0 && call.poster.height > 0) {
+ mediaWidth = call.poster.width;
+ mediaHeight = call.poster.height;
+ mediaPath = call.poster.path;
+ posterWidth = call.poster.width;
+ posterHeight = call.poster.height;
+ posterPath = call.poster.path;
+ hasPoster = true;
+ }
+ }
}
+ intTokens.insert(pair<string,int>("mediawidth", mediaWidth));
+ intTokens.insert(pair<string,int>("mediaheight", mediaHeight));
+ intTokens.insert(pair<string,int>("isbanner", isBanner));
+ stringTokens.insert(pair<string,string>("mediapath", mediaPath));
+ intTokens.insert(pair<string,int>("posterwidth", posterWidth));
+ intTokens.insert(pair<string,int>("posterheight", posterHeight));
+ stringTokens.insert(pair<string,string>("posterpath", posterPath));
+ intTokens.insert(pair<string,int>("hasposter", hasPoster));
+ intTokens.insert(pair<string,int>("bannerwidth", bannerWidth));
+ intTokens.insert(pair<string,int>("bannerheight", bannerHeight));
+ stringTokens.insert(pair<string,string>("bannerpath", bannerPath));
+ intTokens.insert(pair<string,int>("hasbanner", hasBanner));
}
-
diff --git a/views/viewhelpers.h b/views/viewhelpers.h
index 1223a78..3e8fb1d 100644
--- a/views/viewhelpers.h
+++ b/views/viewhelpers.h
@@ -17,6 +17,8 @@ private:
int lastMemUsage;
void RecName(string &path, string &name, string &folder);
void RecPoster(const cRecording *rec, int &posterWidth, int &posterHeight, string &path, bool &hasPoster);
+ void SetCurrentScheduleFromChannel(const cChannel *channel, map < string, string > &stringTokens, map < string, int > &intTokens);
+ void SetCurrentScheduleFromRecording(const cRecording *recording, map < string, string > &stringTokens, map < string, int > &intTokens);
protected:
void InitDevices(void);
bool SetDevices(bool initial, map<string,int> *intTokens, vector<map<string,string> > *devices);
@@ -34,7 +36,7 @@ protected:
bool SetSystemLoad(map < string, string > &stringTokens, map < string, int > &intTokens);
bool SetSystemMemory(map < string, string > &stringTokens, map < string, int > &intTokens);
bool SetSystemTemperatures(map < string, string > &stringTokens, map < string, int > &intTokens);
- void SetCurrentSchedule(map < string, string > &stringTokens, map < string, int > &intTokens);
+ void SetCurrentSchedule(string recName, map < string, string > &stringTokens, map < string, int > &intTokens);
public:
cViewHelpers(void);
virtual ~cViewHelpers(void);