-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdefault.py
More file actions
76 lines (65 loc) · 2.28 KB
/
Copy pathdefault.py
File metadata and controls
76 lines (65 loc) · 2.28 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
import xbmc
import xbmcplugin
import urllib
import sys
import buggalo
buggalo.GMAIL_RECIPIENT = "chazup@gmail.com"
try:
from lib.collecamendations import *
try:
import StorageServer
except:
import lib.storageserverdummy as StorageServer
cache = StorageServer.StorageServer("collecamendations", 8) # (Your plugin name, Cache time in hours
def getParameters():
param=[]
try:
paramstring=sys.argv[2]
if len(paramstring)>=2:
params=sys.argv[2]
cleanedparams=params.replace('?','')
if (params[len(params)-1]=='/'):
params=params[0:len(params)-2]
pairsofparams=cleanedparams.split('&')
param={}
for i in range(len(pairsofparams)):
splitparams={}
splitparams=pairsofparams[i].split('=')
if (len(splitparams))==2:
param[splitparams[0]]=splitparams[1]
return param
except:
return param
base_image_url = get_tmdb_configuration() + "original"
imdb_ids = get_xbmc_movies()
collections = cache.cacheFunction(organize_movies_by_collections,imdb_ids)
# Initialize URL parameters
id = None
name = None
menu_number = None
params = getParameters()
# Parse internal URL
try:
id = urllib.unquote_plus(params["id"])
except:
pass
try:
name = urllib.unquote_plus(params["name"])
except:
pass
try:
menu_number = int(params["mode"])
except:
pass
# Open directories based on selection
if menu_number == None:
display_collection_menu(collections)
elif menu_number == 1:
display_missing_movies(collections[id])
elif menu_number == 2:
trailer = get_trailer_from_tmdb(id)
url = "plugin://plugin.video.youtube/?path=/root/video&action=play_video&videoid=%s" % trailer
xbmc.Player(xbmc.PLAYER_CORE_MPLAYER).play(url)
xbmcplugin.endOfDirectory(int(sys.argv[1]))
except:
buggalo.onExceptionRaised()