3 |
|
|
4 |
''' |
''' |
5 |
Todic plugin for XBMC |
Todic plugin for XBMC |
6 |
Version 0.1.1 |
Version 0.1.3 |
7 |
''' |
''' |
8 |
|
|
9 |
import sys |
import sys |
119 |
print "[TodicPlayer] : stopped" |
print "[TodicPlayer] : stopped" |
120 |
self.reportPlaytime("stopped") |
self.reportPlaytime("stopped") |
121 |
|
|
122 |
|
def onPlayBackPaused(self): |
123 |
|
print "[TodicPlayer] : paused" |
124 |
|
self.reportPlaytime("paused") |
125 |
|
|
126 |
|
def onPlayBackResumed(self): |
127 |
|
print "[TodicPlayer] : resumed" |
128 |
|
self.reportPlaytime("resumed") |
129 |
|
|
130 |
|
|
131 |
def onPlayBackEnded(self): |
def onPlayBackEnded(self): |
134 |
self.reportPlaytime("ended") |
self.reportPlaytime("ended") |
135 |
|
|
136 |
def tick(self): |
def tick(self): |
137 |
|
#print "[Todic] Tick: " + str( self.isPlaying() ) |
138 |
if ( self.isPlaying() ): |
if ( self.isPlaying() ): |
139 |
self.playingPosition = self.getTime() |
self.playingPosition = self.getTime() |
140 |
now = time() |
now = time() |
193 |
try: |
try: |
194 |
return open_url(url) |
return open_url(url) |
195 |
except: |
except: |
196 |
print "[Todic ]Some error during open_url call to ", url |
print "[Todic] Some error during open_url call to ", url |
197 |
|
|
198 |
|
|
199 |
|
|
210 |
|
|
211 |
# Adde xtra items to root menu |
# Adde xtra items to root menu |
212 |
listitem = xbmcgui.ListItem( |
listitem = xbmcgui.ListItem( |
213 |
label="Søg film ...", iconImage='DefaultFolder.png', thumbnailImage='DefaultFolder.png') |
label="Søg Film ...", iconImage='DefaultFolder.png', thumbnailImage='DefaultFolder.png') |
214 |
listitem.setProperty('Fanart_Image', fanartImage) |
listitem.setProperty('Fanart_Image', fanartImage) |
215 |
|
|
216 |
u = sys.argv[0] + "?mode=10&name=" |
u = sys.argv[0] + "?mode=10&name=" |
230 |
|
|
231 |
|
|
232 |
def buildList(url, title, endlist=True): |
def buildList(url, title, endlist=True): |
233 |
print '[TODIC]:' + str(url) |
print '[Todic]:' + str(url) |
234 |
|
|
235 |
link = open_url(url) |
link = open_url(url) |
236 |
doc = parseString(link) |
doc = parseString(link) |
237 |
ty = doc.getElementsByTagName("meta")[0].getAttribute("type") |
ty = doc.getElementsByTagName("meta")[0].getAttribute("type") |
238 |
print '[TODIC]' + str(ty) |
print '[Todic]' + str(ty) |
239 |
|
|
240 |
if ty == 'clipList': |
if ty == 'clipList': |
241 |
mode = '50' |
mode = '50' |
286 |
|
|
287 |
|
|
288 |
def play_video(url, name, description): |
def play_video(url, name, description): |
289 |
param1 = parse_parameter_string(url) |
playPosition = 0 |
290 |
clipkey = param1["clipkey"] |
savedPosition = 0 |
291 |
|
try: |
292 |
|
param1 = parse_parameter_string(url) |
293 |
|
clipkey = param1["clipkey"] |
294 |
|
|
295 |
print "[Todic] ClipKey:" + clipkey |
print "[Todic] ClipKey:" + clipkey |
296 |
detailurl = __backend__ + "&action=clipdetails&clipkey=" + clipkey |
detailurl = __backend__ + "&action=clipdetails&clipkey=" + clipkey |
297 |
print "[Todic] detailURL = " + detailurl |
print "[Todic] detailURL = " + detailurl |
298 |
|
|
299 |
xml = open_url(detailurl) |
xml = open_url(detailurl) |
300 |
|
|
301 |
clipDetailsDoc = parseString(xml) |
clipDetailsDoc = parseString(xml) |
302 |
savedPosition = int( getText(clipDetailsDoc.getElementsByTagName("position")) ) |
savedPosition = int( getText(clipDetailsDoc.getElementsByTagName("position")) ) |
303 |
playPosition = 0 |
except: |
304 |
|
print "[Todic] Unexpected error:", sys.exc_info()[0] |
305 |
|
|
306 |
if (description == None or description == ""): |
if (description == None or description == ""): |
307 |
if (savedPosition > 0): |
if (savedPosition > 0): |
308 |
dialog = xbmcgui.Dialog() |
dialog = xbmcgui.Dialog() |
309 |
#yes / true -afspil fra position |
#yes / true -afspil fra position |
310 |
answer = dialog.yesno(heading='Todic', line1='Afspil fra gemt', nolabel='Fra start', yeslabel='Fortsæt') |
answer = dialog.yesno(heading='Todic', line1='Afspil fra sidste position', nolabel='Fra start', yeslabel='Fortsæt') |
311 |
if (answer == True): |
if (answer == True): |
312 |
playPosition = savedPosition |
playPosition = savedPosition |
313 |
|
|
339 |
if os.path.isfile(subtitlesfile): |
if os.path.isfile(subtitlesfile): |
340 |
os.unlink(subtitlesfile) |
os.unlink(subtitlesfile) |
341 |
|
|
342 |
print '[TODIC] subs: ' + str(subtitleurl) |
print '[Todic] subs: ' + str(subtitleurl) |
343 |
if len(subtitleurl) > 0: |
if len(subtitleurl) > 0: |
344 |
subtitles = open_url(subtitleurl) |
subtitles = open_url(subtitleurl) |
345 |
SaveFile(subtitlesfile, subtitles) |
SaveFile(subtitlesfile, subtitles) |
346 |
print 'TODIC downloaded subtitles' |
print '[Todic] downloaded subtitles' |
347 |
|
|
348 |
image = xbmc.getInfoImage('ListItem.Thumb') |
image = xbmc.getInfoImage('ListItem.Thumb') |
349 |
listitem = xbmcgui.ListItem( |
listitem = xbmcgui.ListItem( |
368 |
if xbmc.Player().isPlaying(): |
if xbmc.Player().isPlaying(): |
369 |
if os.path.isfile(subtitlesfile): |
if os.path.isfile(subtitlesfile): |
370 |
player.setSubtitles(subtitlesfile) |
player.setSubtitles(subtitlesfile) |
371 |
print 'TODIC started subtitles' |
print '[Todic] started subtitles' |
372 |
else: |
else: |
373 |
player.disableSubtitles() |
player.disableSubtitles() |
374 |
|
|
395 |
url = __backend__ + "&action=search&search=" + \ |
url = __backend__ + "&action=search&search=" + \ |
396 |
urllib.quote_plus(search) |
urllib.quote_plus(search) |
397 |
|
|
398 |
# print "[TODIC] Search start: " + search |
# print "[Todic] Search start: " + search |
399 |
# print "[TODIC] Search url: " + url |
# print "[Todic] Search url: " + url |
400 |
|
|
401 |
buildList(url, "søgning") |
buildList(url, "søgning") |
402 |
|
|
408 |
url = __backend__ + "&action=searchseries&search=" + \ |
url = __backend__ + "&action=searchseries&search=" + \ |
409 |
urllib.quote_plus(search) |
urllib.quote_plus(search) |
410 |
|
|
411 |
# print "[TODIC] Search start: " + search |
# print "[Todic] Search start: " + search |
412 |
# print "[TODIC] Search url: " + url |
# print "[Todic] Search url: " + url |
413 |
|
|
414 |
buildList(url, "serie søgning") |
buildList(url, "serie søgning") |
415 |
|
|