From 531a3788e1d46180e80f5b73c778c91ea568e932 Mon Sep 17 00:00:00 2001 From: Aa! Date: Sat, 13 Apr 2019 14:50:11 +0200 Subject: [PATCH] Bugfixes + "strings.po" renumbering! --- pvr.freebox/addon.xml.in | 2 +- .../resource.language.fr_fr/strings.po | 70 +++--- pvr.freebox/resources/settings.xml | 41 +-- src/Freebox.cpp | 233 +++++++++++++----- src/Freebox.h | 37 ++- src/client.cpp | 53 +++- src/client.h | 2 + 7 files changed, 303 insertions(+), 135 deletions(-) diff --git a/pvr.freebox/addon.xml.in b/pvr.freebox/addon.xml.in index 64344c6..502975e 100644 --- a/pvr.freebox/addon.xml.in +++ b/pvr.freebox/addon.xml.in @@ -1,7 +1,7 @@ @ADDON_DEPENDS@ diff --git a/pvr.freebox/resources/language/resource.language.fr_fr/strings.po b/pvr.freebox/resources/language/resource.language.fr_fr/strings.po index aebe6b6..f09c318 100644 --- a/pvr.freebox/resources/language/resource.language.fr_fr/strings.po +++ b/pvr.freebox/resources/language/resource.language.fr_fr/strings.po @@ -21,98 +21,98 @@ msgid "%d channels loaded" msgstr "%d chaînes chargées" msgctxt "#30001" -msgid "Authorization required" -msgstr "Autorisation requise" +msgid "Authorize Kodi on Freebox Server" +msgstr "Autorisez Kodi sur le Freebox Server" -msgctxt "#40000" -msgid "Section 1" -msgstr "Section 1" - -msgctxt "#41000" -msgid "General" -msgstr "Général" - -msgctxt "#41100" +msgctxt "#30002" msgid "General" msgstr "Général" -msgctxt "#41110" +msgctxt "#30003" msgid "Delay" msgstr "Délai" -msgctxt "#41111" +msgctxt "#30004" msgid "Delay between queries." msgstr "Délai entre chaque requête." -msgctxt "#41120" +msgctxt "#30005" msgid "Restart" msgstr "Redémarrer" -msgctxt "#41121" -msgid "Restart" -msgstr "Redémarrer" +msgctxt "#30006" +msgid "Restart addon after saving settings." +msgstr "Redémarre le logiciel après enregistrement des paramètres." -msgctxt "#41200" +msgctxt "#30007" msgid "Television" msgstr "Télévision" -msgctxt "#41210" +msgctxt "#30008" msgid "Source" msgstr "Source" -msgctxt "#41211" +msgctxt "#30009" msgid "Source" msgstr "Source du flux TV : auto, IPTV ou TNT." -msgctxt "#41212" +msgctxt "#30010" msgid "Auto" msgstr "Auto" -msgctxt "#41213" +msgctxt "#30011" msgid "IPTV" msgstr "IPTV" -msgctxt "#41214" +msgctxt "#30012" msgid "DVB" msgstr "TNT" -msgctxt "#41220" +msgctxt "#30013" msgid "Quality" msgstr "Qualité" -msgctxt "#41221" +msgctxt "#30014" msgid "Quality" msgstr "Qualité du flux TV : auto, haute, standard, basse ou 3D." -msgctxt "#41222" +msgctxt "#30015" msgid "Auto" msgstr "Auto" -msgctxt "#41223" +msgctxt "#30016" msgid "High" msgstr "Haute" -msgctxt "#41224" +msgctxt "#30017" msgid "Standard" msgstr "Standard" -msgctxt "#41225" +msgctxt "#30018" msgid "Low" msgstr "Basse" -msgctxt "#41226" +msgctxt "#30019" msgid "3D" msgstr "3D" -msgctxt "#41300" +msgctxt "#30020" msgid "EPG" msgstr "Guide TV" -msgctxt "#41310" +msgctxt "#30021" msgid "Extended" msgstr "Étendu" -msgctxt "#41311" -msgid "Extended EPG." -msgstr "Guide TV étendu (résumé)." +msgctxt "#30022" +msgid "Extended EPG: plot, cast, etc." +msgstr "Guide TV étendu : chargement du résumé, des acteurs, etc." + +msgctxt "#30023" +msgid "Category conversion" +msgstr "Conversion des catégories" + +msgctxt "#30024" +msgid "Convert French categories into standard categories." +msgstr "Conversion des catégories françaises en catégories standard." diff --git a/pvr.freebox/resources/settings.xml b/pvr.freebox/resources/settings.xml index 7c8b843..c9c6374 100644 --- a/pvr.freebox/resources/settings.xml +++ b/pvr.freebox/resources/settings.xml @@ -1,9 +1,9 @@ -
- - - +
+ + + 0 10 @@ -13,42 +13,47 @@ - + 0 false - - + + 0 1 - - - + + + - + 0 1 - - - - - + + + + + - - + + + 0 + false + + + 0 false diff --git a/src/Freebox.cpp b/src/Freebox.cpp index 68479dc..4e60f5c 100644 --- a/src/Freebox.cpp +++ b/src/Freebox.cpp @@ -142,10 +142,10 @@ bool Freebox::HTTP (const string & custom, const Document & request, Document * doc, Type type) const { - P8PLATFORM::CLockObject lock (m_mutex); + m_mutex.Lock (); string url = URL (path); string session = m_session_token; - lock.Unlock (); + m_mutex.Unlock (); StringBuffer buffer; if (! request.IsNull ()) @@ -303,8 +303,8 @@ bool Freebox::StartSession () } else { - char * notification = XBMC->GetLocalizedString (30001); // "Authorization required" - XBMC->QueueNotification (QUEUE_INFO, notification); + char * notification = XBMC->GetLocalizedString (PVR_FREEBOX_STRING_AUTH_REQUIRED); + XBMC->QueueNotification (QUEUE_WARNING, notification); XBMC->FreeString (notification); return false; } @@ -561,43 +561,57 @@ PVR_ERROR Freebox::Channel::GetStreamProperties (enum Source source, enum Qualit return PVR_ERROR_NO_ERROR; } -int Freebox::Event::Category (int c) +string Freebox::Event::Native (int c) +{ + switch (c) + { + case 1: return "Film"; + case 2: return "Téléfilm"; + case 3: return "Série/Feuilleton"; + case 4: return "Feuilleton"; + case 5: return "Documentaire"; + case 6: return "Théâtre"; + case 7: return "Opéra"; + case 9: return "Variétés"; + case 10: return "Magazine"; + case 11: return "Jeunesse"; + case 12: return "Jeu"; + case 13: return "Musique"; + case 14: return "Divertissement"; + case 16: return "Dessin animé"; + case 19: return "Sport"; + case 20: return "Journal"; + case 22: return "Débat"; + case 24: return "Spectacle"; + case 31: return "Emission religieuse"; + default: return ""; + }; +} + +int Freebox::Event::Colors (int c) { switch (c) { - case 0: return 0x0 <<4| 0x0; - case 1: return 0x1 <<4| 0x0; // Film - case 2: return 0x1 <<4| 0x0; // Téléfilm - case 3: return 0x1 <<4| 0x0; // Série/Feuilleton - case 4: return 0x1 <<4| 0x5; // Feuilleton - case 5: return 0x2 <<4| 0x3; // Documentaire - case 6: return 0x7 <<4| 0x0; // Théâtre - case 7: return 0x6 <<4| 0x5; // Opéra - case 8: return 0x0 <<4| 0x0; - case 9: return 0x3 <<4| 0x2; // Variétés - case 10: return 0x8 <<4| 0x1; // Magazine - case 11: return 0x5 <<4| 0x0; // Jeunesse - case 12: return 0x3 <<4| 0x1; // Jeu - case 13: return 0x6 <<4| 0x0; // Musique - case 14: return 0x3 <<4| 0x2; // Divertissement - case 15: return 0x0 <<4| 0x0; - case 16: return 0x5 <<4| 0x5; // Dessin animé - case 17: return 0x0 <<4| 0x0; - case 18: return 0x0 <<4| 0x0; - case 19: return 0x4 <<4| 0x0; // Sport - case 20: return 0x2 <<4| 0x1; // Journal - case 21: return 0x0 <<4| 0x0; - case 22: return 0x2 <<4| 0x4; // Débat - case 23: return 0x0 <<4| 0x0; - case 24: return 0x7 <<4| 0x0; // Spectacle - case 25: return 0x0 <<4| 0x0; - case 26: return 0x0 <<4| 0x0; - case 27: return 0x0 <<4| 0x0; - case 28: return 0x0 <<4| 0x0; - case 29: return 0x0 <<4| 0x0; - case 30: return 0x0 <<4| 0x0; - case 31: return 0x7 <<4| 0x3; // Emission religieuse - default: return 0; + case 1: return 0x10; // Film + case 2: return 0x10; // Téléfilm + case 3: return 0x10; // Série/Feuilleton + case 4: return 0x15; // Feuilleton + case 5: return 0x23; // Documentaire + case 6: return 0x70; // Théâtre + case 7: return 0x65; // Opéra + case 9: return 0x32; // Variétés + case 10: return 0x81; // Magazine + case 11: return 0x50; // Jeunesse + case 12: return 0x31; // Jeu + case 13: return 0x60; // Musique + case 14: return 0x32; // Divertissement + case 16: return 0x55; // Dessin animé + case 19: return 0x40; // Sport + case 20: return 0x21; // Journal + case 22: return 0x24; // Débat + case 24: return 0x70; // Spectacle + case 31: return 0x73; // Emission religieuse + default: return 0x00; }; } @@ -625,7 +639,7 @@ Freebox::Event::Event (const Value & e, unsigned int channel, time_t date) : year (JSON (e, "year")), cast () { - if (category != 0 && Category (category) == 0) + if (category != 0 && Colors (category) == 0) { string name = JSON (e, "category_name"); cout << category << " : " << name << endl; @@ -641,12 +655,12 @@ Freebox::Event::Event (const Value & e, unsigned int channel, time_t date) : } } -Freebox::Event::ConcatIf::ConcatIf (const string & job) : +Freebox::Event::ConcatIfJob::ConcatIfJob (const string & job) : m_job (job) { } -string Freebox::Event::ConcatIf::operator() (const string & input, const Freebox::Event::CastMember & m) const +string Freebox::Event::ConcatIfJob::operator() (const string & input, const Freebox::Event::CastMember & m) const { if (m.job != m_job) return input; return (input.empty () ? "" : input + EPG_STRING_TOKEN_SEPARATOR) + (m.first_name + ' ' + m.last_name); @@ -654,13 +668,13 @@ string Freebox::Event::ConcatIf::operator() (const string & input, const Freebox string Freebox::Event::GetCastDirector () const { - static const ConcatIf CONCAT ("Réalisateur"); + static const ConcatIfJob CONCAT ("Réalisateur"); return accumulate (cast.begin (), cast.end (), string (), CONCAT); } string Freebox::Event::GetCastActors () const { - static const ConcatIf CONCAT ("Acteur"); + static const ConcatIfJob CONCAT ("Acteur"); return accumulate (cast.begin (), cast.end (), string (), CONCAT); } @@ -671,7 +685,7 @@ bool Freebox::ProcessChannels () Document channels; if (! GET ("/api/v6/tv/channels", &channels)) return false; - char * notification = XBMC->GetLocalizedString (30000); // "%d channels loaded" + char * notification = XBMC->GetLocalizedString (PVR_FREEBOX_STRING_CHANNELS_LOADED); XBMC->QueueNotification (QUEUE_INFO, notification, channels["result"].MemberCount ()); XBMC->FreeString (notification); @@ -793,9 +807,11 @@ bool Freebox::ProcessChannels () } Freebox::Freebox (const string & path, + int source, int quality, int days, bool extended, + bool colors, int delay) : m_path (path), m_server ("mafreebox.freebox.fr"), @@ -804,18 +820,20 @@ Freebox::Freebox (const string & path, m_track_id (), m_session_token (), m_tv_channels (), - m_tv_source (Source::AUTO), + m_tv_source (Source (source)), m_tv_quality (Quality (quality)), m_epg_queries (), m_epg_cache (), m_epg_days (0), m_epg_last (0), m_epg_extended (extended), + m_epg_colors (colors), m_recordings (), m_unique_id (1), m_generators (), m_timers () { + XBMC->QueueNotification (QUEUE_INFO, PVR_FREEBOX_VERSION); SetDays (days); ProcessChannels (); CreateThread (false); @@ -842,7 +860,6 @@ string Freebox::URL (const string & query) const void Freebox::SetSource (int s) { P8PLATFORM::CLockObject lock (m_mutex); -cout << "source: " << s << endl; m_tv_source = Source (s); } @@ -864,6 +881,12 @@ void Freebox::SetExtended (bool e) m_epg_extended = e; } +void Freebox::SetColors (bool c) +{ + P8PLATFORM::CLockObject lock (m_mutex); + m_epg_colors = c; +} + void Freebox::SetDelay (int d) { P8PLATFORM::CLockObject lock (m_mutex); @@ -886,11 +909,10 @@ void Freebox::ProcessEvent (const Event & e, EPG_EVENT_STATE state) return; } - string picture = e.picture; - { - P8PLATFORM::CLockObject lock (m_mutex); - if (! picture.empty ()) picture = URL (picture); - } + m_mutex.Lock (); + bool colors = m_epg_colors; + string picture = ! e.picture.empty () ? URL (e.picture) : ""; + m_mutex.Unlock (); string actors = e.GetCastActors (); string director = e.GetCastDirector (); @@ -912,16 +934,20 @@ void Freebox::ProcessEvent (const Event & e, EPG_EVENT_STATE state) tag.iYear = e.year; tag.strIMDBNumber = NULL; tag.strIconPath = PVR_FREEBOX_C_STR (picture); -#if 1 - int c = Event::Category (e.category); - tag.iGenreType = c & 0xF0; - tag.iGenreSubType = c & 0x0F; - tag.strGenreDescription = NULL; -#else - tag.iGenreType = EPG_GENRE_USE_STRING; - tag.iGenreSubType = 0; - tag.strGenreDescription = PVR_FREEBOX_C_STR (e.category); -#endif + if (colors) + { + int c = Event::Colors (e.category); + tag.iGenreType = c & 0xF0; + tag.iGenreSubType = c & 0x0F; + tag.strGenreDescription = NULL; + } + else + { + string c = Event::Native (e.category); + tag.iGenreType = EPG_GENRE_USE_STRING; + tag.iGenreSubType = 0; + tag.strGenreDescription = PVR_FREEBOX_C_STR (c); + } tag.iParentalRating = 0; tag.iStarRating = 0; tag.bNotify = false; @@ -1347,7 +1373,10 @@ void Freebox::ProcessTimers () { int id = result[i]["id"].GetInt (); int unique_id = m_unique_id ("programmed/" + to_string (id)); - m_timers.emplace (unique_id, Timer (result [i])); + + const string & state = result[i]["state"].GetString (); + if (state != "finished" && state != "failed" && state != "start_error" && state != "running_error") + m_timers.emplace (unique_id, Timer (result [i])); } PVR->TriggerTimerUpdate (); @@ -1846,3 +1875,83 @@ PVR_ERROR Freebox::DeleteTimer (const PVR_TIMER & timer, bool force) return PVR_ERROR_NO_ERROR; } +int freebox_dialog_select (const vector & v, int selected = -1) +{ + // Localize labels. + vector labels; + transform (v.begin (), v.end (), back_inserter (labels), + [] (long id) {return XBMC->GetLocalizedString (id);}); + + // GUI selection. + int r = GUI->Dialog_Select (labels[0], (const char **) &(labels[1]), labels.size () - 1, selected); + + // Free localized labels. + for (char * label : labels) XBMC->FreeString (label); + + return r; +} + +int freebox_dialog_source (int selected = -1) +{ + static const vector LABELS = + { + // Heading. + PVR_FREEBOX_STRING_CHANNEL_SOURCE, + // Entries. + PVR_FREEBOX_STRING_CHANNEL_SOURCE_AUTO, + PVR_FREEBOX_STRING_CHANNEL_SOURCE_IPTV, + PVR_FREEBOX_STRING_CHANNEL_SOURCE_DVB + }; + + return freebox_dialog_select (LABELS, selected); +} + +int freebox_dialog_quality (int selected = -1) +{ + static const vector LABELS = + { + // Heading. + PVR_FREEBOX_STRING_CHANNEL_QUALITY, + // Entries. + PVR_FREEBOX_STRING_CHANNEL_QUALITY_AUTO, + PVR_FREEBOX_STRING_CHANNEL_QUALITY_HD, + PVR_FREEBOX_STRING_CHANNEL_QUALITY_SD, + PVR_FREEBOX_STRING_CHANNEL_QUALITY_LD, + PVR_FREEBOX_STRING_CHANNEL_QUALITY_3D + }; + + return freebox_dialog_select (LABELS, selected); +} + +PVR_ERROR Freebox::MenuHook (const PVR_MENUHOOK & hook, const PVR_MENUHOOK_DATA & data) +{ + switch (hook.iHookId) + { + case PVR_FREEBOX_MENUHOOK_CHANNEL_SOURCE: + { + const PVR_CHANNEL & channel = data.data.channel; + + cout << "PVR_FREEBOX_MENUHOOK_CHANNEL_SOURCE" << ' ' + << '"' << channel.strChannelName << '"' << ' ' << '[' << channel.iUniqueId << ']' << endl; + + int source = freebox_dialog_source (); + + return PVR_ERROR_NO_ERROR; + } + + case PVR_FREEBOX_MENUHOOK_CHANNEL_QUALITY: + { + const PVR_CHANNEL & channel = data.data.channel; + + cout << "PVR_FREEBOX_MENUHOOK_CHANNEL_QUALITY" << ' ' + << '"' << channel.strChannelName << '"' << ' ' << '[' << channel.iUniqueId << ']' << endl; + + int quality = freebox_dialog_quality (); + + return PVR_ERROR_NO_ERROR; + } + } + + return PVR_ERROR_NO_ERROR; +} + diff --git a/src/Freebox.h b/src/Freebox.h index 08ad14f..ffbd9ce 100644 --- a/src/Freebox.h +++ b/src/Freebox.h @@ -25,11 +25,12 @@ #include #include // find_if #include "libXBMC_pvr.h" +#include "libKODI_guilib.h" #include "p8-platform/os.h" #include "p8-platform/threads/threads.h" #include "rapidjson/document.h" -#define PVR_FREEBOX_VERSION "2.0b2" +#define PVR_FREEBOX_VERSION "2.0b3" #define PVR_FREEBOX_BACKEND_NAME "Freebox TV" #define PVR_FREEBOX_BACKEND_VERSION PVR_FREEBOX_VERSION @@ -39,6 +40,22 @@ #define PVR_FREEBOX_APP_NAME "Kodi" #define PVR_FREEBOX_APP_VERSION PVR_FREEBOX_VERSION +#define PVR_FREEBOX_MENUHOOK_CHANNEL_SOURCE 1 +#define PVR_FREEBOX_MENUHOOK_CHANNEL_QUALITY 2 + +#define PVR_FREEBOX_STRING_CHANNELS_LOADED 30000 +#define PVR_FREEBOX_STRING_AUTH_REQUIRED 30001 +#define PVR_FREEBOX_STRING_CHANNEL_SOURCE 30008 +#define PVR_FREEBOX_STRING_CHANNEL_SOURCE_AUTO 30010 +#define PVR_FREEBOX_STRING_CHANNEL_SOURCE_IPTV 30011 +#define PVR_FREEBOX_STRING_CHANNEL_SOURCE_DVB 30012 +#define PVR_FREEBOX_STRING_CHANNEL_QUALITY 30013 +#define PVR_FREEBOX_STRING_CHANNEL_QUALITY_AUTO 30015 +#define PVR_FREEBOX_STRING_CHANNEL_QUALITY_HD 30016 +#define PVR_FREEBOX_STRING_CHANNEL_QUALITY_SD 30017 +#define PVR_FREEBOX_STRING_CHANNEL_QUALITY_LD 30018 +#define PVR_FREEBOX_STRING_CHANNEL_QUALITY_3D 30019 + #ifdef ANDROID #include namespace std @@ -99,9 +116,6 @@ class Freebox : return std::stoi (uuid.substr (6)); // pluri_* } - // Authorization status. - enum class Status {UNKNOWN = 0, PENDING = 1, TIMEOUT = 2, GRANTED = 3, DENIED = 5}; - // Channel source. enum class Source {DEFAULT = 0, AUTO = 1, IPTV = 2, DVB = 3}; @@ -181,7 +195,8 @@ class Freebox : class Event { public: - static int Category (int); + static std::string Native (int); + static int Colors (int); public: class CastMember @@ -199,13 +214,13 @@ class Freebox : typedef std::vector Cast; protected: - class ConcatIf + class ConcatIfJob { private: std::string m_job; public: - ConcatIf (const std::string & job); + ConcatIfJob (const std::string & job); std::string operator() (const std::string &, const Freebox::Event::CastMember &) const; }; @@ -317,7 +332,7 @@ class Freebox : }; public: - Freebox (const std::string & path, int quality, int days, bool extended, int delay); + Freebox (const std::string & path, int source, int quality, int days, bool extended, bool colors, int delay); virtual ~Freebox (); // Freebox Server. @@ -331,6 +346,8 @@ class Freebox : void SetDays (int); // Extended EPG. void SetExtended (bool); + // Colored Categories. + void SetColors (bool); // Delay setting. void SetDelay (int); @@ -357,6 +374,9 @@ class Freebox : PVR_ERROR UpdateTimer (const PVR_TIMER &); PVR_ERROR DeleteTimer (const PVR_TIMER &, bool force); + // M E N U / H O O K S ///////////////////////////////////////////////////// + PVR_ERROR MenuHook (const PVR_MENUHOOK &, const PVR_MENUHOOK_DATA &); + protected: virtual void * Process (); @@ -432,6 +452,7 @@ class Freebox : int m_epg_days; time_t m_epg_last; bool m_epg_extended; + bool m_epg_colors; // Recordings ////////////////////////////////////////////////////////////// std::map m_recordings; // Timers ////////////////////////////////////////////////////////////////// diff --git a/src/client.cpp b/src/client.cpp index a1a6e81..3687a1d 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -41,12 +41,14 @@ int delay = 0; int source = 1; int quality = 1; bool extended = false; +bool colors = false; bool init = false; ADDON_STATUS status = ADDON_STATUS_UNKNOWN; Freebox * data = nullptr; -CHelper_libXBMC_addon * XBMC = nullptr; -CHelper_libXBMC_pvr * PVR = nullptr; +CHelper_libXBMC_addon * XBMC = nullptr; +CHelper_libXBMC_pvr * PVR = nullptr; +CHelper_libKODI_guilib * GUI = nullptr; extern "C" { @@ -56,6 +58,7 @@ void ADDON_ReadSettings () if (! XBMC->GetSetting ("source", &source)) source = 1; if (! XBMC->GetSetting ("quality", &quality)) quality = 1; if (! XBMC->GetSetting ("extended", &extended)) extended = false; + if (! XBMC->GetSetting ("colors", &colors)) colors = false; } ADDON_STATUS ADDON_Create (void * callbacks, void * properties) @@ -82,6 +85,15 @@ ADDON_STATUS ADDON_Create (void * callbacks, void * properties) return ADDON_STATUS_PERMANENT_FAILURE; } + GUI = new CHelper_libKODI_guilib; + if (! GUI->RegisterMe (callbacks)) + { + SAFE_DELETE (GUI); + SAFE_DELETE (PVR); + SAFE_DELETE (XBMC); + return ADDON_STATUS_PERMANENT_FAILURE; + } + XBMC->Log (LOG_DEBUG, "%s - Creating the Freebox TV add-on", __FUNCTION__); status = ADDON_STATUS_UNKNOWN; @@ -91,7 +103,16 @@ ADDON_STATUS ADDON_Create (void * callbacks, void * properties) ADDON_ReadSettings (); - data = new Freebox (p->strUserPath, quality, p->iEpgMaxDays, extended, delay); + static std::vector HOOKS = + { + {PVR_FREEBOX_MENUHOOK_CHANNEL_SOURCE, PVR_FREEBOX_STRING_CHANNEL_SOURCE, PVR_MENUHOOK_CHANNEL}, + {PVR_FREEBOX_MENUHOOK_CHANNEL_QUALITY, PVR_FREEBOX_STRING_CHANNEL_QUALITY, PVR_MENUHOOK_CHANNEL} + }; + + for (PVR_MENUHOOK & h : HOOKS) + PVR->AddMenuHook (&h); + + data = new Freebox (p->strUserPath, source, quality, p->iEpgMaxDays, extended, colors, delay); status = ADDON_STATUS_OK; init = true; @@ -114,23 +135,29 @@ ADDON_STATUS ADDON_SetSetting (const char * name, const void * value) { if (data) { - if (std::string (name) == "delay") + if (! strcmp (name, "delay")) data->SetDelay (*((int *) value)); - if (std::string (name) == "restart") + if (! strcmp (name, "restart")) { - bool restart = *((const char *) value); + bool restart = *((bool *) value); return restart ? ADDON_STATUS_NEED_RESTART : ADDON_STATUS_OK; } - if (std::string (name) == "source") + if (! strcmp (name, "source")) data->SetSource (*((int *) value)); - if (std::string (name) == "quality") + if (! strcmp (name, "quality")) data->SetQuality (*((int *) value)); - if (std::string (name) == "extended") + if (! strcmp (name, "extended")) data->SetExtended (*((bool *) value)); + + if (! strcmp (name, "colors")) + { + data->SetColors (*((bool *) value)); + return ADDON_STATUS_NEED_RESTART; + } } return ADDON_STATUS_OK; @@ -301,10 +328,14 @@ PVR_ERROR DeleteTimer (const PVR_TIMER & timer, bool force) PVR_ERROR GetDriveSpace (long long *, long long *) {return PVR_ERROR_NOT_IMPLEMENTED;} PVR_ERROR SignalStatus (PVR_SIGNAL_STATUS &) {return PVR_ERROR_NOT_IMPLEMENTED;} +PVR_ERROR CallMenuHook (const PVR_MENUHOOK & hook, const PVR_MENUHOOK_DATA & d) +{ + return data ? data->MenuHook (hook, d) : PVR_ERROR_SERVER_ERROR; +} + /** UNUSED API FUNCTIONS */ bool CanPauseStream () {return false;} PVR_ERROR OpenDialogChannelScan () {return PVR_ERROR_NOT_IMPLEMENTED;} -PVR_ERROR CallMenuHook (const PVR_MENUHOOK &, const PVR_MENUHOOK_DATA &) {return PVR_ERROR_NOT_IMPLEMENTED;} PVR_ERROR DeleteChannel (const PVR_CHANNEL &) {return PVR_ERROR_NOT_IMPLEMENTED;} PVR_ERROR RenameChannel (const PVR_CHANNEL &) {return PVR_ERROR_NOT_IMPLEMENTED;} PVR_ERROR OpenDialogChannelSettings (const PVR_CHANNEL &) {return PVR_ERROR_NOT_IMPLEMENTED;} @@ -326,8 +357,8 @@ PVR_ERROR SetRecordingLastPlayedPosition (const PVR_RECORDING &, int) {return PV int GetRecordingLastPlayedPosition (const PVR_RECORDING &) {return -1;} PVR_ERROR GetRecordingEdl (const PVR_RECORDING &, PVR_EDL_ENTRY [], int *) {return PVR_ERROR_NOT_IMPLEMENTED;}; void DemuxAbort () {} -DemuxPacket* DemuxRead () {return NULL;} bool IsTimeshifting () {return false;} +DemuxPacket * DemuxRead () {return NULL;} bool IsRealTimeStream () {return true;} void PauseStream (bool) {} bool CanSeekStream () {return false;} diff --git a/src/client.h b/src/client.h index 25210ee..3bb666c 100644 --- a/src/client.h +++ b/src/client.h @@ -22,7 +22,9 @@ #include "libXBMC_addon.h" #include "libXBMC_pvr.h" +#include "libKODI_guilib.h" extern ADDON::CHelper_libXBMC_addon * XBMC; extern CHelper_libXBMC_pvr * PVR; +extern CHelper_libKODI_guilib * GUI;