forked from hojel/script.cu.lrclyrics
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.py
52 lines (46 loc) · 1.59 KB
/
default.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
import sys
import os
import xbmc
import xbmcaddon
ADDON = xbmcaddon.Addon()
ADDONID = ADDON.getAddonInfo('id')
ADDONNAME = ADDON.getAddonInfo('name')
ADDONVERSION = ADDON.getAddonInfo('version')
CWD = xbmc.translatePath(ADDON.getAddonInfo('path')).decode('utf-8')
PROFILE = xbmc.translatePath(ADDON.getAddonInfo('profile')).decode('utf-8')
LANGUAGE = ADDON.getLocalizedString
BASE_RESOURCE_PATH = os.path.join(CWD, 'resources', 'lib')
sys.path.append (BASE_RESOURCE_PATH)
from utilities import *
from scrapertest import *
log('script version %s started' % ADDONVERSION)
def culrc_run(mode):
log('mode is %s' % mode)
if not WIN.getProperty('culrc.running') == 'true':
import gui
gui.MAIN(mode=mode)
elif not WIN.getProperty('culrc.guirunning') == 'TRUE':
# we're already running, user clicked button on osd
WIN.setProperty('culrc.force','TRUE')
else:
log('script already running')
if ADDON.getSetting('silent') == 'false':
dialog = xbmcgui.Dialog()
dialog.notification(ADDONNAME, LANGUAGE(32158), time=2000, sound=False)
if (__name__ == '__main__'):
service = ADDON.getSetting('service')
# started as a service
if sys.argv == ['']:
if service == 'true':
culrc_run('service')
else:
log('service not enabled')
# manually started
else:
if len(sys.argv) == 2 and sys.argv[1] == 'test':
test_scrapers()
elif service == 'true':
culrc_run('service')
else:
culrc_run('manual')
log('script version %s ended' % ADDONVERSION)