-
Notifications
You must be signed in to change notification settings - Fork 1
/
script.py
55 lines (41 loc) · 1.75 KB
/
script.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# -*- coding: utf-8 -*-
import xbmc
import xbmcaddon
import os
import sys
import time
_addon = xbmcaddon.Addon()
_id = _addon.getAddonInfo('id').decode('utf-8')
_path = _addon.getAddonInfo('path').decode('utf-8')
_skin = os.path.basename(
os.path.normpath(xbmc.translatePath('special://skin/')))
_xml = 'Custom_Screensaver_1166.xml'
def wait_for_string(string, shortcut):
path = xbmc.getInfoLabel('Skin.String({})'.format(string))
xbmc.executebuiltin(shortcut, wait=True)
while path == xbmc.getInfoLabel('Skin.String({})'.format(string)):
time.sleep(1)
return xbmc.getInfoLabel('Skin.String({})'.format(string))
def get_params():
for arg in [x for x in sys.argv if 'script.py' not in x]:
if '=' in arg:
arg_split = arg.split('=', 1)
if arg_split[0] and arg_split[1]:
return arg_split
if __name__ == '__main__':
if get_params() == ['mode', 'choose']:
call = ('RunScript(script.skinshortcuts,'
'type=widgets'
'&showNone=False'
'&skinWidgetName=screensaver.auramod.name'
'&skinWidgetPath=screensaver.auramod.path)')
name = wait_for_string('screensaver.auramod.name', call)
_addon.setSettingString('screensaver.auramod.name', name)
elif get_params() == ['mode', 'tvchoose']:
call = ('RunScript(script.skinshortcuts,'
'type=widgets'
'&showNone=False'
'&skinWidgetName=screensaver.auramod.tvname'
'&skinWidgetPath=screensaver.auramod.tvpath)')
tvname = wait_for_string('screensaver.auramod.tvname', call)
_addon.setSettingString('screensaver.auramod.tvname', tvname)