Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addon defaults to HD channels. #22

Closed
mcaptur opened this issue Aug 17, 2015 · 4 comments
Closed

Addon defaults to HD channels. #22

mcaptur opened this issue Aug 17, 2015 · 4 comments

Comments

@mcaptur
Copy link
Contributor

mcaptur commented Aug 17, 2015

Addon defaults to HD channels which only plays for 3 minutes when you do not have a paid subscription. kindly add option to choose between HD or low quality as default. this way users with a subscription can use hd by default whilst users without paid subscription can view free sd channels.

@mcaptur
Copy link
Contributor Author

mcaptur commented Aug 20, 2015

this patch should fix it

diff --git a/pvr.filmon/resources/language/resource.language.en_gb/strings.po b/pvr.filmon/resources/language/resource.language.en_gb/strings.po
index d282de7..a570dbb 100644
--- a/pvr.filmon/resources/language/resource.language.en_gb/strings.po
+++ b/pvr.filmon/resources/language/resource.language.en_gb/strings.po
@@ -23,3 +23,9 @@ msgstr ""
msgctxt "#30001"
msgid "Password"
msgstr ""
+
+msgctxt "#30002"
+msgid "Prefer HD"
+msgstr ""
+
+
diff --git a/pvr.filmon/resources/settings.xml b/pvr.filmon/resources/settings.xml
index d104352..4fede35 100644
--- a/pvr.filmon/resources/settings.xml
+++ b/pvr.filmon/resources/settings.xml
@@ -2,4 +2,5 @@



-
\ No newline at end of file

+
diff --git a/src/FilmonAPI.cpp b/src/FilmonAPI.cpp
index 76c87bc..dac1fda 100644
--- a/src/FilmonAPI.cpp
+++ b/src/FilmonAPI.cpp
@@ -44,11 +44,14 @@
#define TIMER_STATUS "Accepted"
#define OFF_AIR "Off Air"

/* open without caching. regardless to file type. */
#define READ_NO_CACHE 0x08

using namespace ADDON;

// Attempt at genres
typedef struct {
int genreType;
@@ -343,14 +346,32 @@ bool filmonAPIgetChannel(unsigned int channelId, FILMON_CHANNEL *channel) {
std::string streamURL;
unsigned int streamCount = streams.size();
unsigned int stream = 0;

  •   bool Pref_HD =true;
    
  • for (stream = 0; stream < streamCount; stream++) {
        std::string quality = streams[stream]["quality"].asString();
    
  •       if (quality.compare(std::string("high")) == 0 || quality.compare(std::string("480p")) == 0 || quality.compare(std::string("HD")) == 0) {
    
  •           XBMC->Log(LOG_DEBUG, "high quality stream found: %s", quality.c_str());
    
  •           break;
    
  •       } else {
    
  •           XBMC->Log(LOG_DEBUG, "low quality stream found: %s", quality.c_str());
    
  •       if (XBMC->GetSetting("preferhd",&Pref_HD)){
    
  •           XBMC->Log(LOG_DEBUG, "Prefer high quality stream");
    
  •           if (quality.compare(std::string("high")) == 0 || quality.compare(std::string("480p")) == 0 || quality.compare(std::string("HD")) == 0) {
    
  •               XBMC->Log(LOG_DEBUG, "high quality stream found: %s", quality.c_str());
    
  •               break;
    
  •           } else {
    
  •               XBMC->Log(LOG_DEBUG, "low quality stream found: %s", quality.c_str());
    
  •           }
    
  •       }
    
  •       else{
    
  •           XBMC->Log(LOG_DEBUG, "Prefer low quality stream");
    
  •           if (quality.compare(std::string("high")) == 0 || quality.compare(std::string("480p")) == 0 || quality.compare(std::string("HD")) == 0) {
    
  •                               XBMC->Log(LOG_DEBUG, "high quality stream found: %s", quality.c_str());
    
  •                           } else {
    
  •                               XBMC->Log(LOG_DEBUG, "low quality stream found: %s", quality.c_str());
    
  •                               break;
    
  •                       }
        }
    
    • }
      std::string chTitle = title.asString();
      std::string iconPath = icon.asString();
      diff --git a/src/client.cpp b/src/client.cpp
      index 427c0cb..a124560 100644
      --- a/src/client.cpp
      +++ b/src/client.cpp
      @@ -48,6 +48,7 @@ std::string g_strUserPath = "";
      std::string g_strClientPath = "";
      std::string g_strUsername = "";
      std::string g_strPassword = "";
      +bool g_boolPreferHd = true;

    CHelper_libXBMC_addon *XBMC = NULL;
    CHelper_libXBMC_pvr *PVR = NULL;
    @@ -56,6 +57,7 @@ extern "C" {

    void ADDON_ReadSettings(void) {
    char buffer[1024] = "";

  • bool Pref_HD =true;

/* read setting "username" from settings.xml */
if (XBMC->GetSetting("username", buffer))
@@ -70,6 +72,13 @@ void ADDON_ReadSettings(void) {
else
g_strPassword = "";

  • /* read setting "preferhd" from settings.xml */
  • if (XBMC->GetSetting("preferhd", &Pref_HD))
  •   g_boolPreferHd = true;
    
  • else
  •   g_boolPreferHd = false;
    
    XBMC->Log(LOG_DEBUG, "%s - read PVR Filmon settings", FUNCTION);
    }

@@ -132,29 +141,49 @@ unsigned int ADDON_GetSettings(ADDON_StructSetting ***sSet) {
return 0;
}

-ADDON_STATUS ADDON_SetSetting(const char *settingName,

  •   const void *settingValue) {
    
  • string str = settingName;
  • if (str == "username") {
  •   string tmp_sUsername = g_strUsername;
    
  •   g_strUsername = (const char*) settingValue;
    
  •   if (tmp_sUsername != g_strUsername) {
    
  •       XBMC->Log(LOG_INFO, "%s - Changed Setting 'username'",
    
  •               **FUNCTION**);
    
  •       return ADDON_STATUS_NEED_RESTART;
    
  •   }
    
  • } else if (str == "password") {
  •   string tmp_sPassword = g_strPassword;
    
  •   g_strPassword = (const char*) settingValue;
    
  •   if (tmp_sPassword != g_strPassword) {
    
  •       XBMC->Log(LOG_INFO, "%s - Changed Setting 'password'",
    
  •               **FUNCTION**);
    
  •       return ADDON_STATUS_NEED_RESTART;
    
  •   }
    
  • }
  • return ADDON_STATUS_OK;

+ADDON_STATUS ADDON_SetSetting

  • (const char *settingName, const void *settingValue)
    +{
    +#define UPDATE_STR(key, var)\
  • if (!strcmp(settingName, key))\
  • {\
  • if (strcmp(var.c_str(), (const char*)settingValue) != 0)\
  • {\
  •   XBMC->Log(LOG_INFO, "%s - Changed Setting",\
    
  •               **FUNCTION**);\
    
  •       return ADDON_STATUS_NEED_RESTART;\
    
  • }\
  • return ADDON_STATUS_OK;\
  • }

+#define UPDATE_INT(key, type, var)\

  • if (!strcmp(settingName, key))\
  • {\
  • if (var != (type)settingValue)\
  • {\
  •   XBMC->Log(LOG_INFO, "%s - Changed Setting",\
    
  •               **FUNCTION**);\
    
  •       return ADDON_STATUS_NEED_RESTART;\
    
  • }\
  • return ADDON_STATUS_OK;\
  • }
  • /* Connection */
  • UPDATE_STR("username", g_strUsername);
  • UPDATE_STR("password", g_strPassword);
  • /* HD */
  • UPDATE_INT("preferhd", bool, g_boolPreferHd);
  • return ADDON_STATUS_OK;

+#undef UPDATE_INT
+#undef UPDATE_STR
}

void ADDON_Stop() {
}

@Mike-KL
Copy link

Mike-KL commented Apr 16, 2016

Assume this was/is fixed as option within add-on settings for enabling HD which is disabled on initial installation of add-on and addition of user film-on login details. To be closed?

@Jalle19
Copy link
Contributor

Jalle19 commented Jul 11, 2016

Looks like this can be closed indeed.

@Jalle19 Jalle19 closed this as completed Jul 11, 2016
@mcaptur
Copy link
Contributor Author

mcaptur commented Jul 11, 2016

yep

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants