-
Notifications
You must be signed in to change notification settings - Fork 2
/
addon.py
41 lines (36 loc) · 1 KB
/
addon.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
'''
Main class
'''
# External imports
import sys, os, json
import xbmcaddon, xbmc
from urllib.parse import parse_qsl
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'resources', 'lib'))
__addon__ = xbmcaddon.Addon()
__url__ = sys.argv[0]
__handle__ = int(sys.argv[1])
# Internal imports
from flixtor.createMenu import createMenu
from flixtor.play_video import play_video
# Main function
def main():
args = dict(parse_qsl(sys.argv[2][1:]))
cmd = args.get('cmd', None)
url = args.get('url', None)
video_id = args.get('video', None)
title = args.get('title', None)
func = args.get('func', None)
page = args.get('page', 1)
xbmc.log('Args: %s' %args)
if cmd is None:
createMenu('main', __handle__)
elif cmd == 'subMovies':
createMenu('subMovies', __handle__)
elif cmd == 'play':
xbmc.log('Args: %s' %func)
play_video(video_id)
else:
createMenu(cmd, func, page)
if __name__ == '__main__':
__handle__ = int(sys.argv[1])
main()