diff options
author | chriszero <zerov83@gmail.com> | 2015-04-28 19:17:08 +0200 |
---|---|---|
committer | chriszero <zerov83@gmail.com> | 2015-04-28 19:17:08 +0200 |
commit | 70a2f36b1b8abb3bdf5df019c3bef34189d728eb (patch) | |
tree | 93cbb861159a6631311af3bcdce04a04d77b9a9b | |
parent | 294f38d18ac39463137b60a5d272105f8da4fb21 (diff) | |
download | vdr-plugin-plex-70a2f36b1b8abb3bdf5df019c3bef34189d728eb.tar.gz vdr-plugin-plex-70a2f36b1b8abb3bdf5df019c3bef34189d728eb.tar.bz2 |
Added watch tokens, updated description about availiable tokens in template
-rw-r--r-- | browserGrid.cpp | 39 | ||||
-rw-r--r-- | browserGrid.h | 3 | ||||
-rw-r--r-- | plex.cpp | 1 | ||||
-rw-r--r-- | plexSdOsd.cpp | 4 | ||||
-rw-r--r-- | plexSdOsd.h | 3 | ||||
-rw-r--r-- | skins/blackhole/xmlfiles/plug-plex-root.xml | 48 | ||||
-rw-r--r-- | templates/plug-plex-root.xml | 125 |
7 files changed, 214 insertions, 9 deletions
diff --git a/browserGrid.cpp b/browserGrid.cpp index 81451f7..e181350 100644 --- a/browserGrid.cpp +++ b/browserGrid.cpp @@ -12,6 +12,8 @@ cBrowserGrid::cBrowserGrid(skindesignerapi::cOsdView* rootView) : cViewGridNavig m_pViewHeader = std::shared_ptr<cViewHeader>( new cViewHeader(rootView->GetViewElement(eViewElementsRoot::verHeader))); m_pfooter = std::shared_ptr<skindesignerapi::cViewElement>(rootView->GetViewElement(eViewElementsRoot::verFooter)); m_pInfopane = std::shared_ptr<skindesignerapi::cViewElement>(rootView->GetViewElement(eViewElementsRoot::verInfopane)); + m_pWatch = std::shared_ptr<skindesignerapi::cViewElement>(rootView->GetViewElement(eViewElementsRoot::verWatch)); + m_lastsecond = 0; m_rows = Config::GetInstance().GridRows; m_columns = Config::GetInstance().GridColumns; @@ -248,6 +250,43 @@ void cBrowserGrid::PrevTab() SwitchGrid(m_pViewHeader->PrevTab()); } +bool cBrowserGrid::DrawTime() { + time_t t = time(0); // get time now + struct tm * now = localtime(&t); + int sec = now->tm_sec; + if (sec == m_lastsecond) + return false; + + int min = now->tm_min; + int hour = now->tm_hour; + int hourMinutes = hour%12 * 5 + min / 12; + + char monthname[20]; + char monthshort[10]; + strftime(monthshort, sizeof(monthshort), "%b", now); + strftime(monthname, sizeof(monthname), "%B", now); + + m_pWatch->Clear(); + m_pWatch->ClearTokens(); + m_pWatch->AddIntToken("sec", sec); + m_pWatch->AddIntToken("min", min); + m_pWatch->AddIntToken("hour", hour); + m_pWatch->AddIntToken("hmins", hourMinutes); + m_pWatch->AddIntToken("year", now->tm_year + 1900); + m_pWatch->AddIntToken("day", now->tm_mday); + m_pWatch->AddStringToken("time", *TimeString(t)); + m_pWatch->AddStringToken("monthname", monthname); + m_pWatch->AddStringToken("monthnameshort", monthshort); + m_pWatch->AddStringToken("month", *cString::sprintf("%02d", now->tm_mon + 1)); + m_pWatch->AddStringToken("dayleadingzero", *cString::sprintf("%02d", now->tm_mday)); + m_pWatch->AddStringToken("dayname", *WeekDayNameFull(now->tm_wday)); + m_pWatch->AddStringToken("daynameshort", *WeekDayName(now->tm_wday)); + m_pWatch->Display(); + + m_lastsecond = sec; + return true; +} + /* * cDummyElement */ diff --git a/browserGrid.h b/browserGrid.h index c1cf194..339bdc4 100644 --- a/browserGrid.h +++ b/browserGrid.h @@ -40,6 +40,8 @@ private: std::shared_ptr<skindesignerapi::cViewElement> m_pfooter; std::shared_ptr<skindesignerapi::cViewElement> m_pInfopane; std::shared_ptr<skindesignerapi::cViewElement> m_pScrollbar; + std::shared_ptr<skindesignerapi::cViewElement> m_pWatch; + int m_lastsecond; bool m_bServersAreRoot; std::vector<cServerElement> m_vServerElements; @@ -65,6 +67,7 @@ public: virtual eOSState NavigateBack(); void NextTab(); void PrevTab(); + bool DrawTime(); virtual void Flush(); }; @@ -68,6 +68,7 @@ bool cMyPlugin::Start(void) reg.SetViewElement(viRootView, verBackground, "background"); reg.SetViewElement(viRootView, verInfopane, "infopane"); reg.SetViewElement(viRootView, verFooter, "footer"); + reg.SetViewElement(viRootView, verWatch, "time"); /* reg.SetSubView(viRootView, viDetailView, "detail.xml"); reg.SetViewElement(viDetailView, vedBackground, "background"); diff --git a/plexSdOsd.cpp b/plexSdOsd.cpp index cfa6a7e..27f841f 100644 --- a/plexSdOsd.cpp +++ b/plexSdOsd.cpp @@ -57,6 +57,10 @@ eOSState cPlexSdOsd::ProcessKey(eKeys Key) { eOSState state = eOSState::osContinue; plexclient::Video* vid = dynamic_cast<plexclient::Video*>(m_pBrowserGrid->SelectedObject()); + + if (m_pBrowserGrid->DrawTime()) + m_pBrowserGrid->Flush(); + switch (Key & ~k_Repeat) { case kUp: m_pBrowserGrid->NavigateUp(); diff --git a/plexSdOsd.h b/plexSdOsd.h index f87676e..585e7e2 100644 --- a/plexSdOsd.h +++ b/plexSdOsd.h @@ -29,7 +29,8 @@ enum eViewElementsRoot { verBackground, verHeader, verFooter, - verInfopane + verInfopane, + verWatch }; enum eViewGrids { diff --git a/skins/blackhole/xmlfiles/plug-plex-root.xml b/skins/blackhole/xmlfiles/plug-plex-root.xml index 37ff442..50e302c 100644 --- a/skins/blackhole/xmlfiles/plug-plex-root.xml +++ b/skins/blackhole/xmlfiles/plug-plex-root.xml @@ -2,6 +2,25 @@ <!DOCTYPE displayplugin SYSTEM "../../../dtd/displayplugin.dtd"> <displayplugin x="0" y="0" width="100%" height="100%" fadetime="0" scaletvx="0" scaletvy="0" scaletvwidth="100%" scaletvheight="100%"> + <!-- Available Variables time: + {time} timestring in hh:mm + {sec} current seconds + {min} current minutes + {hour} current hours + {hmins} current "hourminutes" to display an hour hand + {day} day in digits + {dayleadingzero} day in digits with leading 0 + {dayname} Full name of the day + {daynameshort} Short 3 char name of the day + {month} month in digits with leading 0 + {monthname} Full name of the month + {monthnameshort} 3 letter abbrivation of month name + {year} year in yyyy + --> + <viewelement name="time"> + + </viewelement> + <!-- Tokens available in background {selecteditembackground} image @@ -53,28 +72,41 @@ Following tokens are avaliable if the item is a directory or video - {hasthumb} bool - {thumb} string, Image/Cover - {hasart} bool - {art} string, Fanart - + {hasthumb} bool + {thumb} string, Image/Cover + {hasart} bool + {art} string, Fanart + If the Item is Directory following tokens are avaliable The item is a directory if one of the following tokens are set: {isdirectory}, {isshow}, {isseason} {isdirectory} Condition - {isshow} Condition + + {isshow} Condition, Show/Series + {summary} Description, plot, summary + {isseason} Condition + {summary} Description, plot, summary If the item is a video following tokens are avaliable The item is a video if one of the following tokens are set: {ismovie}, {isepisode} {contentrating} string, star-rating {viewoffset} int, minutes, last viewed position {duration} int, minutes, total duration + {orginaltitle} original title + {summary} Description, plot, summary + {studio} Studio + {year} Year of production {ismovie} {isepisode} - {hasbanner} - {banner} + {seriestitle} Title of the series/show + {season} int, Season + {episode} int, Episode, season based + {hasbanner} bool, Bannerstyle? + {banner} Image path + {hasseriesthumb} bool, seriesthumb (seasoncover, seriescover) + {seriesthumb} Image path --> diff --git a/templates/plug-plex-root.xml b/templates/plug-plex-root.xml new file mode 100644 index 0000000..ba7cd16 --- /dev/null +++ b/templates/plug-plex-root.xml @@ -0,0 +1,125 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE displayplugin SYSTEM "../../../dtd/displayplugin.dtd"> + +<displayplugin x="0" y="0" width="100%" height="100%" fadetime="0" scaletvx="0" scaletvy="0" scaletvwidth="100%" scaletvheight="100%"> + <!-- Available Variables time: + {time} timestring in hh:mm + {sec} current seconds + {min} current minutes + {hour} current hours + {hmins} current "hourminutes" to display an hour hand + {day} day in digits + {dayleadingzero} day in digits with leading 0 + {dayname} Full name of the day + {daynameshort} Short 3 char name of the day + {month} month in digits with leading 0 + {monthname} Full name of the month + {monthnameshort} 3 letter abbrivation of month name + {year} year in yyyy + --> + <viewelement name="time"> + </viewelement> + + <!-- Tokens available in background + {selecteditembackground} image + + {isdirectory} + {currentdirectorybackground} image + --> + <viewelement name="background"> + </viewelement> + + <!-- Tokens available in header and infopane + Same as in browser + --> + <viewelement name="header"> + </viewelement> + + <viewelement name="infopane"> + </viewelement> + + <!-- Tokens available in browser + {current} bool, currently active element + {title} string, Name of the element + {viewgroup} int: {UNDEF = 0, MOVIE = 1, SHOW = 2, SEASON = 3, EPISODE = 4, MUSIC, PHOTO}; + + A dummy actually only marks a "level up" + {isdummy} bool + + If the item is a server: {isserver} + {isserver} bool + {serverstartpointname} string + {serverip} string + {serverport} int + {serverversion} string + + + Following tokens are avaliable if the item is a directory or video + {hasthumb} bool + {thumb} string, Image/Cover + {hasart} bool + {art} string, Fanart + + If the Item is Directory following tokens are avaliable + The item is a directory if one of the following tokens are set: {isdirectory}, {isshow}, {isseason} + + {isdirectory} Condition + + {isshow} Condition, Show/Series + {summary} Description, plot, summary + + {isseason} Condition + {summary} Description, plot, summary + + If the item is a video following tokens are avaliable + The item is a video if one of the following tokens are set: {ismovie}, {isepisode} + {contentrating} string, star-rating + {viewoffset} int, minutes, last viewed position + {duration} int, minutes, total duration + {orginaltitle} original title + {summary} Description, plot, summary + {studio} Studio + {year} Year of production + + {ismovie} + {isepisode} + {seriestitle} Title of the series/show + {season} int, Season + {episode} int, Episode, season based + {hasbanner} bool, Bannerstyle? + {banner} Image path + {hasseriesthumb} bool, seriesthumb (seasoncover, seriescover) + {seriesthumb} Image path + + --> + + <grid name="browser"> + </grid> + + + <!-- Available Variables Footer: + {red1} true if red button is button 1 + {red2} true if red button is button 2 + {red3} true if red button is button 3 + {red4} true if red button is button 4 + {green1} true if green button is button 1 + {green2} true if green button is button 2 + {green3} true if green button is button 3 + {green4} true if green button is button 4 + {yellow1} true if yellow button is button 1 + {yellow2} true if yellow button is button 2 + {yellow3} true if yellow button is button 3 + {yellow4} true if yellow button is button 4 + {blue1} true if blue button is button 1 + {blue2} true if blue button is button 2 + {blue3} true if blue button is button 3 + {blue4} true if blue button is button 4 + {red} label of red button + {green} label of green button + {yellow} label of yellow button + {blue} label of blue button + --> + <viewelement name="footer"> + </viewelement> + +</displayplugin> |