3 |
|
|
4 |
''' |
''' |
5 |
Todic plugin for XBMC |
Todic plugin for XBMC |
6 |
Version 0.0.15 |
Version 0.0.17 |
7 |
''' |
''' |
8 |
|
|
9 |
import sys |
import sys |
20 |
# import pprint |
# import pprint |
21 |
|
|
22 |
from xml.dom.minidom import parseString |
from xml.dom.minidom import parseString |
23 |
|
from time import time |
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() |
100 |
xbmc.Player.__init__(self, xbmc.PLAYER_CORE_MPLAYER) |
xbmc.Player.__init__(self, xbmc.PLAYER_CORE_MPLAYER) |
101 |
self.stopped = False |
self.stopped = False |
102 |
self.started = False |
self.started = False |
103 |
|
self.playingPosition = 0.0 |
104 |
|
self.lastReport = 0 |
105 |
print "[TodicPlayer] init" |
print "[TodicPlayer] init" |
106 |
|
|
107 |
# @catchall |
# @catchall |
110 |
print "[TodicPlayer] : started" |
print "[TodicPlayer] : started" |
111 |
# super.onPlayBackStarted() |
# super.onPlayBackStarted() |
112 |
|
|
113 |
|
#When user presses stop, we report back the the position registered in the last call to self.tick() |
114 |
def onPlayBackStopped(self): |
def onPlayBackStopped(self): |
115 |
self.stopped = True |
self.stopped = True |
116 |
print "[TodicPlayer] : stopped" |
print "[TodicPlayer] : stopped" |
117 |
|
url = __backend__ + "&action=playbacktime&subaction=stopped&time=" + str( self.playingPosition ) |
118 |
|
open_url(url) |
119 |
|
|
120 |
|
|
121 |
def onPlayBackEnded(self): |
def onPlayBackEnded(self): |
122 |
self.stopped = True |
self.stopped = True |
123 |
print "[TodicPlayer] : ended" |
print "[TodicPlayer] : ended" |
124 |
|
url = __backend__ + "&action=playbacktime&subaction=ended&time=" |
125 |
|
open_url(url) |
126 |
|
|
127 |
def callbackLoop(self): |
def tick(self): |
128 |
print "[Todic] startLoop" |
if ( self.isPlaying() ): |
129 |
while (self.stopped == False): |
self.playingPosition = self.getTime() |
130 |
if (self.started == True): |
now = time() |
131 |
print "[todic] " + str(self.getTime()) |
#print "[Todic] tick " + str(now) + " " + str(self.lastReport) + " : " +str(now - self.lastReport) |
132 |
xbmc.sleep(5000) |
if ( (now - self.lastReport) > 60.0): |
133 |
|
self.reportPlaytime() |
134 |
|
self.lastReport = now |
135 |
|
|
136 |
|
|
137 |
|
|
138 |
|
def reportPlaytime(self): |
139 |
|
url = __backend__ + "&action=playbacktime&subaction=playing&time=" + str( self.playingPosition ) |
140 |
|
open_url(url) |
141 |
|
print "[Todic] reportPlaytime:" + url |
142 |
|
|
143 |
|
|
144 |
|
|
145 |
def getText2(nodelist): |
def getText2(nodelist): |
319 |
else: |
else: |
320 |
player.disableSubtitles() |
player.disableSubtitles() |
321 |
|
|
322 |
|
#Holder python kørernde indtil at det bliver bedt om at stoppe |
323 |
|
while (not xbmc.abortRequested): |
324 |
|
player.tick() |
325 |
|
xbmc.sleep(100) |
326 |
|
|
327 |
|
|
328 |
|
|
329 |
# player.callbackLoop() |
# player.callbackLoop() |
330 |
|
|
331 |
|
|