item.add_stream_info('video', stream_values={}) item.set_is_playable(True) plugin.play_video(item) return None except: plugin.notify(msg="Failed: {0}".format(resolved.partition('.')[-1]), title="YOUTUBE-DL", delay=1000) if len(resolved) > 1: plugin.set_resolved_url(resolved) item = ListItem.from_dict(path=resolved) plugin.play_video(item) return None else: plugin.set_resolved_url(url) plugin.play_video(url) return None if __name__ == '__main__': hostname = '' hostname = plugin.get_setting('setHostname') if len(hostname) > 1: hostname = hostname.strip() hostname = hostname.strip('/') if str(hostname).startswith('http'): __BASEURL__ = hostname else: __BASEURL__ = 'https://' + hostname plugin.run() plugin.set_content('episodes') plugin.set_view_mode(0)
plugin.log.error( msg="Tumblr API OAuth settings invalid. This addon requires you to authorize this Addon in your Tumblr account and in turn in the settings you must provide the TOKEN and SECRET that Tumblr returns.\nhttps://api.tumblr.com/console/calls/user/info\n\tUse the Consumer Key and Secret from the addon settings to authorize this addon and the OAUTH Token and Secret the website returns must be put into the settings.") try: # Try an old style API key from off github as a backup so some functionality is provided? TUMBLRAUTH = dict(consumer_key='5wEwFCF0rbiHXYZQQeQnNetuwZMmIyrUxIePLqUMcZlheVXwc4', consumer_secret='GCLMI2LnMZqO2b5QheRvUSYY51Ujk7nWG2sYroqozW06x4hWch', oauth_token='RBesLWIhoxC1StezFBQ5EZf7A9EkdHvvuQQWyLpyy8vdj8aqvU', oauth_secret='GQAEtLIJuPojQ8fojZrh0CFBzUbqQu8cFH5ejnChQBl4ljJB4a') TUMBLRAUTH.update({'api_key', '5wEwFCF0rbiHXYZQQeQnNetuwZMmIyrUxIePLqUMcZlheVXwc4'}) tclient = TumblrRestClient(**TUMBLRAUTH) except: plugin.notify(msg="Read Settings for instructions", title="COULDN'T AUTH TO TUMBLR") viewmode = int(plugin.get_setting('viewmode')) plugin.run() txtout = "-=**" + ("*"*10) + " {0} " + ("*"*10) + "**=-" reqout = "PATH: {0} QUERY: {1}\nURL: {2} ARGS: {3}".format(str(plugin.request.path), str(plugin.request.query_string), str(plugin.request.url), str(plugin.request.args)) txtout = txtout.format(reqout) plugin.log.info(msg=txtout) print (txtout) ctxlist = [] plugin.set_content(content='movies') viewmodel = 51 viewmodet = 500 if str(plugin.request.path).startswith('/taglist/') or plugin.request.path == '/': viewmodel = int(plugin.get_setting('viewmodelist')) if viewmodel == 0: viewmodel = 51 plugin.set_view_mode(viewmodel) else: viewmodet = int(plugin.get_setting('viewmodethumb')) if viewmodet == 0: viewmodet = 500 plugin.set_view_mode(viewmodet)
return None if __name__ == '__main__': # if plugin.get_setting('debugon', converter=bool): web_pdb.set_trace() viewmode = 0 hostname = '' hostname = plugin.get_setting('setHostname') if len(hostname) > 1: hostname = hostname.strip() hostname = hostname.strip('/') if str(hostname).startswith('http'): __BASEURL__ = hostname else: __BASEURL__ = 'https://' + hostname ws.BASEURL = __BASEURL__ ws.Plugin = plugin ws.Remove = removeshow ws.Episode = episode ws.Category = category ws.Save = saveshow ws.Autoplay = autoplay ws.Play = play # funcmaps = {'episode': episode, 'category': category, 'save': saveshow, 'autoplay': autoplay, 'play': play, 'remove': reemoveshow, 'search': search} # ws = WsolUtils(kodiplugin=plugin, **funcmaps) plugin.run() plugin.set_content('episodes') viewmode = plugin.get_setting('viewmode', converter=int) plugin.set_view_mode(view_mode_id=viewmode) # plugin.set_view_mode(plugin.get_setting('viewmode'))
class Router(object): def __init__(self, addonPath, app=None): self.plugin=Plugin() self.app=app or FoxFanFun(self.plugin, addonPath) self.loadMenu() # xbmc.executebuiltin('Container.SetViewMode(500)') # Вид "Эскизы". # xbmc.executebuiltin('Container.SetViewMode(512)') # Вид "Инфо-стена" def loadMenu(self): self.plugin.add_url_rule('/', self.menu_shows, 'menu_shows') self.plugin.add_url_rule('/watch/<showId>', self.menu_seasons, 'menu_seasons') self.plugin.add_url_rule('/watch/<showId>/<seasonId>', self.menu_episodes, 'menu_episodes') self.plugin.add_url_rule('/watch/<showId>/<seasonId>/<episodeId>', self.menu_watch, 'menu_watch') def menu_shows(self): tArr=self.app.listShow() tArr=sorted((v for v in tArr.itervalues()), key=lambda o: o.watched) res=[] self.plugin.set_content('tvshows') for o in reversed(tArr): res.append({ 'label': o.name, # 'path': self.plugin.url_for(self.menu_seasons, showId=o.showId), 'path':'plugin://plugin.video.FoxFanFun/watch/%(showId)s'%o, 'info_type':'video', 'info':{ 'count':o.watched, 'tvshowtitle': o.name, 'mediatype':'tvshow', }, 'icon':o.icon, 'thumbnail':o.cover, 'properties':{ 'fanart_image':o.coverBig, }, }) return res def menu_seasons(self, showId): tArr=self.app.listSeason(showId) tArr=sorted((v for v in tArr.itervalues()), key=lambda o: o.sorter) res=[] for o in reversed(tArr): res.append({ 'label': o.name, 'path':'plugin://plugin.video.FoxFanFun/watch/%(showId)s/%(seasonId)s'%o, 'info_type':'video', 'info':{ 'count':o.sorter, 'tvshowtitle': self.app.data[o.showId].name, 'mediatype':'season', 'season':int(o.seasonId), }, }) return res def menu_episodes(self, showId, seasonId): tArr=self.app.listEpisode(showId, seasonId) tArr=sorted((v for v in tArr.itervalues()), key=lambda o: o.sorter) res=[] self.plugin.set_content('episodes') for o in tArr: res.append({ 'label': o.name, 'path':'plugin://plugin.video.FoxFanFun/watch/%(showId)s/%(seasonId)s/%(episodeId)s'%o, # 'info_type':'video', 'info':{ 'count':o.sorter, 'tvshowtitle':self.app.data[o.showId].name, 'title': o.name, 'mediatype':'episode', 'season':int(o.seasonId), 'episode':int(o.episodeId), 'plot':o.descr, 'plotoutline':o.descr, }, 'thumbnail':o.coverBig, 'properties':{ 'fanart_image':o.coverBig, }, 'is_playable':True, }) res=self.plugin.add_to_playlist(res, playlist='video') return res def menu_watch(self, showId, seasonId, episodeId): o=self.app.watch(showId, seasonId, episodeId) if not o: return [] elif o.get('error'): return [{'label':o.error, 'path':None}] return self.plugin.set_resolved_url(o.file)