From cf8cc7c292e4e6bdcd6ca3fd734c2777805af136 Mon Sep 17 00:00:00 2001 From: RickDB Date: Fri, 24 Mar 2017 20:53:00 +0100 Subject: [PATCH 1/2] Increased profile limit from 4 to 6. --- addon.xml | 2 +- changelog.txt | 3 +++ default.py | 10 +++++++--- resources/language/English/strings.po | 20 +++++++++++++++++++ resources/language/Italian/strings.po | 20 +++++++++++++++++++ resources/language/Polish/strings.po | 20 +++++++++++++++++++ resources/settings.xml | 8 ++++++++ .../720p/script-audio-profiles-menu.xml | 10 ++++++++++ service.py | 2 +- 9 files changed, 90 insertions(+), 5 deletions(-) diff --git a/addon.xml b/addon.xml index 4b6b926..cb6c6f0 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ diff --git a/changelog.txt b/changelog.txt index 600d5c7..9e34dbb 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +[B]1.2.6[/B] +- add: increased profile limit from 4 to 6 + [B]1.2.5[/B] - fix: assign cdda Audio CD from unknown to audio type - fix: prevent auto change immediately after change profile manually diff --git a/default.py b/default.py index 91f8a40..0640988 100644 --- a/default.py +++ b/default.py @@ -27,13 +27,17 @@ 1: ADDON.getSetting('name1'), 2: ADDON.getSetting('name2'), 3: ADDON.getSetting('name3'), - 4: ADDON.getSetting('name4') + 4: ADDON.getSetting('name4'), + 5: ADDON.getSetting('name5'), + 6: ADDON.getSetting('name6'), } sProfile = { 1: ADDON.getSetting('profile1'), 2: ADDON.getSetting('profile2'), 3: ADDON.getSetting('profile3'), - 4: ADDON.getSetting('profile4') + 4: ADDON.getSetting('profile4'), + 5: ADDON.getSetting('profile5'), + 6: ADDON.getSetting('profile6') } cecCommands = ['', 'CECActivateSource', 'CECStandby', 'CECToggleState'] @@ -70,7 +74,7 @@ def start(self, mode): self.profile(str(enabledProfiles[0][ret])) return - if mode == '0' or mode == '1' or mode == '2' or mode == '3' or mode == '4': + if mode == '0' or mode == '1' or mode == '2' or mode == '3' or mode == '4'or mode == '5'or mode == '6': if self.check(mode) is False: return diff --git a/resources/language/English/strings.po b/resources/language/English/strings.po index 2833c6c..63a135f 100644 --- a/resources/language/English/strings.po +++ b/resources/language/English/strings.po @@ -85,6 +85,16 @@ msgctxt "#32006" msgid "Name of profile 4" msgstr "" +#: Settings +msgctxt "#33007" +msgid "Name of profile 5" +msgstr "" + +#: Settings +msgctxt "#33008" +msgid "Name of profile 6" + +msgstr "" #: Settings msgctxt "#32007" msgid "Profile 1" @@ -105,6 +115,16 @@ msgctxt "#32010" msgid "Profile 4" msgstr "" +#: Settings +msgctxt "#33011" +msgid "Profile 5" +msgstr "" + +#: Settings +msgctxt "#33012" +msgid "Profile 6" +msgstr "" + #: Settings msgctxt "#32021" msgid "Profile for GUI" diff --git a/resources/language/Italian/strings.po b/resources/language/Italian/strings.po index 78f9080..abdf85d 100644 --- a/resources/language/Italian/strings.po +++ b/resources/language/Italian/strings.po @@ -97,6 +97,16 @@ msgctxt "#32006" msgid "Name of profile 4" msgstr "Nome del Profilo 4" +#: Settings +msgctxt "#33007" +msgid "Name of profile 5" +msgstr "Nome del Profilo 6" + +#: Settings +msgctxt "#33008" +msgid "Name of profile 6" +msgstr "Nome del Profilo 6" + #: Settings msgctxt "#32007" msgid "Profile 1" @@ -117,6 +127,16 @@ msgctxt "#32010" msgid "Profile 4" msgstr "Profilo 4" +#: Settings +msgctxt "#33011" +msgid "Profile 5" +msgstr "Profilo 5" + +#: Settings +msgctxt "#33012" +msgid "Profile 6" +msgstr "Profilo 6" + #: Settings msgctxt "#32021" msgid "Profile for GUI" diff --git a/resources/language/Polish/strings.po b/resources/language/Polish/strings.po index a2d7858..e4eddff 100644 --- a/resources/language/Polish/strings.po +++ b/resources/language/Polish/strings.po @@ -95,6 +95,16 @@ msgctxt "#32006" msgid "Name of profile 4" msgstr "Nazwa profilu 4" +#: Settings +msgctxt "#33007" +msgid "Name of profile 5" +msgstr "Nazwa profilu 5" + +#: Settings +msgctxt "#33008" +msgid "Name of profile 6" +msgstr "Nazwa profilu 6" + #: Settings msgctxt "#32007" msgid "Profile 1" @@ -115,6 +125,16 @@ msgctxt "#32010" msgid "Profile 4" msgstr "Profil 4" +#: Settings +msgctxt "#33011" +msgid "Profile 5" +msgstr "Profil 5" + +#: Settings +msgctxt "#33012" +msgid "Profile 6" +msgstr "Profil 6" + #: Settings msgctxt "#32021" msgid "Profile for GUI" diff --git a/resources/settings.xml b/resources/settings.xml index 2c6e823..f77d651 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -16,6 +16,14 @@ + + + + + + + + diff --git a/resources/skins/Default/720p/script-audio-profiles-menu.xml b/resources/skins/Default/720p/script-audio-profiles-menu.xml index d0b19e5..8dfbdd1 100644 --- a/resources/skins/Default/720p/script-audio-profiles-menu.xml +++ b/resources/skins/Default/720p/script-audio-profiles-menu.xml @@ -31,6 +31,16 @@ script-audio-profiles-bg.png StringCompare(Window(10000).Property(script.audio.profiles_items),4) + + 270 + script-audio-profiles-bg.png + StringCompare(Window(10000).Property(script.audio.profiles_items),5) + + + 270 + script-audio-profiles-bg.png + StringCompare(Window(10000).Property(script.audio.profiles_items),6) + title diff --git a/service.py b/service.py index 2515067..4df0233 100644 --- a/service.py +++ b/service.py @@ -17,7 +17,7 @@ import debug -profiles = ['1', '2', '3', '4'] +profiles = ['1', '2', '3', '4', '5', '6'] map_type = { 'movie': 'auto_movies', 'video': 'auto_videos', 'episode': 'auto_tvshows', 'channel': 'auto_pvr', 'musicvideo': 'auto_musicvideo', 'song': 'auto_music', 'unknown': 'auto_unknown' } susppend_auto_change = False set_for_susspend = None From f13ac195e6ea0f2a3e7a99d59328229c99b24742 Mon Sep 17 00:00:00 2001 From: RickDB Date: Thu, 29 Jun 2017 17:51:38 +0200 Subject: [PATCH 2/2] Added DSplayer audio settings parsing. Simplified JSON readouts and made it less error prone. --- default.py | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/default.py b/default.py index 0640988..65fee0b 100644 --- a/default.py +++ b/default.py @@ -129,18 +129,18 @@ def save(self): # get all settings from Video / Playback section '{"jsonrpc":"2.0","method":"Settings.GetSettings", "params":{"level": "expert", "filter":{"section":"player","category":"videoplayer"}}, "id":1}', # get all settings from System / Video section - '{"jsonrpc":"2.0","method":"Settings.GetSettings", "params":{"level": "expert", "filter":{"section":"system","category":"display"}}, "id":1}' + '{"jsonrpc":"2.0","method":"Settings.GetSettings", "params":{"level": "expert", "filter":{"section":"system","category":"display"}}, "id":1}', + # get dsplayer settings from Player / DSPlayer section + '{"jsonrpc":"2.0","method":"Settings.GetSettings", "params":{"level": "expert", "filter":{"section":"player","category":"dsplayer"}},"id":1}' ] # send json requests for j in json_s: - jsonGet = xbmc.executeJSONRPC(j) - jsonGet = json.loads(unicode(jsonGet, 'utf-8')) - debug.debug('[JSON]: ' + str(jsonGet)) - - if 'result' in jsonGet: - if 'settings' in jsonGet['result']: - for set in jsonGet['result']['settings']: + jsonRequest = xbmc.executeJSONRPC(j) + jsonResult = json.loads(jsonRequest.decode('utf-8','replace')) + if 'result' in jsonResult: + if 'settings' in jsonResult['result']: + for set in jsonResult['result']['settings']: if 'value' in set.keys(): if set['value'] == True or set['value'] == False: # lowercase bolean values @@ -151,8 +151,8 @@ def save(self): else: settingsToSave[set['id']] = str(set['value']).encode('utf-8') - if 'volume' in jsonGet['result']: - settingsToSave['volume'] = str(jsonGet['result']['volume']) + if 'volume' in jsonResult['result']: + settingsToSave['volume'] = str(jsonResult['result']['volume']) # prepare JSON string to save to file jsonToWrite = json.dumps(settingsToSave) @@ -233,7 +233,9 @@ def profile(self, profile): 'audiooutput.audiodevice', 'audiooutput.passthroughdevice', 'locale.audiolanguage', - 'lookandfeel.soundskin' + 'lookandfeel.soundskin', + 'dsplayer.audiorenderer', + 'dsplayer.saneardevices' ] # set settings readed from profile file @@ -244,7 +246,14 @@ def profile(self, profile): continue if 'false' in sVideo and setName.startswith('videoscreen'): continue - + + # check for DSplayer settings and skip anything not related to audio + if setName.startswith('dsplayer.'): + if setName.startswith('dsplayer.audiorenderer') or setName.startswith('dsplayer.sanear'): + pass + else: + continue + debug.debug('[RESTORING SETTING]: ' + setName + ': ' + setValue) # add quotes if setName in quote_needed: