Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.audio.profiles"
name="Audio Profiles"
version="1.2.5"
version="1.2.6"
provider-name="Regss">
<requires>
<import addon="xbmc.python" version="2.14.0" />
Expand Down
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
43 changes: 28 additions & 15 deletions default.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -125,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
Expand All @@ -147,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)
Expand Down Expand Up @@ -229,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
Expand All @@ -240,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:
Expand Down
20 changes: 20 additions & 0 deletions resources/language/English/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
20 changes: 20 additions & 0 deletions resources/language/Italian/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
20 changes: 20 additions & 0 deletions resources/language/Polish/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
8 changes: 8 additions & 0 deletions resources/settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@
<setting label="32010" type="bool" id="profile4" default="false" />
<setting label="32006" type="text" id="name4" default="HDMI" visible="eq(-1,true)" />
<setting label="32027" type="enum" id="profile4_cec" lvalues="32026|32028|32029|32030" enable="eq(-2,true)" visible="eq(-2,true)" />
<setting type="sep" />
<setting label="33011" type="bool" id="profile5" default="false" />
<setting label="33007" type="text" id="name5" default="HDMI" visible="eq(-1,true)" />
<setting label="32027" type="enum" id="profile5_cec" lvalues="32026|32028|32029|32030" enable="eq(-2,true)" visible="eq(-2,true)" />
<setting type="sep" />
<setting label="33012" type="bool" id="profile6" default="false" />
<setting label="33008" type="text" id="name6" default="HDMI" visible="eq(-1,true)" />
<setting label="32027" type="enum" id="profile6_cec" lvalues="32026|32028|32029|32030" enable="eq(-2,true)" visible="eq(-2,true)" />
</category>
<category label="32002">
<setting label="32004" type="bool" id="volume" default="false" />
Expand Down
10 changes: 10 additions & 0 deletions resources/skins/Default/720p/script-audio-profiles-menu.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@
<texture>script-audio-profiles-bg.png</texture>
<visible>StringCompare(Window(10000).Property(script.audio.profiles_items),4)</visible>
</control>
<control type="image">
<height>270</height>
<texture>script-audio-profiles-bg.png</texture>
<visible>StringCompare(Window(10000).Property(script.audio.profiles_items),5)</visible>
</control>
<control type="image">
<height>270</height>
<texture>script-audio-profiles-bg.png</texture>
<visible>StringCompare(Window(10000).Property(script.audio.profiles_items),6)</visible>
</control>
</control>
<control type="label" id="10071">
<description>title</description>
Expand Down
2 changes: 1 addition & 1 deletion service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down