/[projects]/misc/xbmc/plugin.video.todic/default.py
ViewVC logotype

Diff of /misc/xbmc/plugin.video.todic/default.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3141 by torben, Mon May 30 20:26:56 2016 UTC revision 3142 by torben, Mon Nov 21 22:18:33 2016 UTC
# Line 3  Line 3 
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
# Line 20  import urllib2 Line 20  import urllib2
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()
# Line 99  class TodicPlayer(xbmc.Player): Line 100  class TodicPlayer(xbmc.Player):
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
# Line 107  class TodicPlayer(xbmc.Player): Line 110  class TodicPlayer(xbmc.Player):
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):
# Line 300  def play_real_video(url, name): Line 319  def play_real_video(url, name):
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    

Legend:
Removed from v.3141  
changed lines
  Added in v.3142

  ViewVC Help
Powered by ViewVC 1.1.20