summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchriszero <zerov83@gmail.com>2015-04-12 20:22:34 +0200
committerchriszero <zerov83@gmail.com>2015-04-12 20:22:34 +0200
commit294f38d18ac39463137b60a5d272105f8da4fb21 (patch)
tree19615fad187c8e36fb464566e81f0db378be45e4
parent18194b793d6542340080b27d72f0b66e656ae7bf (diff)
downloadvdr-plugin-plex-294f38d18ac39463137b60a5d272105f8da4fb21.tar.gz
vdr-plugin-plex-294f38d18ac39463137b60a5d272105f8da4fb21.tar.bz2
More tokens
-rw-r--r--Config.cpp2
-rw-r--r--Directory.cpp8
-rw-r--r--MediaContainer.cpp3
-rw-r--r--MediaContainer.h2
-rw-r--r--PVideo.cpp23
-rw-r--r--XmlObject.h2
-rw-r--r--browserGrid.cpp3
-rw-r--r--plexSdOsd.cpp8
-rw-r--r--skins/blackhole/xmlfiles/plug-plex-root.xml103
9 files changed, 76 insertions, 78 deletions
diff --git a/Config.cpp b/Config.cpp
index 6b37efb..392b895 100644
--- a/Config.cpp
+++ b/Config.cpp
@@ -4,7 +4,7 @@
Config::Config() {
s_username = "username";
s_password = "password";
- GridColumns = 5;
+ GridColumns = 7;
GridRows = 2;
}
diff --git a/Directory.cpp b/Directory.cpp
index 57853a4..e09e86d 100644
--- a/Directory.cpp
+++ b/Directory.cpp
@@ -53,6 +53,7 @@ void Directory::AddTokens(std::shared_ptr<skindesignerapi::cOsdElement> grid, bo
{
if(clear) grid->ClearTokens();
grid->AddStringToken("title", m_sTitle);
+ grid->AddIntToken("viewgroup", m_pParent->m_eViewGroup);
// Thumb, Cover, Episodepicture
bool cached = false;
@@ -70,6 +71,10 @@ void Directory::AddTokens(std::shared_ptr<skindesignerapi::cOsdElement> grid, bo
}
grid->AddIntToken("hasart", cached);
+ if(m_eType == MediaType::UNDEF || m_eType == MediaType::MOVIE || m_eType == MediaType::PHOTO) {
+ grid->AddIntToken("isdirectory", true);
+ }
+
if(m_eType == MediaType::SHOW) {
grid->AddIntToken("isshow", true);
grid->AddStringToken("summary", m_sSummary);
@@ -78,6 +83,7 @@ void Directory::AddTokens(std::shared_ptr<skindesignerapi::cOsdElement> grid, bo
if(m_eType == MediaType::SEASON) {
grid->AddIntToken("isseason", true);
if(m_pParent) grid->AddStringToken("summary", m_pParent->m_sSummary);
+ grid->AddIntToken("season", m_iIndex);
}
// Banner, Seriesbanner
@@ -85,7 +91,7 @@ void Directory::AddTokens(std::shared_ptr<skindesignerapi::cOsdElement> grid, bo
cached = false;
std::string banner = cPictureCache::GetInstance().GetPath(m_pServer->GetUri() + m_pParent->m_sBanner, Config::GetInstance().BannerWidth(), Config::GetInstance().BannerHeight(), cached, OnCached, this);
if(cached) {
- grid->AddIntToken("hasbanner", true);
+ grid->AddIntToken("hasbanner", cached);
grid->AddStringToken("banner", banner);
}
}
diff --git a/MediaContainer.cpp b/MediaContainer.cpp
index 8f68300..e676c8d 100644
--- a/MediaContainer.cpp
+++ b/MediaContainer.cpp
@@ -6,6 +6,7 @@ namespace plexclient
MediaContainer::MediaContainer(std::istream* response, PlexServer* Server)
{
m_pServer = Server;
+ m_eViewGroup = MediaType::UNDEF;
try {
InputSource src(*response);
DOMParser parser;
@@ -24,7 +25,7 @@ MediaContainer::MediaContainer(std::istream* response, PlexServer* Server)
m_iParentIndex = GetNodeValueAsInt(pAttribs->getNamedItem("parentIndex"));
m_sThumb = GetNodeValue(pAttribs->getNamedItem("thumb"));
m_sBanner = GetNodeValue(pAttribs->getNamedItem("banner"));
- m_sViewGroup = GetNodeValue(pAttribs->getNamedItem("viewGroup"));
+ m_eViewGroup = GetNodeValueAsMediaType(pAttribs->getNamedItem("viewGroup"));
m_sLibrarySectionTitle = GetNodeValue(pAttribs->getNamedItem("librarySectionTitle"));
m_sLibrarySectionUUID = GetNodeValue(pAttribs->getNamedItem("librarySectionUUID"));
m_iLibrarySectionID = GetNodeValueAsInt(pAttribs->getNamedItem("librarySectionID"));
diff --git a/MediaContainer.h b/MediaContainer.h
index 14fb29e..947a647 100644
--- a/MediaContainer.h
+++ b/MediaContainer.h
@@ -54,7 +54,7 @@ public:
std::string m_sTitle1;
std::string m_sTitle2;
std::string m_sGrandparentTitle;
- std::string m_sViewGroup;
+ MediaType m_eViewGroup;
int m_iLibrarySectionID;
std::string m_sLibrarySectionTitle;
std::string m_sLibrarySectionUUID;
diff --git a/PVideo.cpp b/PVideo.cpp
index 1c1e28f..aaf0547 100644
--- a/PVideo.cpp
+++ b/PVideo.cpp
@@ -217,16 +217,17 @@ void Video::AddTokens(std::shared_ptr<skindesignerapi::cOsdElement> grid, bool c
grid->AddStringToken("summary", m_sSummary);
grid->AddStringToken("contentrating", m_sContentRating);
grid->AddStringToken("studio", m_sStudio);
- grid->AddIntToken("viewoffset", m_lViewoffset/1000);
- grid->AddIntToken("duration", m_iDuration);
+ grid->AddIntToken("viewoffset", m_lViewoffset/1000/60);
+ grid->AddIntToken("duration", m_iDuration/1000/60);
grid->AddIntToken("year", m_iYear);
-
+ grid->AddIntToken("viewgroup", m_pParent->m_eViewGroup);
+
// Thumb, Cover, Episodepicture
bool cached = false;
std::string thumb = cPictureCache::GetInstance().GetPath(ThumbUri(), Config::GetInstance().ThumbWidth(), Config::GetInstance().ThumbHeight(), cached, OnCached, this);
grid->AddIntToken("hasthumb", cached);
if (cached) grid->AddStringToken("thumb", thumb);
-
+
// Fanart
cached = false;
std::string art = cPictureCache::GetInstance().GetPath(ArtUri(), Config::GetInstance().ArtWidth(), Config::GetInstance().ArtHeight(), cached);
@@ -244,19 +245,25 @@ void Video::AddTokens(std::shared_ptr<skindesignerapi::cOsdElement> grid, bool c
grid->AddStringToken("seriestitle", seriesTitle);
grid->AddIntToken("season", m_iParentIndex);
grid->AddIntToken("episode", m_iIndex);
-
+
// Seriescover, Seasoncover
cached = false;
- std::string grandparentThumb = cPictureCache::GetInstance().GetPath(m_pServer->GetUri() + m_sGrandparentThumb, Config::GetInstance().ThumbWidth(), Config::GetInstance().ThumbHeight(), cached, OnCached, this);
+ std::string grandparentthumbUri = m_sGrandparentThumb;
+ if(grandparentthumbUri.empty() && m_pParent) {
+ grandparentthumbUri = m_sThumb;
+ }
+ if(!grandparentthumbUri.empty()) {
+ std::string grandparentThumb = cPictureCache::GetInstance().GetPath(m_pServer->GetUri() + grandparentthumbUri, Config::GetInstance().ThumbWidth(), Config::GetInstance().ThumbHeight(), cached, OnCached, this);
+ if (cached) grid->AddStringToken("seriesthumb", grandparentThumb);
+ }
grid->AddIntToken("hasseriesthumb", cached);
- if (cached) grid->AddStringToken("seriesthumb", grandparentThumb);
// Banner, Seriesbanner
if(m_pParent && !m_pParent->m_sBanner.empty()) {
cached = false;
std::string banner = cPictureCache::GetInstance().GetPath(m_pServer->GetUri() + m_pParent->m_sBanner, Config::GetInstance().BannerWidth(), Config::GetInstance().BannerHeight(), cached, OnCached, this);
if(cached) {
- grid->AddIntToken("hasbanner", true);
+ grid->AddIntToken("hasbanner", cached);
grid->AddStringToken("banner", banner);
}
}
diff --git a/XmlObject.h b/XmlObject.h
index 22626b4..a3fee9a 100644
--- a/XmlObject.h
+++ b/XmlObject.h
@@ -11,7 +11,7 @@
namespace plexclient
{
-enum MediaType {UNDEF = 0, PHOTO, MOVIE, MUSIC, SHOW, SEASON, EPISODE};
+enum MediaType {UNDEF = 0, MOVIE, SHOW, SEASON, EPISODE, MUSIC, PHOTO};
enum StreamType {sUNDEF = 0, sVIDEO = 1, sAUDIO = 2, sSUBTITLE = 3};
class XmlObject
diff --git a/browserGrid.cpp b/browserGrid.cpp
index 18fcf9f..81451f7 100644
--- a/browserGrid.cpp
+++ b/browserGrid.cpp
@@ -124,8 +124,7 @@ eOSState cBrowserGrid::NavigateSelect()
ProcessData();
return eOSState::osContinue;
} else if(plexclient::Video* vid = dynamic_cast<plexclient::Video*>(SelectedObject())) {
- cMyPlugin::PlayFile(*vid);
- return eOSState::osEnd;
+ return eOSState::osUser1;
} else return eOSState::osEnd;
}
diff --git a/plexSdOsd.cpp b/plexSdOsd.cpp
index 799c311..cfa6a7e 100644
--- a/plexSdOsd.cpp
+++ b/plexSdOsd.cpp
@@ -2,6 +2,8 @@
#include "viewGridNavigator.h"
#include "pictureCache.h"
#include <vdr/thread.h>
+#include "SubscriptionManager.h"
+#include "plex.h"
cMutex cPlexSdOsd::RedrawMutex;
@@ -101,5 +103,11 @@ eOSState cPlexSdOsd::ProcessKey(eKeys Key)
default:
break;
}
+
+ if(state == eOSState::osUser1) {
+ //plexclient::ActionManager::GetInstance().AddAction(*vid);
+ cMyPlugin::PlayFile(*vid);
+ state = eOSState::osEnd;
+ }
return state;
}
diff --git a/skins/blackhole/xmlfiles/plug-plex-root.xml b/skins/blackhole/xmlfiles/plug-plex-root.xml
index d474681..37ff442 100644
--- a/skins/blackhole/xmlfiles/plug-plex-root.xml
+++ b/skins/blackhole/xmlfiles/plug-plex-root.xml
@@ -12,35 +12,10 @@
<area x="0" y="0" width="100%" height="100%" layer="1">
<drawimage imagetype="skinpart" path="displaymenuback" x="0" y="0" width="100%" height="100%"/>
</area>
- <area x="0" y="0" width="83%" height="8%" layer="2">
- <drawimage imagetype="skinpart" path="displaymenuheader" x="0" y="0" width="100%" height="100%"/>
- </area>
- <area x="74%" y="0" width="26%" height="46%" layer="3">
- <drawimage imagetype="skinpart" path="displaymenucorner" x="0" y="0" width="100%" height="100%"/>
- </area>
</viewelement>
- <!-- Tokens available in header
- {title}
- {istab1active}
- {tab1name}
- {istab2active}
- {tab2name}
- {istab3active}
- {tab3name}
-
- {selectedtitle}
- {cover}
-
- {ismovie}
- {isshow}
- {banner}
-
- {isseason}
- {banner}
-
- {isepisode}
- {banner}
+ <!-- Tokens available in header and infopane
+ Same as in browser
-->
<viewelement name="header">
<area layer="2" x="0" y="0" width="100%" height="15%">
@@ -48,20 +23,23 @@
<drawtext condition="{istab1active}" x="1%" y="20%" width="98%" font="{light}" fontsize="30%" color="{clrWhite}" text="{tab1name}" />
<drawtext condition="{istab2active}" x="1%" y="20%" width="98%" font="{light}" fontsize="30%" color="{clrWhite}" text="{tab2name}" />
<drawtext condition="{istab3active}" x="1%" y="20%" width="98%" font="{light}" fontsize="30%" color="{clrWhite}" text="{tab3name}" />
+ <drawimage condition="{hasbanner}" imagetype="image" path="{banner}" x="50%" y="5%" width="50%" height="90%" />
</area>
</viewelement>
<viewelement name="infopane">
<area layer="2" x="75%" y="15%" width="25%" height="75%">
<drawtext x="1%" y="2%" width="98%" font="{light}" fontsize="5%" color="{clrWhite}" text="{title}" />
- <drawimage condition="{hasart}" imagetype="image" path="{art}" x="0" y="8%" width="100%" height="35%" />
- <drawtextbox x="1%" y="40%" width="96%" float="topright" font="{light}" fontsize="3%" color="{clrWhite}" text="{summary}" />
+ <drawimage condition="{hasart}++not{isepisode}" imagetype="image" path="{art}" x="0" y="8%" width="100%" height="35%" />
+ <drawimage condition="{hasthumb}++{isepisode}" imagetype="image" path="{thumb}" x="0" y="8%" width="100%" height="35%" />
+ <drawtextbox condition="isset{summary}" x="1%" y="40%" width="96%" float="topright" font="{light}" fontsize="4%" color="{clrWhite}" text="{summary}" />
</area>
</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
@@ -90,8 +68,8 @@
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, seconds, last viewed position
- {duration} int, seconds, total duration
+ {viewoffset} int, minutes, last viewed position
+ {duration} int, minutes, total duration
{ismovie}
{isepisode}
@@ -99,51 +77,50 @@
{banner}
-->
- <!--
- <grid name="browser" x="0" y="15%" width="75%" height="75%">
- <area layer="3">
- <drawtext x="1%" y="2%" width="98%" font="{light}" fontsize="5%" color="{clrWhite}" text="{title}" />
- <drawtext condition="{current}" x="1%" y="20%" width="98%" font="{light}" fontsize="5%" color="{clrWhite}" text="Active" />
- <drawtext condition="{isserver}" x="1%" y="40%" width="98%" font="{light}" fontsize="5%" color="{clrWhite}" text="Server" />
- <drawtext condition="{isserver}" x="1%" y="60%" width="98%" font="{light}" fontsize="5%" color="{clrWhite}" text="{serverstartpointname}" />
- <drawtext condition="{isdirectory}" x="1%" y="40%" width="98%" font="{light}" fontsize="5%" color="{clrWhite}" text="Directory" />
- <drawtext condition="{ismovie}" x="1%" y="40%" width="98%" font="{light}" fontsize="5%" color="{clrWhite}" text="Movie" />
-
- <drawimage condition="not{hasthumb}" imagetype="skinpart" path="plexplaceholder" x="10%" y="20%" width="80%" height="80%" />
- <drawimage condition="{hasthumb}" imagetype="image" path="{thumb}" x="10%" y="20%" width="80%" height="80%" />
-
- <drawtext condition="{isepisode}" x="1%" y="40%" width="98%" font="{light}" fontsize="5%" color="{clrWhite}" text="Episode" />
- </area>
- </grid>
- -->
<grid name="browser" x="0" y="15%" width="75%" height="75%">
+ <area layer="2">
+ <drawrectangle condition="{current}" x="0" y="0" width="100%" height="100%" color="{clrGray}" />
+ </area>
<area layer="3" condition="{ismovie}">
- <drawimage name="thumb" condition="not{hasthumb}" imagetype="skinpart" path="plexplaceholder" x="0" y="0" width="100%" height="100%" />
- <drawimage name="thumb" condition="{hasthumb}" imagetype="image" path="{thumb}" x="0" y="0" width="100%" height="100%" />
- <drawtext x="0" y="{height(thumb)*1.1}" width="100%" font="{light}" fontsize="5%" color="{clrWhite}" text="{title}" />
- <drawtext x="0" y="{height(thumb)*1.1}" width="50%" font="{light}" fontsize="5%" color="{clrWhite}" text="{year}" />
- <drawtext x="50%" y="{height(thumb)*1.1}" width="50%" font="{light}" fontsize="5%" color="{clrWhite}" text="{duration}" />
+ <drawimage name="thumb" condition="not{hasthumb}" imagetype="skinpart" path="plexplaceholder" x="0" y="0" width="100%" height="76%" />
+ <drawimage name="thumb" condition="{hasthumb}" imagetype="image" path="{thumb}" x="0" y="0" width="100%" height="76%" />
+ <drawrectangle x="0" y="{height(thumb)}" width="{viewoffset}/{duration}*{areawidth}" height="2%" color="{clrBlue}" />
+ <drawtext name="title" x="0" y="{height(thumb)}*1.1" width="100%" font="{bold}" fontsize="6%" color="{clrWhite}" text="{title}" />
+ <drawtext x="0" y="{posy(title)} + {height(title)}" width="50%" font="{light}" fontsize="6%" color="{clrWhite}" text="{year}" />
+ <drawtext x="50%" y="{posy(title)} + {height(title)}" width="50%" font="{light}" fontsize="6%" color="{clrWhite}" text="{duration} min" />
</area>
<area layer="3" condition="{isepisode}" >
- <drawtext x="1%" y="2%" width="98%" font="{light}" fontsize="5%" color="{clrWhite}" text="{title}" />
- <drawtext condition="{current}" x="1%" y="20%" width="98%" font="{light}" fontsize="5%" color="{clrWhite}" text="Active" />
+ <drawimage name="thumb" condition="not{hasseriesthumb}" imagetype="skinpart" path="plexplaceholder" x="0" y="0" width="100%" height="76%" />
+ <drawimage name="thumb" condition="{hasseriesthumb}" imagetype="image" path="{seriesthumb}" x="0" y="0" width="100%" height="76%" />
+ <drawrectangle x="0" y="{height(thumb)}" width="{viewoffset}/{duration}*{areawidth}" height="2%" color="{clrBlue}" />
+ <drawtext condition="eq({viewgroup}, 4)" name="title" x="0" y="{height(thumb)}*1.1" width="100%" font="{bold}" fontsize="6%" color="{clrWhite}" text="{title}" />
+ <drawtext condition="lt({viewgroup}, 4)" name="title" x="0" y="{height(thumb)}*1.1" width="100%" font="{bold}" fontsize="6%" color="{clrWhite}" text="{seriestitle}" />
+ <drawtext name="season" x="0" y="{posy(title)} + {height(title)}" width="50%" font="{light}" fontsize="6%" color="{clrWhite}" text="{printf('S%02d E%d02', season, episode)}" />
</area>
<area layer="3" condition="{isdirectory}" >
- <drawtext x="1%" y="2%" width="98%" font="{light}" fontsize="5%" color="{clrWhite}" text="{title}" />
- <drawtext condition="{current}" x="1%" y="20%" width="98%" font="{light}" fontsize="5%" color="{clrWhite}" text="Active" />
+ <drawimage name="thumb" condition="not{hasthumb}" imagetype="skinpart" path="plexplaceholder" x="0" y="0" width="100%" height="76%" />
+ <drawimage name="thumb" condition="{hasthumb}" imagetype="image" path="{thumb}" x="0" y="0" width="100%" height="76%" />
+ <drawtext name="title" x="0" y="{height(thumb)}*1.1" width="100%" font="{bold}" fontsize="6%" color="{clrWhite}" text="{title}" />
</area>
<area layer="3" condition="{isshow}" >
- <drawtext x="1%" y="2%" width="98%" font="{light}" fontsize="5%" color="{clrWhite}" text="{title}" />
- <drawtext condition="{current}" x="1%" y="20%" width="98%" font="{light}" fontsize="5%" color="{clrWhite}" text="Active" />
+ <drawimage name="thumb" condition="not{hasthumb}" imagetype="skinpart" path="plexplaceholder" x="0" y="0" width="100%" height="76%" />
+ <drawimage name="thumb" condition="{hasthumb}" imagetype="image" path="{thumb}" x="0" y="0" width="100%" height="76%" />
+ <drawtext name="title" x="0" y="{height(thumb)}*1.1" width="100%" font="{bold}" fontsize="6%" color="{clrWhite}" text="{title}" />
</area>
<area layer="3" condition="{isseason}" >
- <drawtext x="1%" y="2%" width="98%" font="{light}" fontsize="5%" color="{clrWhite}" text="{title}" />
- <drawtext condition="{current}" x="1%" y="20%" width="98%" font="{light}" fontsize="5%" color="{clrWhite}" text="Active" />
+ <drawimage name="thumb" condition="not{hasthumb}" imagetype="skinpart" path="plexplaceholder" x="0" y="0" width="100%" height="76%" />
+ <drawimage name="thumb" condition="{hasthumb}" imagetype="image" path="{thumb}" x="0" y="0" width="100%" height="76%" />
+ <drawtext name="title" x="0" y="{height(thumb)}*1.1" width="100%" font="{bold}" fontsize="6%" color="{clrWhite}" text="{title}" />
</area>
<area layer="3" condition="{isdummy}" >
- <drawtext x="1%" y="2%" width="98%" font="{light}" fontsize="5%" color="{clrWhite}" text="{title}" />
- <drawtext condition="{current}" x="1%" y="20%" width="98%" font="{light}" fontsize="5%" color="{clrWhite}" text="Active" />
+ <drawimage name="thumb" imagetype="skinpart" path="plexplaceholder" x="0" y="0" width="100%" height="76%" />
+ <drawtext name="title" x="0" y="{height(thumb)}*1.1" width="100%" font="{bold}" fontsize="6%" color="{clrWhite}" text="{title}" />
+ </area>
+ <area layer="3" condition="{isserver}" >
+ <drawimage name="thumb" imagetype="skinpart" path="plexplaceholder" x="0" y="0" width="100%" height="76%" />
+ <drawtext name="title" x="0" y="{height(thumb)}*1.1" width="100%" font="{bold}" fontsize="6%" color="{clrWhite}" text="{title}" />
+ <drawtext x="0" y="{posy(title)} + {height(title)}" width="100%" font="{light}" fontsize="6%" color="{clrWhite}" text="{serverstartpointname}" />
</area>
</grid>