service.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:soap4me-proxy 作者: eschava 项目源码 文件源码
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()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号