-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdefault.py
More file actions
101 lines (92 loc) · 3.62 KB
/
default.py
File metadata and controls
101 lines (92 loc) · 3.62 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#!/usr/bin/env python
import os
import socket
import sqlite3
import sys
import urllib
import xbmc
import xbmcaddon
import xbmcgui
import xbmcplugin
import xbmcvfs
from resources.lib.utils import *
from resources.lib.navigation import *
from resources.lib.library import updateLibrary
### get addon info
__addon__ = xbmcaddon.Addon()
__addonidint__ = int(sys.argv[1])
__addondir__ = xbmc.translatePath(__addon__.getAddonInfo('profile'))
__addonname__ = __addon__.getAddonInfo('name')
## parse plugin arguments
params = get_params()
## get path
try:
path = urllib.unquote_plus(params["path"])
except:
path = "/"
log('Script path: %s' % path)
log('Library path: %s' % __addon__.getSetting("libraryPath"))
xbmcplugin.setContent(__addonidint__, 'tvshows')
## check path and generate desired list
if path == "/":
mainMenu()
## finish adding items to list and display
xbmcplugin.endOfDirectory(__addonidint__)
elif path.startswith("/browsebyorganisation"):
log("path:%s" % path)
organisation = path.replace('/browsebyorganisation','')
log("organisation:%s" % organisation)
if organisation == '':
## populate list of organisations
xbmcplugin.addSortMethod(__addonidint__, xbmcplugin.SORT_METHOD_VIDEO_TITLE)
xbmcplugin.addSortMethod(__addonidint__, xbmcplugin.SORT_METHOD_EPISODE)
browseByOrganisation()
## finish adding items to list and display
xbmcplugin.endOfDirectory(__addonidint__)
else:
## populate list of events for a given organisation
xbmcplugin.addSortMethod(__addonidint__, xbmcplugin.SORT_METHOD_DATE)
xbmcplugin.addSortMethod(__addonidint__, xbmcplugin.SORT_METHOD_VIDEO_TITLE)
getEventsByOrganisation(organisation.lstrip('/'))
## finish adding items to list and display
xbmcplugin.endOfDirectory(__addonidint__)
elif path.startswith("/browsebyfighter"):
log("path:%s" % path)
fighterID = path.replace('/browsebyfighter','')
log("fighterID:%s" % fighterID)
if fighterID == '':
## populate list of fighters
xbmcplugin.addSortMethod(__addonidint__, xbmcplugin.SORT_METHOD_EPISODE)
xbmcplugin.addSortMethod(__addonidint__, xbmcplugin.SORT_METHOD_DATE)
xbmcplugin.addSortMethod(__addonidint__, xbmcplugin.SORT_METHOD_VIDEO_TITLE)
browseByFighter()
## finish adding items to list and display
xbmcplugin.endOfDirectory(__addonidint__)
else:
## populate list of all events a given fighter has fought in
xbmcplugin.addSortMethod(__addonidint__, xbmcplugin.SORT_METHOD_DATE)
xbmcplugin.addSortMethod(__addonidint__, xbmcplugin.SORT_METHOD_VIDEO_TITLE)
getEventsByFighter(fighterID.lstrip('/'))
## finish adding items to list and display
xbmcplugin.endOfDirectory(__addonidint__)
elif path == "/allevents":
## populate list of all events
xbmcplugin.addSortMethod(__addonidint__, xbmcplugin.SORT_METHOD_DATE)
xbmcplugin.addSortMethod(__addonidint__, xbmcplugin.SORT_METHOD_VIDEO_TITLE)
allEvents()
## finish adding items to list and display
xbmcplugin.endOfDirectory(__addonidint__)
elif path == "/search":
## populate list of all events
searchAll()
## finish adding items to list and display
xbmcplugin.endOfDirectory(__addonidint__)
elif path == "/update":
## populate list of all events
updateLibrary()
elif path.startswith("/getEvent/"):
eventID = path.replace('/getEvent/','')
## populate list of all video files for a given event
getEvent(eventID)
## finish adding items to list and display
xbmcplugin.endOfDirectory(__addonidint__)