コード例 #1
0
    def _forward(self, notification):
        """ Fowards the notification recieved to a function on the scrobbler """
        if not ('method' in notification and 'params' in notification
                and 'sender' in notification['params']
                and notification['params']['sender'] == 'xbmc'):
            return

        if notification['method'] == 'Player.OnStop':
            self._scrobbler.playbackEnded()
        elif notification['method'] == 'Player.OnPlay':
            if 'data' in notification['params'] and 'item' in notification[
                    'params']['data'] and 'type' in notification['params'][
                        'data']['item']:
                self._scrobbler.playbackStarted(notification['params']['data'])
        elif notification['method'] == 'Player.OnPause':
            self._scrobbler.playbackPaused()
        elif notification['method'] == 'VideoLibrary.OnScanFinished':
            if do_sync('movies'):
                movies = SyncMovies(show_progress=False)
                movies.Run()
            if do_sync('episodes'):
                episodes = SyncEpisodes(show_progress=False)
                episodes.Run()
        elif notification['method'] == 'System.OnQuit':
            self._abortRequested = True
コード例 #2
0
	def _dispatch(self, data):
		Debug("[Notification] Dispatch: %s" % data)
		xbmc.sleep(500)
		
		# check if scrobbler thread is still alive
		if not self._scrobbler.isAlive():

			if self.Player._playing and not self._scrobbler.pinging:
				# make sure pinging is set
				self._scrobbler.pinging = True

			Debug("[Notification] Scrobler thread died, restarting.")
			self._scrobbler.start()
		
		action = data["action"]
		if action == "started":
			del data["action"]
			p = {"item": data}
			self._scrobbler.playbackStarted(p)
		elif action == "ended" or action == "stopped":
			self._scrobbler.playbackEnded()
		elif action == "paused":
			self._scrobbler.playbackPaused()
		elif action == "resumed":
			self._scrobbler.playbackResumed()
		elif action == "seek" or action == "seekchapter":
			self._scrobbler.playbackSeek()
		elif action == "databaseUpdated":
			if do_sync('movies'):
				movies = SyncMovies(show_progress=False, api=globals.traktapi)
				movies.Run()
			if do_sync('episodes'):
				episodes = SyncEpisodes(show_progress=False, api=globals.traktapi)
				episodes.Run()
		elif action == "scanStarted":
			pass
		elif action == "settingsChanged":
			Debug("[Notification] Settings changed, reloading.")
			globals.traktapi.updateSettings()
		else:
			Debug("[Notification] '%s' unknown dispatch action!" % action)
コード例 #3
0
	def _forward(self, notification):
		""" Fowards the notification recieved to a function on the scrobbler """
		if not ('method' in notification and 'params' in notification and 'sender' in notification['params'] and notification['params']['sender'] == 'xbmc'):
			return

		if notification['method'] == 'Player.OnStop':
			self._scrobbler.playbackEnded()
		elif notification['method'] == 'Player.OnPlay':
			if 'data' in notification['params'] and 'item' in notification['params']['data'] and 'type' in notification['params']['data']['item']:
				self._scrobbler.playbackStarted(notification['params']['data'])
		elif notification['method'] == 'Player.OnPause':
			self._scrobbler.playbackPaused()
		elif notification['method'] == 'VideoLibrary.OnScanFinished':
			if do_sync('movies'):
				movies = SyncMovies(show_progress=False)
				movies.Run()
			if do_sync('episodes'):
				episodes = SyncEpisodes(show_progress=False)
				episodes.Run()
		elif notification['method'] == 'System.OnQuit':
			self._abortRequested = True
コード例 #4
0
	def _dispatch(self, data):
		Debug("[Notification] Dispatch: %s" % data)
		xbmc.sleep(500)
		action = data["action"]
		if action == "started":
			p = {"item": {"type": data["type"], "id": data["id"]}}
			self._scrobbler.playbackStarted(p)
		elif action == "ended" or action == "stopped":
			self._scrobbler.playbackEnded()
		elif action == "paused":
			self._scrobbler.playbackPaused()
		elif action == "resumed":
			self._scrobbler.playbackResumed()
		elif action == "databaseUpdated":
			if do_sync('movies'):
				movies = SyncMovies(show_progress=False)
				movies.Run()
			if do_sync('episodes'):
				episodes = SyncEpisodes(show_progress=False)
				episodes.Run()
		elif action == "scanStarted":
			Debug("[Notification] Dispatch: scanStarted")
		else:
			Debug("[Notification] '%s' unknown dispatch action!" % action)