def run(self): startup_delay = kodiUtilities.getSettingAsInt('startup_delay') if startup_delay: logger.debug("Delaying startup by %d seconds." % startup_delay) xbmc.sleep(startup_delay * 1000) logger.debug("Service thread starting.") # purge queue before doing anything self.dispatchQueue.purge() # setup event driven classes self.Player = traktPlayer(action=self._dispatchQueue) self.Monitor = traktMonitor(action=self._dispatchQueue) # init traktapi class globals.traktapi = traktAPI() # init sync thread self.syncThread = syncThread() # init scrobbler class self.scrobbler = Scrobbler(globals.traktapi) AddonSignals.registerSlot('service.nextup.notification', 'NEXTUPWATCHEDSIGNAL', self.callback) # start loop for events while not self.Monitor.abortRequested(): if not kodiUtilities.getSetting('authorization'): last_reminder = kodiUtilities.getSettingAsInt('last_reminder') now = int(time.time()) if last_reminder >= 0 and last_reminder < now - (24 * 60 * 60): gui_utils.get_pin() while len(self.dispatchQueue) and (not self.Monitor.abortRequested()): data = self.dispatchQueue.get() logger.debug("Queued dispatch: %s" % data) self._dispatch(data) if xbmc.Player().isPlayingVideo(): self.scrobbler.transitionCheck() if self.Monitor.waitForAbort(1): # Abort was requested while waiting. We should exit break # we are shutting down logger.debug("Beginning shut down.") # delete player/monitor del self.Player del self.Monitor # check if sync thread is running, if so, join it. if self.syncThread.isAlive(): self.syncThread.join()
def start_playback(self): try: if self.playback_started: return if not self.isPlayback(): return self.playback_started = True # control.execute('Dialog.Close(all,true)') self.current_time = self.getTime() self.media_length = self.getTotalTime() if self.media_type == 'episode' and control.setting( 'enable.upnext') == 'true': if int(control.playlist.getposition()) == -1: control.playlist.clear() return source_id = 'plugin.video.venom' return_id = 'plugin.video.venom_play_action' try: # if int(control.playlist.getposition()) < (control.playlist.size() - 1) and not int(control.playlist.getposition()) == -1: if int(control.playlist.getposition()) < ( control.playlist.size() - 1): if self.media_type is None: return next_info = self.next_info() AddonSignals.sendSignal('upnext_data', next_info, source_id) AddonSignals.registerSlot('upnextprovider', return_id, self.signals_callback) # # Prescrape # from resources.lib.modules import sources # psources = sources.Sources().preScrape(title=next_info['next_episode']['title'], year=next_info['next_episode']['year'], imdb=next_info['next_episode']['tvshowimdb'], tvdb=next_info['next_episode']['tvshowid'], season=next_info['next_episode']['season'], episode=next_info['next_episode']['episode'], tvshowtitle=next_info['next_episode']['showtitle'], premiered=next_info['next_episode']['firstaired']) except: log_utils.error() pass except: log_utils.error() pass
def registerUpNext(self): source_id = 'plugin.video.%s' % tools.addonName.lower() return_id = 'plugin.video.%s_play_action' % tools.addonName.lower() try: next_info = self.next_info() AddonSignals.registerSlot('upnextprovider', return_id, self.signals_callback) AddonSignals.sendSignal('upnext_data', next_info, source_id=source_id) except RuntimeError: pass except: import traceback traceback.print_exc() pass
def download(info, path, template='%(title)s-%(id)s.%(ext)s'): """ Download the selected video in vidinfo to path. Template sets the youtube-dl format which defaults to TITLE-ID.EXT. Returns a DownloadResult object. """ info = _convertInfo(info) # Get the right format _completeInfo(info) # Make sure we have the needed bits _cancelDownload(_cancel=False) path_template = os.path.join(path, template) ytdl = YoutubeDLWrapper._getYTDL() ytdl._lastDownloadedFilePath = '' ytdl.params['quiet'] = True ytdl.params['outtmpl'] = path_template import AddonSignals signalPayload = { 'title': info.get('title'), 'url': info.get('url'), 'download.ID': info.get('download.ID') } try: AddonSignals.sendSignal('download.started', signalPayload, source_id='script.module.youtube.dl') YoutubeDLWrapper.download(info) except YoutubeDLWrapper.youtube_dl.DownloadError as e: return DownloadResult(False, e.message, filepath=ytdl._lastDownloadedFilePath) except YoutubeDLWrapper.DownloadCanceledException: return DownloadResult(False, status='canceled', filepath=ytdl._lastDownloadedFilePath) finally: ytdl.clearDownloadParams() signalPayload['path'] = ytdl._lastDownloadedFilePath AddonSignals.sendSignal('download.finished', signalPayload, source_id='script.module.youtube.dl') return DownloadResult(True, filepath=ytdl._lastDownloadedFilePath)
def __init__(self): try: self.enabled = g.ADDON.getSettingInt('lib_auto_upd_mode') == 2 except Exception: # pylint: disable=broad-except # If settings.xml was not created yet, as at first service run # g.ADDON.getSettingInt('lib_auto_upd_mode') will thrown a TypeError # If any other error appears, we don't want the service to crash, # let's return None in all case self.enabled = False self.startidle = 0 self.next_schedule = _compute_next_schedule() # Update library variables xbmc.Monitor.__init__(self) self.scan_in_progress = False self.scan_awaiting = False AddonSignals.registerSlot(g.ADDON.getAddonInfo('id'), common.Signals.LIBRARY_UPDATE_REQUESTED, self.update_kodi_library)
def make_return_call(instance, data): """Makes func return callable through AddonSignals and handles catching, conversion and forwarding of exceptions""" try: result = call(instance, func, data) except Exception as exc: # pylint: disable=broad-except error('IPC callback raised exception: {exc}', exc=exc) import traceback error(g.py2_decode(traceback.format_exc(), 'latin-1')) result = { 'error': exc.__class__.__name__, 'message': unicode(exc), } if g.IPC_OVER_HTTP: return result # Do not return None or AddonSignals will keep waiting till timeout if result is None: result = {} AddonSignals.returnCall(signal=_signal_name(func), source_id=g.ADDON_ID, data=result) return result
def play_video(self, torrent_url): """ Start the torrent's download and play it while being downloaded :param torrent_url: str :return: None """ xbmc.log( 'PeertubeAddon: Starting torrent download ({0})'.format( torrent_url), xbmc.LOGDEBUG) # Start a downloader thread AddonSignals.sendSignal('start_download', {'url': torrent_url}) # Wait until the PeerTubeDownloader has downloaded all the torrent's metadata AddonSignals.registerSlot('plugin.video.peertube', 'metadata_downloaded', self.play_video_continue) timeout = 0 while self.play == 0 and timeout < 10: xbmc.sleep(1000) timeout += 1 # Abort in case of timeout if timeout == 10: xbmcgui.Dialog().notification('Download timeout', 'Timeout fetching ' + torrent_url, xbmcgui.NOTIFICATION_ERROR) return None else: # Wait a little before starting playing the torrent xbmc.sleep(3000) # Pass the item to the Kodi player for actual playback. xbmc.log( 'PeertubeAddon: Starting video playback ({0})'.format(torrent_url), xbmc.LOGDEBUG) play_item = xbmcgui.ListItem(path=self.torrent_f) xbmcplugin.setResolvedUrl(self.plugin_id, True, listitem=play_item) return None
def start_playback(self): try: if self.playback_started: return if not self.isPlayback(): return self.playback_started = True # control.execute('Dialog.Close(all,true)') self.current_time = self.getTime() self.media_length = self.getTotalTime() if self.media_type == 'episode' and control.setting( 'enable.upnext') == 'true': if int(control.playlist.getposition()) == -1: control.playlist.clear() return source_id = 'plugin.video.venom' return_id = 'plugin.video.venom_play_action' try: # if int(control.playlist.getposition()) < (control.playlist.size() - 1) and not int(control.playlist.getposition()) == -1: if int(control.playlist.getposition()) < ( control.playlist.size() - 1): # log_utils.log('playlist.getposition = %s' % int(control.playlist.getposition()), __name__, log_utils.LOGDEBUG) if self.media_type is None: return next_info = self.next_info() AddonSignals.sendSignal('upnext_data', next_info, source_id) AddonSignals.registerSlot('upnextprovider', return_id, self.signals_callback) except: import traceback traceback.print_exc() pass except: import traceback traceback.print_exc() pass
def start_playback(self): try: if self.playback_started: return self.playback_started = True tools.execute('Dialog.Close(all,true)') self.current_time = self.getTime() self.media_length = self.getTotalTime() if 'episodeInfo' in self.args and tools.getSetting( 'smartplay.upnext') == 'true': source_id = 'plugin.video.%s' % tools.addonName.lower() return_id = 'plugin.video.%s_play_action' % tools.addonName.lower( ) try: next_info = self.next_info() AddonSignals.sendSignal('upnext_data', next_info, source_id=source_id) AddonSignals.registerSlot('upnextprovider', return_id, self.signals_callback) except: import traceback traceback.print_exc() pass if tools.getSetting( 'general.smartplay' ) is not 'false' and self.media_type is 'episode': if int(tools.playList.getposition()) == ( tools.playList.size() - 1): smartPlay.SmartPlay(self.args).append_next_season() self.traktStartWatching() except: import traceback traceback.print_exc() pass
def run(self): """ Main loop of the PeertubeService class, registring the start_download signal to start a peertubeDownloader thread when needed, and exit when Kodi is shutting down """ # Launch the download_torrent callback function when the 'start_download' signal is received AddonSignals.registerSlot('plugin.video.peertube', 'start_download', self.download_torrent) # Monitor Kodi's shutdown signal xbmc.log('PeertubeService: service started, Waiting for signals', xbmc.LOGDEBUG) monitor = xbmc.Monitor() while not monitor.abortRequested(): if monitor.waitForAbort(1): # Abort was requested while waiting. We must exit # TODO: Clean temporary directory break return
def run(self): """ Download the torrent specified by self.torrent :param: None :return: None """ xbmc.log('PeertubeDownloader: Opening bitTorent session', xbmc.LOGDEBUG) # Open bitTorrent session ses = libtorrent.session() ses.listen_on(6881, 6891) # Add torrent xbmc.log('PeertubeDownloader: Adding torrent ' + self.torrent, xbmc.LOGDEBUG) h = ses.add_torrent({'url': self.torrent, 'save_path': self.temp_dir}) # Set sequential mode to allow watching while downloading h.set_sequential_download(True) # Download torrent xbmc.log('PeertubeDownloader: Downloading torrent ' + self.torrent, xbmc.LOGDEBUG) signal_sent = 0 while not h.is_seed(): xbmc.sleep(1000) s = h.status() # Inform addon that all the metadata has been downloaded and that it may start playing the torrent if s.state >= 3 and signal_sent == 0: xbmc.log( 'PeertubeDownloader: Received all torrent metadata, notifying PeertubeAddon', xbmc.LOGDEBUG) i = h.torrent_file() f = self.temp_dir + i.name() AddonSignals.sendSignal('metadata_downloaded', {'file': f}) signal_sent = 1 # Everything is done return
def download(info, path, template='%(title)s-%(id)s.%(ext)s'): """ Download the selected video in vidinfo to path. Template sets the youtube-dl format which defaults to TITLE-ID.EXT. Returns a DownloadResult object. """ info = _convertInfo(info) # Get the right format _completeInfo(info) # Make sure we have the needed bits _cancelDownload(_cancel=False) path_template = os.path.join(path, template) ytdl = YoutubeDLWrapper._getYTDL() ytdl._lastDownloadedFilePath = '' ytdl.params['quiet'] = True ytdl.params['outtmpl'] = path_template import AddonSignals signalPayload = {'title': info.get('title'), 'url': info.get('url'), 'download.ID': info.get('download.ID')} try: AddonSignals.sendSignal('download.started', signalPayload, sourceID='script.module.youtube.dl') YoutubeDLWrapper.download(info) except YoutubeDLWrapper.youtube_dl.DownloadError, e: return DownloadResult(False, e.message, filepath=ytdl._lastDownloadedFilePath)
def make_addonsignals_call(callname, data): """Make an IPC call via AddonSignals and wait for it to return. The contents of data will be expanded to kwargs and passed into the target function.""" debug('Handling AddonSignals IPC call to {}'.format(callname)) result = AddonSignals.makeCall(source_id=g.ADDON_ID, signal=callname, data=data, timeout_ms=16000) _raise_for_error(callname, result) if result is None: raise Exception('Addon Signals call timeout') return result
def make_addonsignals_call(callname, data=None): """Make an IPC call via AddonSignals and wait for it to return. The contents of data will be expanded to kwargs and passed into the target function.""" LOG.debug('Handling AddonSignals IPC call to {}'.format(callname)) try: result = AddonSignals.makeCall(source_id=IPC_ADDON_ID, signal=callname, data=data, timeout_ms=IPC_TIMEOUT_SECS * 1000, use_timeout_exception=True) _raise_for_error(result) except AddonSignals.WaitTimeoutError: raise Exception('Addon Signals call timeout') return result
def start_playback(self): try: tools.execute('Dialog.Close(all,true)') self.current_time = self.getTime() self.media_length = self.getTotalTime() if self.offset is not None and int(self.offset) != 0: tools.log("Seeking %s seconds" % self.offset, 'info') self.seekTime(self.offset) self.offset = None else: tools.log("No seeking applied") if 'episodeInfo' in self.args and tools.getSetting('smartplay.upnext') == 'true': source_id = 'plugin.video.%s' % tools.addonName.lower() return_id = 'plugin.video.%s_play_action' % tools.addonName.lower() try: next_info = self.next_info() AddonSignals.sendSignal('upnext_data', next_info, source_id=source_id) AddonSignals.registerSlot('upnextprovider', return_id, self.signals_callback) except: import traceback traceback.print_exc() pass if tools.getSetting('general.smartplay') is not 'false' and self.media_type is 'episode': if int(tools.playList.getposition()) == (tools.playList.size() - 1): self.next_season = smartPlay.SmartPlay(self.args).append_next_season() self.playback_started = True post_data = self.buildTraktObject(overide_progress=0) self.trakt_api.post_request('scrobble/start', postData=post_data, limit=False) except: pass
def start_playback(self): try: if self.playback_started: return if not self.isPlayback(): return self.playback_started = True # control.execute('Dialog.Close(all,true)') self.current_time = self.getTime() self.media_length = self.getTotalTime() if self.media_type == 'episode' and control.setting( 'enable.upnext') == 'true': source_id = 'plugin.video.ego' return_id = 'plugin.video.ego_play_action' try: if int(control.playlist.getposition()) < ( control.playlist.size() - 1): if self.media_type is None: return next_info = self.next_info() # xbmc.log('line 469 next_info = %s' % next_info, 2) AddonSignals.sendSignal('upnext_data', next_info, source_id) AddonSignals.registerSlot('upnextprovider', return_id, self.signals_callback) except: import traceback traceback.print_exc() pass except: import traceback traceback.print_exc() pass
def make_addonsignals_call(callname, data): """ Make an IPC call via AddonSignals and wait for it to return. The contents of data will be expanded to kwargs and passed into the target function. """ LOG.debug('Handling AddonSignals IPC call to {}'.format(callname)) result = AddonSignals.makeCall(source_id=G.ADDON_ID, signal=callname, data=data, timeout_ms=IPC_TIMEOUT_SECS * 1000) if isinstance(result, dict) and IPC_EXCEPTION_PLACEHOLDER in result: _raise_exception(result) if result is None: raise Exception('Addon Signals call timeout') return result
def make_addonsignals_call(callname, data): """ Make an IPC call via AddonSignals and wait for it to return. The contents of data will be expanded to kwargs and passed into the target function. """ LOG.debug('Handling AddonSignals IPC call to {}'.format(callname)) result = AddonSignals.makeCall(source_id=G.ADDON_ID, signal=callname, data=data, timeout_ms=IPC_TIMEOUT_SECS * 1000, use_timeout_exception=True) _result = pickle.loads(b64decode(result)) if isinstance(_result, Exception): raise _result return _result
def unregister_slot(callback, signal=None): """Remove a registered callback from AddonSignals""" name = signal if signal else _signal_name(callback) AddonSignals.unRegisterSlot(signaler_id=g.ADDON_ID, signal=name) debug('Unregistered AddonSignals slot {}'.format(name))
def autoPlayPlayback(self): currentFile = xbmc.Player().getPlayingFile() # Get the active player result = self.getNowPlaying() if 'result' in result: itemtype = result["result"]["item"]["type"] addonSettings = xbmcaddon.Addon(id='service.nextup.notification') playMode = addonSettings.getSetting("autoPlayMode") currentepisodenumber = result["result"]["item"]["episode"] currentseasonid = result["result"]["item"]["season"] currentshowtitle = result["result"]["item"]["showtitle"].encode('utf-8') currentshowtitle = utils.unicodetoascii(currentshowtitle) tvshowid = result["result"]["item"]["tvshowid"] shortplayMode = addonSettings.getSetting("shortPlayMode") shortplayNotification= addonSettings.getSetting("shortPlayNotification") shortplayLength = int(addonSettings.getSetting("shortPlayLength")) * 60 showpostplaypreview = addonSettings.getSetting("showPostPlayPreview") == "true" showpostplay = addonSettings.getSetting("showPostPlay") == "true" shouldshowpostplay = showpostplay and showpostplaypreview # Try to get tvshowid by showtitle from kodidb if tvshowid is -1 like in strm streams which are added to kodi db if int(tvshowid) == -1: tvshowid = self.showtitle_to_id(title=currentshowtitle) self.logMsg("Fetched missing tvshowid " + str(tvshowid), 2) if (itemtype == "episode"): # Get current episodeid currentepisodeid = self.get_episode_id(showid=str(tvshowid), showseason=currentseasonid, showepisode=currentepisodenumber) else: # wtf am i doing here error.. #### self.logMsg("Error: cannot determine if episode", 1) return else: # wtf am i doing here error.. #### self.logMsg("Error: cannot determine if episode", 1) return self.currentepisodeid = currentepisodeid self.logMsg("Getting details of next up episode for tvshow id: " + str(tvshowid), 1) if self.currenttvshowid != tvshowid: self.currenttvshowid = tvshowid self.playedinarow = 1 result = xbmc.executeJSONRPC( '{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"tvshowid": %d, ' '"properties": [ "title", "playcount", "season", "episode", "showtitle", "plot", ' '"file", "rating", "resume", "tvshowid", "art", "firstaired", "runtime", "writer", ' '"dateadded", "lastplayed" , "streamdetails"], "sort": {"method": "episode"}}, "id": 1}' % tvshowid) if result: result = unicode(result, 'utf-8', errors='ignore') result = json.loads(result) self.logMsg("Got details of next up episode %s" % str(result), 2) xbmc.sleep(100) # Find the next unwatched and the newest added episodes if "result" in result and "episodes" in result["result"]: includeWatched = addonSettings.getSetting("includeWatched") == "true" episode = self.findNextEpisode(result, currentFile, includeWatched) if episode is None: # no episode get out of here return self.logMsg("episode details %s" % str(episode), 2) episodeid = episode["episodeid"] if includeWatched: includePlaycount = True else: includePlaycount = episode["playcount"] == 0 if includePlaycount and currentepisodeid != episodeid: # we have a next up episode nextUpPage = NextUpInfo("script-nextup-notification-NextUpInfo.xml", addonSettings.getAddonInfo('path'), "default", "1080i") nextUpPage.setItem(episode) stillWatchingPage = StillWatchingInfo( "script-nextup-notification-StillWatchingInfo.xml", addonSettings.getAddonInfo('path'), "default", "1080i") stillWatchingPage.setItem(episode) playedinarownumber = addonSettings.getSetting("playedInARow") playTime = xbmc.Player().getTime() totalTime = xbmc.Player().getTotalTime() self.logMsg("played in a row settings %s" % str(playedinarownumber), 2) self.logMsg("played in a row %s" % str(self.playedinarow), 2) if int(self.playedinarow) <= int(playedinarownumber): self.logMsg( "showing next up page as played in a row is %s" % str(self.playedinarow), 2) if (shortplayNotification == "false") and (shortplayLength >= totalTime) and (shortplayMode == "true"): self.logMsg("hiding notification for short videos") else: nextUpPage.show() else: self.logMsg( "showing still watching page as played in a row %s" % str(self.playedinarow), 2) if (shortplayNotification == "false") and (shortplayLength >= totalTime) and (shortplayMode == "true"): self.logMsg("hiding notification for short videos") else: stillWatchingPage.show() if shouldshowpostplay: self.postPlayPlayback() while xbmc.Player().isPlaying() and ( totalTime - playTime > 1) and not nextUpPage.isCancel() and not nextUpPage.isWatchNow() and not stillWatchingPage.isStillWatching() and not stillWatchingPage.isCancel(): xbmc.sleep(100) try: playTime = xbmc.Player().getTime() totalTime = xbmc.Player().getTotalTime() except: pass if shortplayLength >= totalTime and shortplayMode == "true": #play short video and don't add to playcount self.playedinarow += 0 self.logMsg("Continuing short video autoplay - %s") if nextUpPage.isWatchNow() or stillWatchingPage.isStillWatching(): self.playedinarow = 1 shouldPlayDefault = not nextUpPage.isCancel() else: if int(self.playedinarow) <= int(playedinarownumber): nextUpPage.close() shouldPlayDefault = not nextUpPage.isCancel() shouldPlayNonDefault = nextUpPage.isWatchNow() else: stillWatchingPage.close() shouldPlayDefault = stillWatchingPage.isStillWatching() shouldPlayNonDefault = stillWatchingPage.isStillWatching() if nextUpPage.isWatchNow() or stillWatchingPage.isStillWatching(): self.playedinarow = 1 else: self.playedinarow += 1 if (shouldPlayDefault and not shouldshowpostplay and playMode == "0") or (shouldPlayNonDefault and shouldshowpostplay and playMode == "0") or (shouldPlayNonDefault and playMode == "1"): self.logMsg("playing media episode id %s" % str(episodeid), 2) # Signal to trakt previous episode watched AddonSignals.sendSignal("NEXTUPWATCHEDSIGNAL", {'episodeid': self.currentepisodeid}) # if in postplaypreview mode clear the post play window as its not needed now if shouldshowpostplay: self.postplaywindow = None # Play media xbmc.executeJSONRPC( '{ "jsonrpc": "2.0", "id": 0, "method": "Player.Open", ' '"params": { "item": {"episodeid": ' + str(episode["episodeid"]) + '} } }')
def autoPlayPlayback(self): currentFile = xbmc.Player().getPlayingFile() # Get the active player result = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "id": 1, "method": "Player.GetActivePlayers"}') result = unicode(result, 'utf-8', errors='ignore') self.logMsg("Got active player " + result, 2) result = json.loads(result) # Seems to work too fast loop whilst waiting for it to become active while not result["result"]: result = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "id": 1, "method": "Player.GetActivePlayers"}') result = unicode(result, 'utf-8', errors='ignore') self.logMsg("Got active player " + result, 2) result = json.loads(result) if 'result' in result and result["result"][0] is not None: playerid = result["result"][0]["playerid"] # Get details of the playing media self.logMsg("Getting details of playing media", 1) result = xbmc.executeJSONRPC( '{"jsonrpc": "2.0", "id": 1, "method": "Player.GetItem", "params": {"playerid": ' + str( playerid) + ', "properties": ["showtitle", "tvshowid", "episode", "season", "playcount"] } }') result = unicode(result, 'utf-8', errors='ignore') self.logMsg("Got details of playing media" + result, 2) result = json.loads(result) if 'result' in result: itemtype = result["result"]["item"]["type"] if self.strm_query(result): addonSettings = xbmcaddon.Addon(id='service.nextup.notification') playMode = addonSettings.getSetting("autoPlayMode") currentepisodenumber = result["result"]["item"]["episode"] currentseasonid = result["result"]["item"]["season"] currentshowtitle = result["result"]["item"]["showtitle"] tvshowid = result["result"]["item"]["tvshowid"] shortplayMode = addonSettings.getSetting("shortPlayMode") shortplayNotification= addonSettings.getSetting("shortPlayNotification") shortplayLength = int(addonSettings.getSetting("shortPlayLength")) * 60 if (itemtype == "episode"): # Get the next up episode currentepisodeid = result["result"]["item"]["id"] elif tvshowid == -1: # I am a STRM ### tvshowid, episodeid = self.iStream_fix(tvshowid, currentshowtitle, currentepisodenumber, currentseasonid) currentepisodeid = episodeid else: # wtf am i doing here error.. #### self.logMsg("Error: cannot determine if episode", 1) return self.currentepisodeid = currentepisodeid self.logMsg("Getting details of next up episode for tvshow id: " + str(tvshowid), 1) if self.currenttvshowid != tvshowid: self.currenttvshowid = tvshowid self.playedinarow = 1 result = xbmc.executeJSONRPC( '{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"tvshowid": %d, ' '"properties": [ "title", "playcount", "season", "episode", "showtitle", "plot", ' '"file", "rating", "resume", "tvshowid", "art", "firstaired", "runtime", "writer", ' '"dateadded", "lastplayed" , "streamdetails"], "sort": {"method": "episode"}}, "id": 1}' % tvshowid) if result: result = unicode(result, 'utf-8', errors='ignore') result = json.loads(result) self.logMsg("Got details of next up episode %s" % str(result), 2) xbmc.sleep(100) # Find the next unwatched and the newest added episodes if "result" in result and "episodes" in result["result"]: includeWatched = addonSettings.getSetting("includeWatched") == "true" episode = self.findNextEpisode(result, currentFile, includeWatched) if episode is None: # no episode get out of here return self.logMsg("episode details %s" % str(episode), 2) episodeid = episode["episodeid"] if includeWatched: includePlaycount = True else: includePlaycount = episode["playcount"] == 0 if includePlaycount and currentepisodeid != episodeid: # we have a next up episode nextUpPage = NextUpInfo("script-nextup-notification-NextUpInfo.xml", addonSettings.getAddonInfo('path'), "default", "1080i") nextUpPage.setItem(episode) stillWatchingPage = StillWatchingInfo( "script-nextup-notification-StillWatchingInfo.xml", addonSettings.getAddonInfo('path'), "default", "1080i") stillWatchingPage.setItem(episode) playedinarownumber = addonSettings.getSetting("playedInARow") playTime = xbmc.Player().getTime() totalTime = xbmc.Player().getTotalTime() self.logMsg("played in a row settings %s" % str(playedinarownumber), 2) self.logMsg("played in a row %s" % str(self.playedinarow), 2) if int(self.playedinarow) <= int(playedinarownumber): self.logMsg( "showing next up page as played in a row is %s" % str(self.playedinarow), 2) if (shortplayNotification == "false") and (shortplayLength >= totalTime) and (shortplayMode == "true"): self.logMsg("hiding notification for short videos") else: nextUpPage.show() else: self.logMsg( "showing still watching page as played in a row %s" % str(self.playedinarow), 2) if (shortplayNotification == "false") and (shortplayLength >= totalTime) and (shortplayMode == "true"): self.logMsg("hiding notification for short videos") else: stillWatchingPage.show() while xbmc.Player().isPlaying() and ( totalTime - playTime > 1) and not nextUpPage.isCancel() and not nextUpPage.isWatchNow() and not stillWatchingPage.isStillWatching() and not stillWatchingPage.isCancel(): xbmc.sleep(100) try: playTime = xbmc.Player().getTime() totalTime = xbmc.Player().getTotalTime() except: pass if shortplayLength >= totalTime and shortplayMode == "true": #play short video and don't add to playcount self.playedinarow += 0 self.logMsg("Continuing short video autoplay - %s") if nextUpPage.isWatchNow() or stillWatchingPage.isStillWatching(): self.playedinarow = 1 shouldPlayDefault = not nextUpPage.isCancel() else: if int(self.playedinarow) <= int(playedinarownumber): nextUpPage.close() shouldPlayDefault = not nextUpPage.isCancel() shouldPlayNonDefault = nextUpPage.isWatchNow() else: stillWatchingPage.close() shouldPlayDefault = stillWatchingPage.isStillWatching() shouldPlayNonDefault = stillWatchingPage.isStillWatching() if nextUpPage.isWatchNow() or stillWatchingPage.isStillWatching(): self.playedinarow = 1 else: self.playedinarow += 1 if (shouldPlayDefault and playMode == "0") or (shouldPlayNonDefault and playMode == "1"): self.logMsg("playing media episode id %s" % str(episodeid), 2) # Signal to trakt previous episode watched AddonSignals.sendSignal("NEXTUPWATCHEDSIGNAL", {'episodeid': self.currentepisodeid}) # Play media xbmc.executeJSONRPC( '{ "jsonrpc": "2.0", "id": 0, "method": "Player.Open", ' '"params": { "item": {"episodeid": ' + str(episode["episodeid"]) + '} } }')
def _send_signal(signal, data): _data = b64encode(pickle.dumps(data, pickle.HIGHEST_PROTOCOL)).decode('ascii') AddonSignals.sendSignal(source_id=G.ADDON_ID, signal=signal, data=_data)
def onPlayBackStarted(self): self.helper.log('Getting next episode info') next_ep_id = self.helper.r.get_next_episode_id(self.video_id) if next_ep_id['next_in_sequence'].get('nid'): next_ep_info = self.helper.r.get_episode_info(next_ep_id['next_in_sequence']['nid']) next_ep_title = next_ep_info['videos'][0]['episode_name'] if next_ep_info['videos'][0].get('episode_name') else next_ep_info['videos'][0].get('name') self.helper.log('Next episode name: ' + next_ep_title.encode('utf-8')) self.helper.log('Current episode name: ' + self.current_episode_info['title'].encode('utf-8')) current_episode = {} current_episode["episodeid"] = self.video_id current_episode["tvshowid"] = '' current_episode["title"] = self.current_episode_info['title'] current_episode["art"] = {} current_episode["art"]["tvshow.poster"] = '' current_episode["art"]["thumb"] = self.current_episode_art['thumb'] current_episode["art"]["tvshow.fanart"] = self.current_episode_art['fanart'] current_episode["art"]["tvshow.landscape"] = '' current_episode["art"]["tvshow.clearart"] = '' current_episode["art"]["tvshow.clearlogo"] = '' current_episode["plot"] = self.current_episode_info['title'] current_episode["showtitle"] = self.current_episode_info['tvshowtitle'] current_episode["playcount"] = '' current_episode["season"] = self.current_episode_info['season'] current_episode["episode"] = self.current_episode_info['episode'] current_episode["rating"] = None current_episode["firstaired"] = self.current_episode_info['aired'] next_episode = {} next_episode["episodeid"] = next_ep_info['videos'][0]['id'] next_episode["tvshowid"] = '' next_episode["title"] = next_ep_title next_episode["art"] = {} next_episode["art"]["tvshow.poster"] = '' next_episode["art"]["thumb"] = next_ep_info['videos'][0]['media']['images'][0]['1920x1080'] if next_ep_info['videos'][0]['media']['images'][0].get('1920x1080') else None next_episode["art"]["tvshow.fanart"] = next_ep_info['videos'][0]['media']['images'][0]['1920x1080'] if next_ep_info['videos'][0]['media']['images'][0].get('1920x1080') else None next_episode["art"]["tvshow.landscape"] = '' next_episode["art"]["tvshow.clearart"] = '' next_episode["art"]["tvshow.clearlogo"] = '' next_episode["plot"] = next_ep_info['videos'][0].get('description') next_episode["showtitle"] = next_ep_info['videos'][0].get('series') next_episode["playcount"] = '' next_episode["season"] = next_ep_info['videos'][0].get('season') next_episode["episode"] = next_ep_info['videos'][0].get('episode') next_episode["rating"] = None next_episode["firstaired"] = next_ep_info['videos'][0].get('created') if next_ep_info['videos'][0]['premium'] == 1: sticker = 'entertainment' else: sticker = None play_info = {} play_info['video_id'] = next_ep_info['videos'][0]['id'] play_info['sticker'] = sticker next_info = { 'current_episode': current_episode, 'next_episode': next_episode, 'play_info': play_info, 'notification_time': '' } AddonSignals.sendSignal("upnext_data", next_info, source_id=self.helper.addon_name) else: self.helper.log('No next episode available')
def autoPlayPlayback(self): currentFile = xbmc.Player().getPlayingFile() # Get the active player result = xbmc.executeJSONRPC( '{"jsonrpc": "2.0", "id": 1, "method": "Player.GetActivePlayers"}') result = unicode(result, 'utf-8', errors='ignore') self.logMsg("Got active player " + result, 2) result = json.loads(result) # Seems to work too fast loop whilst waiting for it to become active while not result["result"]: result = xbmc.executeJSONRPC( '{"jsonrpc": "2.0", "id": 1, "method": "Player.GetActivePlayers"}' ) result = unicode(result, 'utf-8', errors='ignore') self.logMsg("Got active player " + result, 2) result = json.loads(result) if 'result' in result and result["result"][0] is not None: playerid = result["result"][0]["playerid"] # Get details of the playing media self.logMsg("Getting details of playing media", 1) result = xbmc.executeJSONRPC( '{"jsonrpc": "2.0", "id": 1, "method": "Player.GetItem", "params": {"playerid": ' + str(playerid) + ', "properties": ["showtitle", "tvshowid", "episode", "season", "playcount"] } }' ) result = unicode(result, 'utf-8', errors='ignore') self.logMsg("Got details of playing media" + result, 2) result = json.loads(result) if 'result' in result: itemtype = result["result"]["item"]["type"] if self.strm_query(result): addonSettings = xbmcaddon.Addon( id='service.nextup.notification') playMode = addonSettings.getSetting("autoPlayMode") currentepisodenumber = result["result"]["item"]["episode"] currentseasonid = result["result"]["item"]["season"] currentshowtitle = result["result"]["item"]["showtitle"] tvshowid = result["result"]["item"]["tvshowid"] shortplayMode = addonSettings.getSetting("shortPlayMode") shortplayNotification = addonSettings.getSetting( "shortPlayNotification") shortplayLength = int( addonSettings.getSetting("shortPlayLength")) * 60 if (itemtype == "episode"): # Get the next up episode currentepisodeid = result["result"]["item"]["id"] elif tvshowid == -1: # I am a STRM ### tvshowid, episodeid = self.iStream_fix( tvshowid, currentshowtitle, currentepisodenumber, currentseasonid) currentepisodeid = episodeid else: # wtf am i doing here error.. #### self.logMsg("Error: cannot determine if episode", 1) return self.currentepisodeid = currentepisodeid self.logMsg( "Getting details of next up episode for tvshow id: " + str(tvshowid), 1) if self.currenttvshowid != tvshowid: self.currenttvshowid = tvshowid self.playedinarow = 1 result = xbmc.executeJSONRPC( '{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"tvshowid": %d, ' '"properties": [ "title", "playcount", "season", "episode", "showtitle", "plot", ' '"file", "rating", "resume", "tvshowid", "art", "firstaired", "runtime", "writer", ' '"dateadded", "lastplayed" , "streamdetails"], "sort": {"method": "episode"}}, "id": 1}' % tvshowid) if result: result = unicode(result, 'utf-8', errors='ignore') result = json.loads(result) self.logMsg("Got details of next up episode %s" % str(result), 2) xbmc.sleep(100) # Find the next unwatched and the newest added episodes if "result" in result and "episodes" in result["result"]: includeWatched = addonSettings.getSetting( "includeWatched") == "true" episode = self.findNextEpisode(result, currentFile, includeWatched) if episode is None: # no episode get out of here return self.logMsg("episode details %s" % str(episode), 2) self.episode = episode episodeid = episode["episodeid"] if includeWatched: includePlaycount = True else: includePlaycount = episode["playcount"] == 0 if includePlaycount and currentepisodeid != episodeid: # we have a next up episode self.playbackonended = True self.nextUpPage = NextUpInfo( "script-nextup-notification-NextUpInfo.xml", addonSettings.getAddonInfo('path'), "default", "1080i") self.nextUpPage.setItem(episode) self.stillWatchingPage = StillWatchingInfo( "script-nextup-notification-StillWatchingInfo.xml", addonSettings.getAddonInfo('path'), "default", "1080i") self.stillWatchingPage.setItem(episode) playedinarownumber = addonSettings.getSetting( "playedInARow") playTime = xbmc.Player().getTime() self.totalTime = xbmc.Player().getTotalTime() self.logMsg( "played in a row settings %s" % str(playedinarownumber), 2) self.logMsg( "played in a row %s" % str(self.playedinarow), 2) if int(self.playedinarow) <= int(playedinarownumber): self.logMsg( "showing next up page as played in a row is %s" % str(self.playedinarow), 2) if (shortplayNotification == "false") and ( shortplayLength >= self.totalTime) and ( shortplayMode == "true"): self.logMsg( "hiding notification for short videos") else: self.nextUpPage.show() else: self.logMsg( "showing still watching page as played in a row %s" % str(self.playedinarow), 2) if (shortplayNotification == "false") and ( shortplayLength >= self.totalTime) and ( shortplayMode == "true"): self.logMsg( "hiding notification for short videos") else: self.stillWatchingPage.show() while xbmc.Player().isPlaying( ) and not self.nextUpPage.isCancel( ) and not self.nextUpPage.isWatchNow( ) and not self.stillWatchingPage.isStillWatching( ) and not self.stillWatchingPage.isCancel(): xbmc.sleep(100) #try: # playTime = xbmc.Player().getTime() # totalTime = xbmc.Player().getTotalTime() #except: # pass if xbmc.Player().isPlaying(): if shortplayLength >= self.totalTime and shortplayMode == "true": #play short video and don't add to playcount self.playedinarow += 0 self.logMsg( "Continuing short video autoplay - %s") if self.nextUpPage.isWatchNow( ) or self.stillWatchingPage.isStillWatching(): self.playedinarow = 1 shouldPlayDefault = not self.nextUpPage.isCancel( ) else: if int(self.playedinarow) <= int( playedinarownumber): self.nextUpPage.close() shouldPlayDefault = not self.nextUpPage.isCancel( ) shouldPlayNonDefault = self.nextUpPage.isWatchNow( ) else: self.stillWatchingPage.close() shouldPlayDefault = self.stillWatchingPage.isStillWatching( ) shouldPlayNonDefault = self.stillWatchingPage.isStillWatching( ) if self.nextUpPage.isWatchNow( ) or self.stillWatchingPage.isStillWatching(): self.playedinarow = 1 else: self.playedinarow += 1 if (shouldPlayDefault and playMode == "0") or ( shouldPlayNonDefault and playMode == "1"): self.logMsg( "playing media episode id %s" % str(episodeid), 2) # Signal to trakt previous episode watched as playback ended early AddonSignals.sendSignal( "NEXTUPWATCHEDSIGNAL", {'episodeid': self.currentepisodeid}) # Play media xbmc.executeJSONRPC( '{ "jsonrpc": "2.0", "id": 0, "method": "Player.Open", ' '"params": { "item": {"episodeid": ' + str(episode["episodeid"]) + '} } }')
def _registering(self): addon_name = self.addon.getAddonInfo('name') AddonSignals.registerSlot(addon_name, 'add_skip', self._skips.append) AddonSignals.registerSlot(addon_name, 'set_next', self.set_next)
def stopDownload(self): AddonSignals.sendSignal('DOWNLOAD_STOP')
def autoPlayPlayback(self): currentFile = xbmc.Player().getPlayingFile() # Get the active player result = self.getNowPlaying() if 'result' in result: itemtype = result["result"]["item"]["type"] addonSettings = xbmcaddon.Addon(id='service.nextup.notification') playMode = addonSettings.getSetting("autoPlayMode") currentepisodenumber = result["result"]["item"]["episode"] currentseasonid = result["result"]["item"]["season"] currentshowtitle = result["result"]["item"]["showtitle"].encode( 'utf-8') currentshowtitle = utils.unicodetoascii(currentshowtitle) tvshowid = result["result"]["item"]["tvshowid"] shortplayMode = addonSettings.getSetting("shortPlayMode") shortplayNotification = addonSettings.getSetting( "shortPlayNotification") shortplayLength = int( addonSettings.getSetting("shortPlayLength")) * 60 showpostplaypreview = addonSettings.getSetting( "showPostPlayPreview") == "true" showpostplay = addonSettings.getSetting("showPostPlay") == "true" shouldshowpostplay = showpostplay and showpostplaypreview # Try to get tvshowid by showtitle from kodidb if tvshowid is -1 like in strm streams which are added to kodi db if int(tvshowid) == -1: tvshowid = self.showtitle_to_id(title=currentshowtitle) self.logMsg("Fetched missing tvshowid " + str(tvshowid), 2) if (itemtype == "episode"): # Get current episodeid currentepisodeid = self.get_episode_id( showid=str(tvshowid), showseason=currentseasonid, showepisode=currentepisodenumber) else: # wtf am i doing here error.. #### self.logMsg("Error: cannot determine if episode", 1) return else: # wtf am i doing here error.. #### self.logMsg("Error: cannot determine if episode", 1) return self.currentepisodeid = currentepisodeid self.logMsg( "Getting details of next up episode for tvshow id: " + str(tvshowid), 1) if self.currenttvshowid != tvshowid: self.currenttvshowid = tvshowid self.playedinarow = 1 result = xbmc.executeJSONRPC( '{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"tvshowid": %d, ' '"properties": [ "title", "playcount", "season", "episode", "showtitle", "plot", ' '"file", "rating", "resume", "tvshowid", "art", "firstaired", "runtime", "writer", ' '"dateadded", "lastplayed" , "streamdetails"], "sort": {"method": "episode"}}, "id": 1}' % tvshowid) if result: result = unicode(result, 'utf-8', errors='ignore') result = json.loads(result) self.logMsg("Got details of next up episode %s" % str(result), 2) xbmc.sleep(100) # Find the next unwatched and the newest added episodes if "result" in result and "episodes" in result["result"]: includeWatched = addonSettings.getSetting( "includeWatched") == "true" episode = self.findNextEpisode(result, currentFile, includeWatched) if episode is None: # no episode get out of here return self.logMsg("episode details %s" % str(episode), 2) episodeid = episode["episodeid"] if includeWatched: includePlaycount = True else: includePlaycount = episode["playcount"] == 0 if includePlaycount and currentepisodeid != episodeid: # we have a next up episode nextUpPage = NextUpInfo( "script-nextup-notification-NextUpInfo.xml", addonSettings.getAddonInfo('path'), "default", "1080i") nextUpPage.setItem(episode) stillWatchingPage = StillWatchingInfo( "script-nextup-notification-StillWatchingInfo.xml", addonSettings.getAddonInfo('path'), "default", "1080i") stillWatchingPage.setItem(episode) playedinarownumber = addonSettings.getSetting( "playedInARow") playTime = xbmc.Player().getTime() totalTime = xbmc.Player().getTotalTime() self.logMsg( "played in a row settings %s" % str(playedinarownumber), 2) self.logMsg("played in a row %s" % str(self.playedinarow), 2) if int(self.playedinarow) <= int(playedinarownumber): self.logMsg( "showing next up page as played in a row is %s" % str(self.playedinarow), 2) if (shortplayNotification == "false") and (shortplayLength >= totalTime) and (shortplayMode == "true"): self.logMsg("hiding notification for short videos") else: nextUpPage.show() else: self.logMsg( "showing still watching page as played in a row %s" % str(self.playedinarow), 2) if (shortplayNotification == "false") and (shortplayLength >= totalTime) and (shortplayMode == "true"): self.logMsg("hiding notification for short videos") else: stillWatchingPage.show() if shouldshowpostplay: self.postPlayPlayback() while xbmc.Player().isPlaying() and ( totalTime - playTime > 1) and not nextUpPage.isCancel( ) and not nextUpPage.isWatchNow( ) and not stillWatchingPage.isStillWatching( ) and not stillWatchingPage.isCancel(): xbmc.sleep(100) try: playTime = xbmc.Player().getTime() totalTime = xbmc.Player().getTotalTime() except: pass if shortplayLength >= totalTime and shortplayMode == "true": #play short video and don't add to playcount self.playedinarow += 0 self.logMsg("Continuing short video autoplay - %s") if nextUpPage.isWatchNow( ) or stillWatchingPage.isStillWatching(): self.playedinarow = 1 shouldPlayDefault = not nextUpPage.isCancel() else: if int(self.playedinarow) <= int(playedinarownumber): nextUpPage.close() shouldPlayDefault = not nextUpPage.isCancel() shouldPlayNonDefault = nextUpPage.isWatchNow() else: stillWatchingPage.close() shouldPlayDefault = stillWatchingPage.isStillWatching( ) shouldPlayNonDefault = stillWatchingPage.isStillWatching( ) if nextUpPage.isWatchNow( ) or stillWatchingPage.isStillWatching(): self.playedinarow = 1 else: self.playedinarow += 1 if (shouldPlayDefault and not shouldshowpostplay and playMode == "0") or ( shouldPlayNonDefault and shouldshowpostplay and playMode == "0") or (shouldPlayNonDefault and playMode == "1"): self.logMsg( "playing media episode id %s" % str(episodeid), 2) # Signal to trakt previous episode watched AddonSignals.sendSignal( "NEXTUPWATCHEDSIGNAL", {'episodeid': self.currentepisodeid}) # if in postplaypreview mode clear the post play window as its not needed now if shouldshowpostplay: self.postplaywindow = None # Play media xbmc.executeJSONRPC( '{ "jsonrpc": "2.0", "id": 0, "method": "Player.Open", ' '"params": { "item": {"episodeid": ' + str(episode["episodeid"]) + '} } }')
ytdl.params["quiet"] = True ytdl.params["outtmpl"] = path_template import AddonSignals signalPayload = {"title": info.get("title"), "url": info.get("url"), "download.ID": info.get("download.ID")} try: AddonSignals.sendSignal("download.started", signalPayload, sourceID="script.module.youtube.dl") YoutubeDLWrapper.download(info) except YoutubeDLWrapper.youtube_dl.DownloadError, e: return DownloadResult(False, e.message, filepath=ytdl._lastDownloadedFilePath) except YoutubeDLWrapper.DownloadCanceledException: return DownloadResult(False, status="canceled", filepath=ytdl._lastDownloadedFilePath) finally: ytdl.clearDownloadParams() signalPayload["path"] = ytdl._lastDownloadedFilePath AddonSignals.sendSignal("download.finished", signalPayload, sourceID="script.module.youtube.dl") return DownloadResult(True, filepath=ytdl._lastDownloadedFilePath) def mightHaveVideo(url, resolve_redirects=False): """ Returns True if the url matches against one of the handled site URLs. """ if resolve_redirects: try: url = resolve_http_redirect(url) except: util.ERROR("mightHaveVideo(): Failed to resolve URL") return False
def _send_signal(signal, data): AddonSignals.sendSignal(source_id=g.ADDON_ID, signal=signal, data=data)
def send_signal(signal, data=None): """Send a signal via AddonSignals""" AddonSignals.sendSignal(source_id=g.ADDON_ID, signal=signal, data=data)
ytdl._lastDownloadedFilePath = '' ytdl.params['quiet'] = True ytdl.params['outtmpl'] = path_template import AddonSignals signalPayload = {'title': info.get('title'), 'url': info.get('url'), 'download.ID': info.get('download.ID')} try: AddonSignals.sendSignal('download.started', signalPayload, sourceID='script.module.youtube.dl') YoutubeDLWrapper.download(info) except YoutubeDLWrapper.youtube_dl.DownloadError, e: return DownloadResult(False, e.message, filepath=ytdl._lastDownloadedFilePath) except YoutubeDLWrapper.DownloadCanceledException: return DownloadResult(False, status='canceled', filepath=ytdl._lastDownloadedFilePath) finally: ytdl.clearDownloadParams() signalPayload['path'] = ytdl._lastDownloadedFilePath AddonSignals.sendSignal('download.finished', signalPayload, sourceID='script.module.youtube.dl') return DownloadResult(True, filepath=ytdl._lastDownloadedFilePath) def mightHaveVideo(url, resolve_redirects=False): """ Returns True if the url matches against one of the handled site URLs. """ if resolve_redirects: try: url = resolve_http_redirect(url) except: util.ERROR('mightHaveVideo(): Failed to resolve URL') return False
import xbmc import AddonSignals from resources.lib.functions import setView def viewNotification(notificationData): xbmc.log("ViewMasterService viewNotification called:" + notificationData['view_type']) setView(notificationData['view_type']) AddonSignals.registerSlot('embycon', 'display_items', viewNotification) while not xbmc.abortRequested: xbmc.sleep(1000)
signalPayload, sourceID='script.module.youtube.dl') YoutubeDLWrapper.download(info) except YoutubeDLWrapper.youtube_dl.DownloadError, e: return DownloadResult(False, e.message, filepath=ytdl._lastDownloadedFilePath) except YoutubeDLWrapper.DownloadCanceledException: return DownloadResult(False, status='canceled', filepath=ytdl._lastDownloadedFilePath) finally: ytdl.clearDownloadParams() signalPayload['path'] = ytdl._lastDownloadedFilePath AddonSignals.sendSignal('download.finished', signalPayload, sourceID='script.module.youtube.dl') return DownloadResult(True, filepath=ytdl._lastDownloadedFilePath) def mightHaveVideo(url, resolve_redirects=False): """ Returns True if the url matches against one of the handled site URLs. """ if resolve_redirects: try: url = resolve_http_redirect(url) except: util.ERROR('mightHaveVideo(): Failed to resolve URL') return False
def unregister_slot(callback, signal=None): """Remove a registered callback from AddonSignals""" name = signal if signal else callback.__name__ AddonSignals.unRegisterSlot(signaler_id=G.ADDON_ID, signal=name) LOG.debug('Unregistered AddonSignals slot {}', name)