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) return item else: plugin.set_resolved_url(url) #url) #plugurl = 'plugin://plugin.video.live.streamspro/?url={0}'.format(urllib.quote_plus(url)) #item = ListItem.from_dict(path=plugurl) #item.add_stream_info('video', stream_values={}) #item.set_is_playable(True) #plugin.notify(msg="RESOLVE FAIL: {0}".format(url.split('.', 1)[-1]),title="Trying {0}".format(item.path.split('.', 1)[-1]), delay=2000) 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)
vitem.set_info(type='video', info_labels={'Title': url}) vitem.add_stream_info(stream_type='video', stream_values={}) plugin.set_resolved_url(resolved) return plugin.play_video(vitem) except: plugin.notify(msg="Failed to resolve {0} to a playable video.".format(url)) try: if resolved is None or len(resolved) < 5: import YoutubeDLWrapper ytdl = YoutubeDLWrapper._getYTDL() ytdl.clearDownloadParams() resolved = ytdl.extract_info(url, download=False) vitem = ListItem(label=url, path=resolved) vitem.is_folder = False vitem.set_is_playable = True vitem.set_info(type='video', info_labels={'Title': url}) vitem.add_stream_info(stream_type='video', stream_values={}) plugin.set_resolved_url(resolved) return plugin.play_video(vitem) except: plugin.notify(msg="Failed to resolve {0} to a playable video.".format(url)) return None if __name__ == '__main__': plugin.run() mode = int(plugin.get_setting(key='viewmode')) if mode is not None and mode >= 0: VIEWMODE = mode plugin.set_view_mode(view_mode_id=VIEWMODE) plugin.set_content('movies')
return plugin.play_video(vitem) except: plugin.notify( msg="Failed to resolve {0} to a playable video.".format(url)) try: if resolved is None or len(resolved) < 5: import YoutubeDLWrapper ytdl = YoutubeDLWrapper._getYTDL() ytdl.clearDownloadParams() resolved = ytdl.extract_info(url, download=False) vitem = ListItem(label=url, path=resolved) vitem.is_folder = False vitem.set_is_playable = True vitem.set_info(type='video', info_labels={'Title': url}) vitem.add_stream_info(stream_type='video', stream_values={}) plugin.set_resolved_url(resolved) return plugin.play_video(vitem) except: plugin.notify( msg="Failed to resolve {0} to a playable video.".format(url)) return None if __name__ == '__main__': plugin.run() mode = int(plugin.get_setting(key='viewmode')) if mode is not None and mode >= 0: VIEWMODE = mode plugin.set_view_mode(view_mode_id=VIEWMODE) plugin.set_content('movies')
def show_search_results(query, index='1'): return api.search_items(query, index) @plugin.route('/favorites') def show_favorites(): return api.get_favorites() @plugin.route('/favorites/add/<title>/<station_id>') def add_to_favorites(title, station_id): if api.add_favorite(title, station_id): plugin.notify(plugin.get_string(30122).encode('utf-8')) else: plugin.notify(plugin.get_string(30124).encode('utf-8')) @plugin.route('/favorites/remove/<station_id>') def remove_from_favorites(station_id): removed = api.remove_favorite(station_id) plugin.redirect(plugin.url_for('index')) if removed: plugin.notify(plugin.get_string(30123).encode('utf-8')) if __name__ == '__main__': plugin.run() plugin.set_content('songs') # cache = plugin.get_storage('favorites') # cache.clear()