Пример #1
0
    def checkPlayBackStarted(self, startup=False):
        if hasattr(self, 'playing') and self.playing:
            return

        for x in range(3):  # retry 2 times before giving up
            try:
                j = utilxbmc.xjson({
                    "jsonrpc": "2.0",
                    "method": "Player.GetActivePlayers",
                    "id": 1
                })
                t = j[0]['type']
                i = j[0]['playerid']
                log("onPlayBackStarted: t=%s, i=%s" % (t, i))
                if t == 'video':
                    j = utilxbmc.xjson({
                        "jsonrpc": "2.0",
                        "method": "Player.GetItem",
                        "params": {
                            "playerid": i
                        },
                        "id": 1
                    })
                    type = j['item']['type']
                    log("onPlayBackStarted: type=%s" % type)
                    if type == 'movie':
                        self.playing = Movie()
                        self.__time()
                    elif type == 'episode':
                        self.playing = Episode()
                        self.__time()
            except (IndexError, TypeError):
                if not startup:
                    log(
                        "onPlayBackStarted: Can't retrieve active player status, retrying.. %d"
                        % x, xbmc.LOGWARNING)
                    if monitor.waitForAbort(1):
                        break
                    if x < 2:
                        continue
                    else:
                        log(
                            "onPlayBackStarted: Could not get player info, giving up!",
                            xbmc.LOGERROR)
                self.playing = None
            except Exception:
                self.playing = None
                if debug.get():
                    log(debug.traceback.print_exc(), xbmc.LOGERROR)
                return
            break
Пример #2
0
	def onPlayBackStarted(self):
		self.playing = None
		j = utilxbmc.xjson('{"jsonrpc":"2.0","method":"Player.GetActivePlayers","id":1}')
		t = j['result'][0]['type']
		i = j['result'][0]['playerid']
		if t == 'video':
			j = utilxbmc.xjson('{"jsonrpc":"2.0","method":"Player.GetItem","params":{"playerid":%s},"id":1}' % i)
			type = j['result']['item']['type']
			if type == 'movie':
				self.playing = Movie()
				self.__time()
			elif type == 'episode':
				self.playing = Episode()
				self.__time()
 def onPlayBackStarted(self):
     self.playing = None
     j = utilxbmc.xjson('{"jsonrpc":"2.0","method":"Player.GetActivePlayers","id":1}')
     t = j["result"][0]["type"]
     i = j["result"][0]["playerid"]
     if t == "video":
         j = utilxbmc.xjson('{"jsonrpc":"2.0","method":"Player.GetItem","params":{"playerid":%s},"id":1}' % i)
         type = j["result"]["item"]["type"]
         if type == "movie":
             self.playing = Movie()
             self.__time()
         elif type == "episode":
             self.playing = Episode()
             self.__time()
Пример #4
0
	def __init__(self):
		j = utilxbmc.xjson('{"jsonrpc":"2.0","method":"Player.GetItem","params":{"playerid":1,"properties":["file","title","playcount"]},"id":1}')
		self.type = 'episode'
		self.episodeid = j['result']['item']['id']
		p = j['result']['item']['file']
		self.path = os.path.normpath(p)
		self.title = j['result']['item']['title']
		self.playcount = j['result']['item']['playcount']
		self.rating = None
Пример #5
0
	def __init__(self):
		j = utilxbmc.xjson('{"jsonrpc":"2.0","method":"Player.GetItem","params":{"playerid":1,"properties":["file","title","playcount","imdbnumber"]},"id":1}')
		self.type = 'movie'
		self.movieid = j['result']['item']['id']
		p = j['result']['item']['file']
		self.path = os.path.normpath(p)
		self.title = j['result']['item']['title']
		self.playcount = j['result']['item']['playcount']
		self.imdb = j['result']['item']['imdbnumber']
		self.rating = None
		self.tag = None
		self.recommended = None