labels = plugin.get_storage('labels') thumbnails = plugin.get_storage('thumbnails') output_folder = "special://profile/addon_data/plugin.program.simple.favourites/folders" xbmcvfs.mkdirs(output_folder) for folder in folders: thumbnail = folders.get(folder,'') path = "%s/%s/" % (output_folder,folder) xbmcvfs.mkdirs(path) xbmcvfs.File("%sicon.txt","wb").write(thumbnail) for url in sorted(urls, key=lambda x: labels[x]): folder = folder_urls.get(url,'') label = labels[url] thumbnail = thumbnails[url] if folder: path = "%s/%s" % (output_folder,folder) else: path = output_folder favourites_file = "%s/favourites.xml" % path play_url = escape('ActivateWindow(10025,"%s")' % (url)) add_favourite(favourites_file,label,play_url,thumbnail) if __name__ == '__main__': plugin.run() if big_list_view == True: view_mode = int(plugin.get_setting('view_mode')) plugin.set_view_mode(view_mode)
'path': plugin.url_for('now_next', favourites='true' ), } , { 'label': '[COLOR green][B]Favourites[/B][/COLOR]: [COLOR orange]Channel Listings[/COLOR] full', 'path': plugin.url_for('channels', favourites='true' ), } , { 'label': '[COLOR red][B]All[/B][/COLOR]: [COLOR yellow]Now Next After[/COLOR] popular', 'path': plugin.url_for('now_next', favourites='false'), } , { 'label': '[COLOR red][B]All[/B][/COLOR]: [COLOR orange]Channel Listings[/COLOR] full', 'path': plugin.url_for('channels', favourites='false'), } , { 'label': '[B]Favourites[/B]: Toggle', 'path': plugin.url_for('set_favourites' ), } , ] return items if __name__ == '__main__': plugin.run() if index_page == False: plugin.set_view_mode(51)
'label': video['name'], 'path': plugin.url_for('sources', url=video['href']) # 'thumbnail': video['thumb'] # 'icon': video['thumb'] } for video in videos ] sorted_items = items pageno = int(page) + 1 nextpage = { 'label': ' 下一页', 'path': plugin.url_for('category', url=url, page=pageno) } sorted_items.append(nextpage) return sorted_items @plugin.route('/') def index(): categories = get_categories() items = [{ 'label': category['name'], 'path': plugin.url_for('category', url=category['link'], page=1), } for category in categories] #sorted_items = sorted(items, key=lambda item: item['label']) return items if __name__ == '__main__': plugin.run() plugin.set_view_mode(500)
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)
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')
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')
items.append({ 'label': "Channels", 'path': plugin.url_for('channel_list'), 'thumbnail': 'special://home/addons/plugin.program.fixtures/resources/img/tv.png', 'context_menu': context_items, }) dates = [] now = datetime.datetime.now() for i in range(2, 26): day = datetime.datetime.now() + timedelta(days=i) date = day.strftime("%d-%m-%Y") dates.append(date) for day in ["Today", "Tomorrow"] + dates: items.append({ 'label': day, 'path': plugin.url_for('sports_index', day=day.lower()), 'thumbnail': 'special://home/addons/plugin.program.fixtures/icon.png', }) return items if __name__ == '__main__': plugin.run() if big_list_view: plugin.set_view_mode(51)
fpin = file(savedpath) rawjson = fpin.read() sitems = json.loads(rawjson) fpin.close() else: return [] for item in sitems: li = ListItem.from_dict(**item) li.add_context_menu_items( [('Remove Saved Show', 'RunPlugin("{0}")'.format(plugin.url_for(removeshow, name=li.label, link=li.path)),)]) litems.append(li) except: pass return litems 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(plugin.get_setting('viewmode'))
'label': HTMLParser.HTMLParser().unescape(title.decode('utf-8')), 'path': plugin.url_for('play',id=id), 'thumbnail':get_icon_path('tv'), }) return items @plugin.route('/') def index(): items = [ { 'label': 'Channels', 'path': plugin.url_for('channels'), 'thumbnail':get_icon_path('tv'), }, { 'label': 'Olympics', 'path': plugin.url_for('olympics'), 'thumbnail':get_icon_path('tv'), }, ] return items if __name__ == '__main__': plugin.run() if big_list_view == True: view_mode = int(plugin.get_setting('view_mode')) plugin.set_view_mode(view_mode)