def onPlayBackStarted(self): if not self.onplay_lock: self.onplay_lock = True #print "Locking playback routine to block multiple calls +++++++++++++++++++" self.win.sync_playlist_pos() pos = self.playlist.getposition() self.now_playing['pos'] = pos print "OnPlaybackStarted: Playing track " + str(pos + 1) self.win.sync_playlist_pos() pos2 = self.playlist.getposition() if pos != pos2: print "Oh wait! We're not playing track " + str(pos + 1) + "!" print "Playing track " + str(pos2 + 1) print "There, fixed it for ya. " self.now_playing['pos'] = pos2 thread.start_new_thread(self.notify.report_playback, (self, self.api)) # update listening history if current view if self.win.getProperty('browseview') == "history_tracks": self.app.hist_tracks.build() print "OnPlaybackStarted: rebuilt history tracklist" view.draw_mainwin(self.win, self.app) xbmc.sleep(20) if self.check_session == True: thread.start_new_thread(self.validate_session, (self, self.session)) self.check_session = True self.onplay_lock = False else: #print "--------- blocked an extra play action from XBMC --------" pass
def onPlayBackStarted(self): if not self.onplay_lock: self.onplay_lock = True #print "Locking playback routine to block multiple calls +++++++++++++++++++" self.win.sync_playlist_pos() pos = self.playlist.getposition() self.now_playing['pos'] = pos print "OnPlaybackStarted: Playing track "+str(pos+1) self.win.sync_playlist_pos() pos2 = self.playlist.getposition() if pos != pos2: print "Oh wait! We're not playing track "+str(pos+1)+"!" print "Playing track "+str(pos2+1) print "There, fixed it for ya. " self.now_playing['pos'] = pos2 thread.start_new_thread(self.notify.report_playback, (self, self.api)) # update listening history if current view if self.win.getProperty('browseview') == "history_tracks": self.app.hist_tracks.build() print "OnPlaybackStarted: rebuilt history tracklist" view.draw_mainwin(self.win, self.app) xbmc.sleep(20) if self.check_session == True: thread.start_new_thread(self.validate_session, (self, self.session) ) self.check_session = True self.onplay_lock = False else: #print "--------- blocked an extra play action from XBMC --------" pass
def onPlayBackStopped(self): print "onPlaybackStopped was detected!" thread.start_new_thread(self.notify.report_playback, (self, self.api)) #update listening history if current view if self.win.getProperty('browseview') == "history_tracks": self.app.hist_tracks.build() print "OnPlaybackStopped: rebuilt history tracklist" view.draw_mainwin(self.win, self.app)