-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaddon.py
executable file
·48 lines (40 loc) · 1.7 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
42
43
44
45
46
47
48
# Copyright (c) 2016 Grant Beattie <xbmc#grantbeattie.com>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os, sys
import urlparse
try:
cur_dir = os.path.dirname(os.path.abspath(__file__))
except:
cur_dir = os.getcwd()
sys.path.append(os.path.join(cur_dir, 'resources', 'lib'))
import index, play
args = urlparse.parse_qs(sys.argv[2][1:])
play_arg = args.get('play', None)
sid_arg = args.get('sid', None)
eid_arg = args.get('eid', None)
category_arg = args.get('category', None)
vtid_arg = args.get('vtid', None)
nid_arg = args.get('nid', None)
if play_arg is not None:
play.play(url=play_arg[0], nid=nid_arg[0])
elif sid_arg is not None and category_arg is not None and vtid_arg is not None:
index.build_index(sid=sid_arg[0], category=category_arg[0], vtid=vtid_arg[0])
elif sid_arg is not None and category_arg is not None:
index.build_index(sid=sid_arg[0], category=category_arg[0])
elif sid_arg is not None and eid_arg is not None:
index.build_index(sid=sid_arg[0], eid=eid_arg[0])
elif sid_arg is not None:
index.build_index(sid=sid_arg[0])
else:
index.build_index()