From 7de1748cbaf31337f1f592cc9ee47f7872333f33 Mon Sep 17 00:00:00 2001 From: chriszero Date: Thu, 19 Feb 2015 20:29:12 +0100 Subject: Supporting custom transcoding profile. --- Config.cpp | 8 +++++++- Config.h | 3 +++ VDR Plex Plugin.xml | 20 ++++++++++++++++++++ hlsPlayer.cpp | 9 +++++++-- plex.cpp | 1 + 5 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 VDR Plex Plugin.xml diff --git a/Config.cpp b/Config.cpp index 0ce98d6..c3a5abf 100644 --- a/Config.cpp +++ b/Config.cpp @@ -65,8 +65,11 @@ cMyMenuSetupPage::cMyMenuSetupPage(void) strn0cpy(Username, Config::GetInstance().s_username.c_str(), STRING_SIZE); strn0cpy(Password, Config::GetInstance().s_password.c_str(), STRING_SIZE); strn0cpy(Uuid, Config::GetInstance().GetUUID().c_str(), STRING_SIZE); + HideMainMenuEntry = Config::GetInstance().HideMainMenuEntry; + UseCustomTranscodeProfile = Config::GetInstance().UseCustomTranscodeProfile; - Add(new cMenuEditBoolItem(tr("Hide main menu entry"), (int*)&Config::GetInstance().HideMainMenuEntry, trVDR("no"), trVDR("yes"))); + Add(new cMenuEditBoolItem(tr("Hide main menu entry"), (int*)&HideMainMenuEntry, trVDR("no"), trVDR("yes"))); + Add(new cMenuEditBoolItem(tr("Use custom transcoding profile"), (int*)&UseCustomTranscodeProfile, trVDR("no"), trVDR("yes"))); Add(new cMenuEditStrItem(tr("Plex Username"), Username, STRING_SIZE)); Add(new cMenuEditStrItem(tr("Plex Password"), Password, STRING_SIZE)); cMenuEditStrItem* devUUID = new cMenuEditStrItem(tr("Current UUID"), Uuid, STRING_SIZE); @@ -81,7 +84,10 @@ void cMyMenuSetupPage::Store(void) { Config::GetInstance().s_username = std::string(Username); Config::GetInstance().s_password = std::string(Password); + Config::GetInstance().HideMainMenuEntry = HideMainMenuEntry; + Config::GetInstance().UseCustomTranscodeProfile = UseCustomTranscodeProfile; + SetupStore("UseCustomTranscodeProfile", Config::GetInstance().UseCustomTranscodeProfile); SetupStore("HideMainMenuEntry", Config::GetInstance().HideMainMenuEntry); SetupStore("Username", Config::GetInstance().s_username.c_str()); SetupStore("Password", Config::GetInstance().s_password.c_str()); diff --git a/Config.h b/Config.h index a424305..a32bbcf 100644 --- a/Config.h +++ b/Config.h @@ -28,6 +28,7 @@ public: std::string s_password; bool HideMainMenuEntry; + bool UseCustomTranscodeProfile = false; std::string GetUUID(); void SetUUID(const char* uuid); @@ -57,6 +58,8 @@ class cMyMenuSetupPage:public cMenuSetupPage char Username[STRING_SIZE]; char Password[STRING_SIZE]; char Uuid[STRING_SIZE]; + int HideMainMenuEntry; + int UseCustomTranscodeProfile; virtual void Store(void); diff --git a/VDR Plex Plugin.xml b/VDR Plex Plugin.xml new file mode 100644 index 0000000..a492308 --- /dev/null +++ b/VDR Plex Plugin.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + diff --git a/hlsPlayer.cpp b/hlsPlayer.cpp index fe52c7c..605280f 100644 --- a/hlsPlayer.cpp +++ b/hlsPlayer.cpp @@ -326,10 +326,15 @@ bool cHlsSegmentLoader::StopLoader(void) void cHlsSegmentLoader::AddHeader(Poco::Net::HTTPRequest& req) { req.add("X-Plex-Client-Identifier", Config::GetInstance().GetUUID()); - req.add("X-Plex-Product", "Plex Home Theater"); req.add("X-Plex-Device", "PC"); - req.add("X-Plex-Platform", "Plex Home Theater"); req.add("X-Plex-Model", "Linux"); + if(Config::GetInstance().UseCustomTranscodeProfile) { + req.add("X-Plex-Product", "VDR Plex Plugin"); + req.add("X-Plex-Platform", "VDR Plex Plugin"); + } else { + req.add("X-Plex-Product", "Plex Home Theater"); + req.add("X-Plex-Platform", "Plex Home Theater"); + } } bool cHlsSegmentLoader::Active(void) diff --git a/plex.cpp b/plex.cpp index 3707d88..0e40847 100644 --- a/plex.cpp +++ b/plex.cpp @@ -356,6 +356,7 @@ bool cMyPlugin::SetupParse(const char *name, const char *value) //dsyslog("[plex]%s: '%s' = '%s'\n", __FUNCTION__, name, value); if (strcasecmp(name, "HideMainMenuEntry") == 0) Config::GetInstance().HideMainMenuEntry = atoi(value) ? true : false; + else if (strcasecmp(name, "UseCustomTranscodeProfile") == 0) Config::GetInstance().UseCustomTranscodeProfile = atoi(value) ? true : false; else if (strcasecmp(name, "Username") == 0) Config::GetInstance().s_username = std::string(value); else if (strcasecmp(name, "Password") == 0) Config::GetInstance().s_password = std::string(value); else if (strcasecmp(name, "UUID") == 0) Config::GetInstance().SetUUID(value); -- cgit v1.2.3