def onNotification(self, sender, method, data):
xbmc.Monitor.onNotification(self, sender, method, data)
xbmc.log('%s: Notification %s from %s, params: %s' % (ADDONID, method, sender, str(data)))
if method == 'VideoLibrary.OnUpdate':
params = json.loads(data)
if 'item' in params and 'type' in params['item']:
item_type = params['item']['type']
if item_type == 'episode' and 'id' in params['item'] and 'playcount' in params:
item_id = params['item']['id']
playcount = params['playcount']
self.watched_status.update_server_status(item_id, playcount > 0)
elif method == 'Player.OnStop':
params = json.loads(data)
if 'item' in params and 'type' in params['item']:
item_type = params['item']['type']
if item_type == 'episode' and 'id' in params['item']:
item_id = params['item']['id']
end = params['end']
if end:
self.watched_status.update_server_status(item_id, True)
else:
# resume time is not still updated so need to re-check time later
threading.Timer(3.0, self.onPlayerStopped, args=(item_id, )).start()
评论列表
文章目录