-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdefault.py
86 lines (76 loc) · 2.87 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import sys
# fix for python bug
import _strptime # noqa: F401
from aussieaddonscommon import utils
from resources.lib import comm
from resources.lib import index
from resources.lib import play
from resources.lib import search
import xbmc
import xbmcaddon
# Print our platform/version debugging information
utils.log_kodi_platform_version()
def main():
addon = xbmcaddon.Addon()
if addon.getSetting('firstrun') == 'true':
utils.dialog_message(
'Welcome to the new On Demand add-on. An SBS On Demand account '
'is now required to use this service. Please sign up at '
'sbs.com.au or in the mobile app, then enter your details in '
'the add-on settings.')
comm.get_login_token()
addon.setSetting('firstrun', 'false')
params_str = sys.argv[2]
params = utils.get_url(params_str)
utils.log(str(params))
if len(params) == 0:
index.make_index_list()
elif params.get('obj_type') == 'Program':
play.play(params_str)
elif 'feed_url' in params:
index.make_entries_list(params)
elif 'category' in params or params.get(
'item_type') in ['ProgramGenre', 'FilmGenre', 'Channel']:
if params.get('category') == 'Search':
index.make_search_history_list()
else:
index.make_category_list(params)
elif 'action' in params:
action = params.get('action')
if action == 'favouritescategories':
index.make_favourites_categories_list()
elif action == 'addfavourites':
comm.add_to_favourites(params)
elif action == 'removefavourites':
comm.remove_from_favourites(params)
xbmc.executebuiltin('Container.Refresh')
elif action == 'searchhistory':
if params.get('name') == 'New Search':
search.get_search_input()
else:
index.make_search_list(params)
elif action == 'removesearch':
search.remove_from_search_history(params.get('name'))
elif action == 'sendreport':
utils.user_report()
elif action == 'settings':
xbmcaddon.Addon().openSettings()
elif action == 'logout':
comm.clear_login_token()
elif action == 'login':
comm.get_login_token()
xbmc.executebuiltin('Container.Refresh')
elif action == 'open_ia_settings':
try:
import drmhelper
if drmhelper.check_inputstream(drm=False):
ia = drmhelper.get_addon()
ia.openSettings()
else:
utils.dialog_message(
"Can't open inputstream.adaptive settings")
except Exception:
utils.dialog_message(
"Can't open inputstream.adaptive settings")
if __name__ == "__main__":
main()