forked from aussieaddons/plugin.video.nrl-live
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.py
61 lines (52 loc) · 1.9 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
import os
import sys
import xbmc
import xbmcgui
import xbmcaddon
from urlparse import parse_qsl
# fix for python importerror bug
import _strptime # noqa: F401
from aussieaddonscommon import utils
addon = xbmcaddon.Addon()
cwd = xbmc.translatePath(addon.getAddonInfo('path')).decode("utf-8")
BASE_RESOURCE_PATH = os.path.join(cwd, 'resources', 'lib')
sys.path.append(BASE_RESOURCE_PATH)
import menu # noqa: E402
import ooyalahelper # noqa: E402
import play # noqa: E402
_url = sys.argv[0]
_handle = int(sys.argv[1])
addonname = addon.getAddonInfo('name')
addonPath = xbmcaddon.Addon().getAddonInfo("path")
fanart = os.path.join(addonPath, 'fanart.jpg')
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':
ooyalahelper.clear_ticket()
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:])