def playback_started(self, data): self._current_video = data['item'] if self._current_video != None: if 'type' in self._current_video and 'id' in self._current_video: Debug("[Scrobbler] Watching: "+self._current_video['type']+" - "+str(self._current_video['id'])) try: if not xbmc.Player().isPlayingVideo(): Debug("[Scrobbler] Suddenly stopped watching item") return time.sleep(1) # Wait for possible silent seek (caused by resuming) self._watched_time = xbmc.Player().getTime() self._total_time = xbmc.Player().getTotalTime() if self._total_time == 0: if self._current_video['type'] == 'movie': self._total_time = 90 elif self._current_video['type'] == 'episode': self._total_time = 30 else: self._total_time = 1 self._playlist_length = utilities.getPlaylistLengthFromXBMCPlayer(data['player']['playerid']) if (self._playlist_length == 0): Debug("[Scrobbler] Warning: Cant find playlist length?!, assuming that this item is by itself") self._playlist_length = 1 except: Debug("[Scrobbler] Suddenly stopped watching item, or error: " + str(sys.exc_info()[0])) self._current_video = None self._start_time = 0 return self._start_time = time.time() self._started_watching() self._pinging = True else: self._current_video = None self._start_time = 0
def playbackStarted(self, data): Debug("[Scrobbler] playbackStarted(data: %s)" % data) if self.curVideo != None and self.curVideo != data['item']: self.playbackEnded() self.curVideo = data['item'] self.curVideoData = data if self.curVideo != None: # {"jsonrpc":"2.0","method":"Player.OnPlay","params":{"data":{"item":{"type":"movie"},"player":{"playerid":1,"speed":1},"title":"Shooter","year":2007},"sender":"xbmc"}} # {"jsonrpc":"2.0","method":"Player.OnPlay","params":{"data":{"episode":3,"item":{"type":"episode"},"player":{"playerid":1,"speed":1},"season":4,"showtitle":"24","title":"9:00 A.M. - 10:00 A.M."},"sender":"xbmc"}} if 'type' in self.curVideo: #and 'id' in self.curVideo: Debug("[Scrobbler] Watching: " + self.curVideo['type']) #+" - "+str(self.curVideo['id'])) try: if not xbmc.Player().isPlayingVideo(): Debug("[Scrobbler] Suddenly stopped watching item") return time.sleep(1) # Wait for possible silent seek (caused by resuming) self.watchedTime = xbmc.Player().getTime() self.totalTime = xbmc.Player().getTotalTime() if self.totalTime == 0: if self.curVideo['type'] == 'movie': self.totalTime = 90 elif self.curVideo['type'] == 'episode': self.totalTime = 30 else: self.totalTime = 1 #self.playlistLength = utilities.getPlaylistLengthFromXBMCPlayer(data['player']['playerid']) # playerid 1 is video. self.playlistLength = utilities.getPlaylistLengthFromXBMCPlayer(1) if (self.playlistLength == 0): Debug("[Scrobbler] Warning: Cant find playlist length?!, assuming that this item is by itself") self.playlistLength = 1 if self.curVideo["type"] == "episode": if self.curVideo.has_key("multi_episode_count"): self.markedAsWatched = [] episode_count = self.curVideo["multi_episode_count"] for i in range(episode_count): self.markedAsWatched.append(False) except Exception, e: Debug("[Scrobbler] Suddenly stopped watching item, or error: %s" % e.message) self.curVideo = None self.startTime = 0 return self.startTime = time.time() self.watching() self.pinging = True else: self.curVideo = None self.startTime = 0
def playbackStarted(self, data): if self.curVideo != None and self.curVideo != data['item']: self.playbackEnded() self.curVideo = data['item'] self.curVideoData = data if self.curVideo != None: # {"jsonrpc":"2.0","method":"Player.OnPlay","params":{"data":{"item":{"type":"movie"},"player":{"playerid":1,"speed":1},"title":"Shooter","year":2007},"sender":"xbmc"}} # {"jsonrpc":"2.0","method":"Player.OnPlay","params":{"data":{"episode":3,"item":{"type":"episode"},"player":{"playerid":1,"speed":1},"season":4,"showtitle":"24","title":"9:00 A.M. - 10:00 A.M."},"sender":"xbmc"}} if 'type' in self.curVideo: #and 'id' in self.curVideo: Debug("[Scrobbler] Watching: " + self.curVideo['type']) #+" - "+str(self.curVideo['id'])) try: if not xbmc.Player().isPlayingVideo(): Debug("[Scrobbler] Suddenly stopped watching item") return time.sleep( 1 ) # Wait for possible silent seek (caused by resuming) self.watchedTime = xbmc.Player().getTime() self.totalTime = xbmc.Player().getTotalTime() if self.totalTime == 0: if self.curVideo['type'] == 'movie': self.totalTime = 90 elif self.curVideo['type'] == 'episode': self.totalTime = 30 else: self.totalTime = 1 self.playlistLength = utilities.getPlaylistLengthFromXBMCPlayer( data['player']['playerid']) if (self.playlistLength == 0): Debug( "[Scrobbler] Warning: Cant find playlist length?!, assuming that this item is by itself" ) self.playlistLength = 1 except: Debug( "[Scrobbler] Suddenly stopped watching item, or error: " + str(sys.exc_info()[0])) self.curVideo = None self.startTime = 0 return self.startTime = time.time() self.startedWatching() self.pinging = True else: self.curVideo = None self.startTime = 0
def playbackStarted(self, data): if self.curVideo != None and self.curVideo != data['item']: self.playbackEnded() self.curVideo = data['item'] self.curVideoData = data if self.curVideo != None: # {"jsonrpc":"2.0","method":"Player.OnPlay","params":{"data":{"item":{"type":"movie"},"player":{"playerid":1,"speed":1},"title":"Shooter","year":2007},"sender":"xbmc"}} # {"jsonrpc":"2.0","method":"Player.OnPlay","params":{"data":{"episode":3,"item":{"type":"episode"},"player":{"playerid":1,"speed":1},"season":4,"showtitle":"24","title":"9:00 A.M. - 10:00 A.M."},"sender":"xbmc"}} if 'type' in self.curVideo: #and 'id' in self.curVideo: Debug("[Scrobbler] Watching: "+self.curVideo['type']) #+" - "+str(self.curVideo['id'])) try: if not xbmc.Player().isPlayingVideo(): Debug("[Scrobbler] Suddenly stopped watching item") return time.sleep(1) # Wait for possible silent seek (caused by resuming) self.watchedTime = xbmc.Player().getTime() self.totalTime = xbmc.Player().getTotalTime() if self.totalTime == 0: if self.curVideo['type'] == 'movie': self.totalTime = 90 elif self.curVideo['type'] == 'episode': self.totalTime = 30 else: self.totalTime = 1 self.playlistLength = utilities.getPlaylistLengthFromXBMCPlayer(data['player']['playerid']) if (self.playlistLength == 0): Debug("[Scrobbler] Warning: Cant find playlist length?!, assuming that this item is by itself") self.playlistLength = 1 except: Debug("[Scrobbler] Suddenly stopped watching item, or error: "+str(sys.exc_info()[0])) self.curVideo = None self.startTime = 0 return self.startTime = time.time() self.startedWatching() self.pinging = True else: self.curVideo = None self.startTime = 0