def fetch(self, url, params=None, data=None, **request_params): try: with Timer(logger=self.log, name='Fetching URL %s with params %r' % (url, params)): response = self.session.request('post' if data else 'get', url, params=params, data=data, **request_params) response.raise_for_status() if data: self.save_cookies() return response except Timeout as e: raise LocalizedError(32000, "Timeout while fetching URL: %s (%%s)" % url, plugin.get_string(30000), cause=e) except NoValidProxiesFound as e: raise LocalizedError(32005, "Can't find anonymous proxy", cause=e) except RequestException as e: raise LocalizedError(32001, "Can't fetch URL: %s (%%s)" % url, plugin.get_string(30000), cause=e) except ProxyListException as e: plugin.set_setting('use-proxy', 0) raise LocalizedError(32004, "Can't load anonymous proxy list", cause=e)
def item_menu(self): if self.favorited == True: return (plugin.get_string( 50001 ), "RunPlugin(plugin://plugin.video.lostfilm.tv/addtofavourites/%s)" % self.id) else: return (plugin.get_string( 50000 ), "RunPlugin(plugin://plugin.video.lostfilm.tv/addtofavourites/%s)" % self.id)
def select_torrent_link(series_id, season_number, episode_number, select_quality=False): dom_parser = get_dom_parser() links = dom_parser.get_torrent_links(series_id, season_number, episode_number) qualities = sorted(Quality) quality = plugin.get_setting('quality', int) ordered_links = [ next((l for l in links if l.quality == q), None) for q in qualities ] if not quality or select_quality or not ordered_links[quality - 1]: filtered_links = [l for l in ordered_links if l] if not filtered_links: return options = [ "%s / %s" % (tf.color(l.quality.localized, 'white'), tf.human_size(l.size)) for l in filtered_links ] res = xbmcgui.Dialog().select(plugin.get_string(40400), options) if res < 0: return return filtered_links[res] else: return ordered_links[quality - 1]
def launch(): try: plugin.run() except LocalizedError as e: e.log() if e.kwargs.get('dialog'): xbmcgui.Dialog().ok(plugin.get_string(30000), *e.localized.split("|")) else: plugin.notify(e.localized) if e.kwargs.get('check_settings'): plugin.open_settings()
def launch(): try: plugin.run() except LocalizedError as e: e.log() if e.kwargs.get('dialog'): xbmcgui.Dialog().ok( plugin.get_string(30000), *e.localized.split("|") ) else: plugin.notify(e.localized) if e.kwargs.get('check_settings'): plugin.open_settings()
def select_torrent_link(series_id, season_number, episode_number, select_quality = False): dom_parser = get_dom_parser() links = dom_parser.get_torrent_links(series_id, season_number, episode_number) qualities = sorted(Quality) quality = plugin.get_setting('quality', int) ordered_links = [next((l for l in links if l.quality == q), None) for q in qualities] if not quality or select_quality or not ordered_links[quality - 1]: filtered_links = [l for l in ordered_links if l] if not filtered_links: return options = ["%s / %s" % (tf.color(l.quality.localized, 'white'), tf.human_size(l.size)) for l in filtered_links] res = xbmcgui.Dialog().select(plugin.get_string(40400), options) if res < 0: return return filtered_links[res] else: return ordered_links[quality - 1]
def localized(self): return plugin.get_string(self.lang_code) % self.reason_args
def notify(message, delay=10000): plugin.notify(message, plugin.get_string(30000), delay, plugin.addon.getAddonInfo('icon'))
def info_menu(self): # info_menu(s) + library_menu(s) + mark_series_watched_menu(s), return (plugin.get_string(40306), "Action(Info)")
def info_menu(self): # info_menu(s) + library_menu(s) + mark_series_watched_menu(s), return (plugin.get_string(50001), "RunPlugin(plugin://plugin.video.lostfilm.tv/addtofavourites/%s)" % self.id)
def item_menu(self): if self.favorited == True: return (plugin.get_string(50001), "RunPlugin(plugin://plugin.video.lostfilm.tv/addtofavourites/%s)" % self.id) else: return (plugin.get_string(50000), "RunPlugin(plugin://plugin.video.lostfilm.tv/addtofavourites/%s)" % self.id)
def localized(self): return plugin.get_string(self.lang_id)
def info_menu(self): # info_menu(s) + library_menu(s) + mark_series_watched_menu(s), return ( plugin.get_string(50001), "RunPlugin(plugin://plugin.video.lostfilm.tv/addtofavourites/%s)" % self.id)