-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdefault.py
57 lines (43 loc) · 1.5 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
53
54
55
56
57
# -*- coding: utf-8 -*-
import sys
import os
import xbmcaddon
import xbmc
__addon__ = xbmcaddon.Addon(id='script.tvtunes')
__cwd__ = __addon__.getAddonInfo('path').decode("utf-8")
__version__ = __addon__.getAddonInfo('version')
__resource__ = xbmc.translatePath(os.path.join(__cwd__, 'resources').encode("utf-8")).decode("utf-8")
__lib__ = xbmc.translatePath(os.path.join(__resource__, 'lib').encode("utf-8")).decode("utf-8")
sys.path.append(__resource__)
sys.path.append(__lib__)
# Import the common settings
from settings import log
from scraper import TvTunesScraper
from screensaver import launchScreensaver
#########################
# Main
#########################
if __name__ == '__main__':
log('script version %s started' % __version__)
try:
# parse sys.argv for params
try:
params = dict(arg.split("=") for arg in sys.argv[1].split("&"))
except:
params = dict(sys.argv[1].split("="))
except:
# no params passed
params = {}
log("params %s" % params)
if params.get("backend", False):
log("TvTunes: Ignoring manual call to run backend")
elif params.get("mode", False) == "solo":
themeScraper = TvTunesScraper()
del themeScraper
elif params.get("screensaver", False):
launchScreensaver()
else:
# Close any open dialogs
xbmc.executebuiltin("Dialog.Close(all, true)", True)
log("TvTunes: Running as Addon/Plugin")
xbmc.executebuiltin("RunAddon(script.tvtunes)")