3 |
|
|
4 |
''' |
''' |
5 |
Todic plugin for XBMC |
Todic plugin for XBMC |
6 |
Version 0.0.14 |
Version 0.0.15 |
7 |
''' |
''' |
8 |
|
|
9 |
import sys |
import sys |
18 |
import urllib |
import urllib |
19 |
import urllib2 |
import urllib2 |
20 |
|
|
21 |
|
#import pprint |
22 |
|
|
23 |
from xml.dom.minidom import parseString |
from xml.dom.minidom import parseString |
24 |
|
|
25 |
__addon__ = xbmcaddon.Addon(id='plugin.video.todic') |
__addon__ = xbmcaddon.Addon(id='plugin.video.todic') |
26 |
__key__ = __addon__.getSetting('xbmckey').lower() |
__key__ = __addon__.getSetting('xbmckey').lower() |
27 |
__backend__ = "http://todic.dk/xbmc.php?xbmckey=" + __key__ |
__backend__ = "http://todic.dk/xbmc.php?xbmckey=" + __key__ |
28 |
fanartImage = os.path.join(__addon__.getAddonInfo('path'), 'fanart.jpg') |
fanartImage = os.path.join(__addon__.getAddonInfo('path'), 'movie_bg_blur.jpg') |
29 |
datapath = xbmc.translatePath('special://profile/addon_data/plugin.video.todic/') |
datapath = xbmc.translatePath('special://profile/addon_data/plugin.video.todic/') |
30 |
|
|
31 |
ADDON_PATH = __addon__.getAddonInfo('path') |
ADDON_PATH = __addon__.getAddonInfo('path') |
56 |
|
|
57 |
print "ONINIT" |
print "ONINIT" |
58 |
self.getControl( 1 ).setLabel( self.name); |
self.getControl( 1 ).setLabel( self.name); |
59 |
self.getControl( 2 ).setLabel( self.description ); |
self.getControl( 2 ).setLabel( self.moviegroups ) |
60 |
|
self.getControl( 3 ).setLabel( self.description ) |
61 |
|
self.getControl( 10 ).setLabel( self.playlength ) |
62 |
|
self.getControl( 11 ).setLabel( self.codecdetails ) |
63 |
|
|
64 |
|
|
65 |
|
|
66 |
|
orig_img_width = self.getControl(40).getWidth() |
67 |
|
self.starwidth = ( float(self.imdbrating) / 10.0) * orig_img_width; |
68 |
|
self.getControl(40).setWidth( int(self.starwidth) ) |
69 |
|
|
70 |
def setUrl( self, url): |
def setUrl( self, url): |
71 |
|
print "SETURL:" + url |
72 |
self.url = url |
self.url = url |
73 |
|
self.fetchClipDetails() |
74 |
|
|
75 |
|
|
76 |
|
def fetchClipDetails(self): |
77 |
|
param1 = parse_parameter_string( self.url ) |
78 |
|
|
79 |
|
self.clipkey = param1[ "clipkey" ] |
80 |
|
print "CLIPKEY:" + self.clipkey |
81 |
|
detailurl = __backend__ + "&action=clipdetails&clipkey=" + self.clipkey |
82 |
|
|
83 |
|
xml = open_url(detailurl) |
84 |
|
|
85 |
|
doc = parseString(xml) |
86 |
|
self.imdbrating = getText( doc.getElementsByTagName("imdbrating") ) |
87 |
|
self.moviegroups = getText( doc.getElementsByTagName("moviegroups") ) |
88 |
|
self.playlength = getText( doc.getElementsByTagName("playlength") ) |
89 |
|
self.codecdetails = getText( doc.getElementsByTagName("codecdetails") ) |
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
def setName( self, name ): |
def setName( self, name ): |
96 |
self.name = name |
self.name = name |
361 |
|
|
362 |
|
|
363 |
def get_params(): |
def get_params(): |
364 |
|
return parse_parameter_string( sys.argv[2] ) |
365 |
|
|
366 |
|
def parse_parameter_string( paramstring ): |
367 |
param=[] |
param=[] |
|
paramstring=sys.argv[2] |
|
368 |
if len(paramstring)>=2: |
if len(paramstring)>=2: |
369 |
params=sys.argv[2] |
params = paramstring |
370 |
cleanedparams=params.replace('?','') |
cleanedparams=params.replace('?','') |
371 |
if (params[len(params)-1]=='/'): |
if (params[len(params)-1]=='/'): |
372 |
params=params[0:len(params)-2] |
params=params[0:len(params)-2] |