3 |
|
|
4 |
''' |
''' |
5 |
Todic plugin for XBMC |
Todic plugin for XBMC |
6 |
Version 1.7.3 |
Version 1.8.2 |
7 |
''' |
''' |
8 |
|
|
9 |
import sys |
import sys |
27 |
__entrypoint__ = __addon__.getSetting('entrypoint').lower() |
__entrypoint__ = __addon__.getSetting('entrypoint').lower() |
28 |
__backend__ = "https://todic.dk/xbmc.php?xbmckey=" + __key__ |
__backend__ = "https://todic.dk/xbmc.php?xbmckey=" + __key__ |
29 |
|
|
30 |
|
|
31 |
if __entrypoint__ == "alternative": |
if __entrypoint__ == "alternative": |
32 |
__backend__ = "https://alt.todic.dk/xbmc.php?xbmckey=" + __key__ |
__backend__ = "https://alt.todic.dk/xbmc.php?xbmckey=" + __key__ |
33 |
|
|
36 |
|
|
37 |
print( "[Todic] entrypoint: " + __entrypoint__ ) |
print( "[Todic] entrypoint: " + __entrypoint__ ) |
38 |
print( "[Todic] backend: " + __backend__ ) |
print( "[Todic] backend: " + __backend__ ) |
39 |
|
print( "[Todic] version: " + __addon__.getAddonInfo('version') ) |
40 |
|
|
41 |
fanartImage = os.path.join(__addon__.getAddonInfo('path'), 'movie_bg_blur.jpg') |
fanartImage = os.path.join(__addon__.getAddonInfo('path'), 'movie_bg_blur.jpg') |
42 |
datapath = xbmc.translatePath( |
datapath = xbmc.translatePath( |
215 |
|
|
216 |
|
|
217 |
def rootMenu(): |
def rootMenu(): |
218 |
|
kodi_ver = xbmc.getInfoLabel('System.BuildVersion') |
219 |
|
plugin_ver = __addon__.getAddonInfo('version') |
220 |
|
msgurl = __backend__ + "&action=messages&kodi=" + urllib.quote_plus(kodi_ver) + "&todicplugin=" + urllib.quote_plus(plugin_ver) |
221 |
|
|
222 |
msg = open_url(__backend__ + "&action=messages") |
msg = open_url(msgurl) |
223 |
msg = msg.strip() |
msg = msg.strip() |
224 |
|
|
225 |
if msg != "": |
if msg != "": |
282 |
# print "url:" + url |
# print "url:" + url |
283 |
# print "thumb:" + thumb |
# print "thumb:" + thumb |
284 |
listitem = xbmcgui.ListItem( |
listitem = xbmcgui.ListItem( |
285 |
label=name, label2='test', iconImage='DefaultFolder.png', thumbnailImage=thumb) |
label=name, label2='test', iconImage='DefaultFolder.png') |
286 |
listitem.setProperty('Fanart_Image', fanartImage) |
listitem.setProperty('Fanart_Image', fanartImage) |
287 |
listitem.addContextMenuItems([('Refresh', 'Container.Refresh')]) |
listitem.addContextMenuItems([('Refresh', 'Container.Refresh')]) |
288 |
|
listitem.setArt( {'thumb': thumb} ) |
289 |
|
|
290 |
if mode == '50': |
if mode == '50': |
291 |
infoLabels = {} |
infoLabels = {} |
292 |
infoLabels['title'] = name |
infoLabels['title'] = name |
293 |
infoLabels['playcount'] = playcount |
infoLabels['playcount'] = playcount |
294 |
|
# if playcount > 0: |
295 |
|
# listitem.setArt( {'thumb': thumb} ) #not pretty - but at least we can show a different icon for unwatched/watched in kodi18 |
296 |
listitem.setInfo('video', infoLabels) |
listitem.setInfo('video', infoLabels) |
297 |
|
|
298 |
name = name.encode('UTF-8') |
name = name.encode('UTF-8') |
364 |
listitem = xbmcgui.ListItem( |
listitem = xbmcgui.ListItem( |
365 |
label=name, iconImage='DefaultVideo.png', thumbnailImage=image) |
label=name, iconImage='DefaultVideo.png', thumbnailImage=image) |
366 |
listitem.setInfo(type="Video", infoLabels={"Title": name}) |
listitem.setInfo(type="Video", infoLabels={"Title": name}) |
367 |
listitem.setProperty('ResumeTime', '300') |
|
368 |
listitem.setProperty('TotalTime', '3000') |
listitem.setProperty('StartOffset', str(position) ) |
369 |
|
|
370 |
if len(subtitleurl) > 0: |
if len(subtitleurl) > 0: |
371 |
listitem.setSubtitles([subtitleurl]) |
listitem.setSubtitles([subtitleurl]) |
373 |
player = TodicPlayer() |
player = TodicPlayer() |
374 |
player.play(str(url), listitem) |
player.play(str(url), listitem) |
375 |
|
|
|
# kan ikke loade subtitles hvis foerend playeren koerer |
|
|
count = 0 |
|
|
while not xbmc.Player().isPlaying(): |
|
|
xbmc.sleep(250) |
|
|
count += 1 |
|
|
if count > 10: |
|
|
break |
|
|
|
|
|
|
|
|
|
|
|
if xbmc.Player().isPlaying(): |
|
|
|
|
|
if (position > 0): |
|
|
while (player.getTotalTime() == 0.0): #Vent indtil vi har beregnet hvor langt klippet er |
|
|
xbmc.sleep(250) |
|
|
|
|
|
print( "[Todic] totalTime " + str( player.getTotalTime() )) |
|
|
player.seekTime(position) |
|
|
|
|
376 |
|
|
377 |
#Holder python kørernde indtil at det bliver bedt om at stoppe |
#Holder python kørernde indtil at det bliver bedt om at stoppe |
378 |
while (not xbmc.abortRequested): |
while (not xbmc.abortRequested): |