-
Notifications
You must be signed in to change notification settings - Fork 5
/
default.py
66 lines (55 loc) · 2.1 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
import sys
# fix for python importerror bug
import _strptime # noqa: F401
from future.moves.urllib.parse import parse_qsl
from aussieaddonscommon import utils
from resources.lib import menu
from resources.lib import play
from resources.lib import stream_auth
import xbmcaddon
import xbmcgui
addon = xbmcaddon.Addon()
addonname = addon.getAddonInfo('name')
def router(paramstring):
"""
Router function that calls other functions
depending on the provided paramstring
:param paramstring:
"""
params = dict(parse_qsl(paramstring))
utils.log('Running with params: {0}'.format(params))
if params:
if params['action'] == 'listcategories':
if params['category'] == 'Live Matches':
menu.list_matches(params, live=True)
elif params['category'] == 'Settings':
addon.openSettings()
else:
menu.list_videos(params)
elif params['action'] in ['listvideos', 'listmatches']:
play.play_video(params)
elif params['action'] == 'clearticket':
stream_auth.clear_ticket()
elif params['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")
else:
menu.list_categories()
if __name__ == '__main__':
if addon.getSetting('firstrun') == 'true':
xbmcgui.Dialog().ok(addonname, ('Please choose your subscription type '
'and enter your NRL Live Pass '
'username and password to access the '
'content in this service.'))
addon.openSettings()
addon.setSetting('firstrun', 'false')
router(sys.argv[2][1:])