-
Notifications
You must be signed in to change notification settings - Fork 3
/
default.py
41 lines (35 loc) · 1.27 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
#!/usr/bin/python
import xbmcgui
from resources.lib.utils import *
from resources.lib.helper import *
class Main:
def __init__(self):
self._parse_argv()
if self.action:
self.getactions()
else:
xbmcgui.Dialog().ok('Error', 'This is a tool to provide features to a skin and requires skin integration.')
def _parse_argv(self):
args = sys.argv
self.action = []
for arg in args:
if arg == 'script.bingie.helper':
continue
if arg.startswith('action='):
self.action.append(arg[7:])
else:
try:
self.params[arg.split("=")[0].lower()] = "=".join(arg.split("=")[1:]).strip()
except Exception:
self.params = {}
log('Invalid parameter: %s' % arg)
def getactions(self):
action_inventory = {'ismylist': ismylist,
'togglemylist': togglemylist,
'ratetitle': ratetitle,
'gettvshowid': gettvshowid,
'playtrailer': playtrailer}
for action in self.action:
action_inventory[action](self.params)
if __name__ == "__main__":
Main()