def show_streams(title, playlist_id): if mode == title: streams = source.Source().get_streams(playlist_id) if streams: for c in streams: title = c['title'] channel = c['title'] videoId = c['videoId'] img = c['img'] rURL = Addon.plugin_url + "?channel=" + channel + "&videoId=" + videoId + "&mode=play" Addon.add_video_item(rURL, {'title': title}, img=img) elif mode == 'play': videoId = Addon.plugin_queries['videoId'] stream_status = source.Source()._get_json( '/check' + base64.b64decode('LnBocA=='), {'id': videoId})['status'] if stream_status == 'true': stream = "https://www.youtube.com/watch?v=" + videoId stream_url = liveresolver.resolve(stream) item = xbmcgui.ListItem(path=stream_url) xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item) else: dlg.ok(Addon.get_string(5000), Addon.get_string(7000)) exit()
'i': icon, 'q': str(quality), 'u': email, 'p': password } ); if quality==1: quality_name = 'Low'; elif quality==2: quality_name = 'Medium'; else: quality_name = 'High'; Addon.add_video_item(rURL, {'title': title, 'plot': plot, 'mediatype': mediatype, 'plotoutline': plotoutline}, img=logo, fanart=poster_url, HD=quality_name, playable=c['playable']) xbmcplugin.setContent(Addon.plugin_handle, 'episodes') elif mode == 'recordings': stream_type = ['rtmp', 'rtsp'][int(Addon.get_setting('stream_type'))] recordings = ustv.get_recordings(quality_type, stream_type, 'recordings') if recordings: for r in recordings: cm_del = (Addon.get_string(30003), 'XBMC.RunPlugin(%s/?mode=delete&del=%s)' % (Addon.plugin_url, urllib.quote(r['del_url']))) title = '%s - %s (%s on %s)' % (r['title'], r['episode_title'], r['rec_date'], r['channel'])
mode = Addon.plugin_queries['mode'] if mode == 'main': Addon.log(mode) Addon.add_directory({'mode': 'live'}, Addon.get_string(30001)) Addon.add_directory({'mode': 'recordings'}, Addon.get_string(30002)) elif mode == 'live': Addon.log(mode) stream_type = ['rtmp', 'rtsp'][int(Addon.get_setting('stream_type'))] channels = ustv.get_channels(int(Addon.get_setting('quality')), stream_type) for c in channels: Addon.add_video_item(c['url'], {'title': '%s - %s' % (c['name'], c['now']['title']), 'plot': c['now']['plot']}, img=c['icon']) elif mode == 'recordings': Addon.log(mode) stream_type = ['rtmp', 'rtsp'][int(Addon.get_setting('stream_type'))] recordings = ustv.get_recordings(int(Addon.get_setting('quality')), stream_type) for r in recordings: cm_del = (Addon.get_string(30003), 'XBMC.RunPlugin(%s/?mode=delete&del=%s)' % (Addon.plugin_url, urllib.quote(r['del_url']))) title = '%s (%s on %s)' % (r['title'], r['rec_date'], r['channel']) Addon.add_video_item(r['stream_url'], {'title': title, 'plot': r['plot']},
Addon.log('playlist: %s' % play) videos = muzu.get_playlist(play) if Addon.get_setting('random_pl') == 'true': random.shuffle(videos) if Addon.get_setting('auto_pl') == 'true': pl = Addon.get_new_playlist(xbmc.PLAYLIST_VIDEO) #res_dir = os.path.join(Addon.addon.getAddonInfo('path'), 'resources') for v in videos: title = '%s: %s' % (v['artist'], v['title']) Addon.add_video_item( str(v['asset_id']), { 'title': title, #'plot': v['description'], #'duration': str(v['duration']), }, img=v['thumb'], playlist=pl) autoPlay() mode = 'toplevel_playlist' else: for v in videos: title = '%s: %s' % (v['artist'], v['title']) Addon.add_video_item( str(v['asset_id']), { 'title': title, #'plot': v['description'],
mode = Addon.plugin_queries['mode'] if mode == 'main': Addon.log(mode) Addon.add_directory({'mode': 'live'}, Addon.get_string(30001)) Addon.add_directory({'mode': 'recordings'}, Addon.get_string(30002)) elif mode == 'live': Addon.log(mode) stream_type = ['rtmp', 'rtsp'][int(Addon.get_setting('stream_type'))] channels = ustv.get_channels(int(Addon.get_setting('quality')), stream_type) for c in channels: Addon.add_video_item( c['url'], { 'title': '%s - %s' % (c['name'], c['now']['title']), 'plot': c['now']['plot'] }, img=c['icon']) elif mode == 'recordings': Addon.log(mode) stream_type = ['rtmp', 'rtsp'][int(Addon.get_setting('stream_type'))] recordings = ustv.get_recordings(int(Addon.get_setting('quality')), stream_type) for r in recordings: cm_del = (Addon.get_string(30003), 'XBMC.RunPlugin(%s/?mode=delete&del=%s)' % (Addon.plugin_url, urllib.quote(r['del_url']))) title = '%s (%s on %s)' % (r['title'], r['rec_date'], r['channel']) Addon.add_video_item(r['stream_url'], { 'title': title,
'XBMC.RunPlugin(%s/?mode=record&rec=%s&set=%s&mt=%s)' % (Addon.plugin_url, urllib.quote(c['rec_url']),urllib.quote(c['set_url']),urllib.quote(c['mediatype']))) if Addon.get_setting('rec_live') == 'true' and Addon.get_setting('dvr') == 'true': cm_menu = [cm_refresh, cm_rec] elif Addon.get_setting('rec_live') == 'true' and Addon.get_setting('dvr') == 'false' and name in ['CW','ABC','FOX','PBS','CBS','NBC','My9']: cm_menu = [cm_refresh, cm_rec] else: cm_menu = [cm_refresh] if Addon.get_setting('extended_context') == 'true': cm_view = False else: cm_view = True Addon.add_video_item(rURL, {'title': title, 'plot': plot, 'mediatype': mediatype, 'tvshowtitle': tvshowtitle}, img=poster_url, fanart=logo, playable=c['playable'], cm=cm_menu, cm_replace=cm_view) xbmcplugin.setContent(Addon.plugin_handle, 'movie') elif mode == 'recordings': recordings = ustv.get_recordings('recordings') if recordings:
}, Addon.get_string(30000)) if mode == 'list_videos': page = Addon.plugin_queries.get('page', 0) Addon.log('%s: cid=%s page=%s' % (mode, Addon.plugin_queries['cid'], page)) quality = ['360', '480'][int(Addon.get_setting('quality'))] videos = crack.get_videos(Addon.plugin_queries['cid'], quality=quality, page=page) for v in videos['items']: Addon.add_video_item(v['video_url'], { 'title': v['title'], 'plot': v['plot'], 'cast': v['cast'], 'director': v['director'], 'mpaa': v['mpaa'], }, img=v['thumb'], fanart=v['thumb']) if videos['more']: Addon.add_directory( { 'mode': 'list_videos', 'cid': Addon.plugin_queries['cid'], 'page': int(page) + 1, }, Addon.get_string(30000)) Addon.end_of_directory()
'u': email, 'p': password }) if quality == 1: quality_name = 'Low' elif quality == 2: quality_name = 'Medium' else: quality_name = 'High' Addon.add_video_item(rURL, { 'title': title, 'plot': plot, 'mediatype': mediatype, 'plotoutline': plotoutline }, img=logo, fanart=poster_url, HD=quality_name, playable=c['playable']) xbmcplugin.setContent(Addon.plugin_handle, 'episodes') elif mode == 'recordings': stream_type = ['rtmp', 'rtsp'][int(Addon.get_setting('stream_type'))] recordings = ustv.get_recordings(quality_type, stream_type, 'recordings') if recordings: for r in recordings: cm_del = (Addon.get_string(30003), 'XBMC.RunPlugin(%s/?mode=delete&del=%s)' % (Addon.plugin_url, urllib.quote(r['del_url'])))
if Addon.get_setting('rec_live') == 'true' and Addon.get_setting( 'dvr') == 'true': cm_menu = [cm_refresh, cm_rec] elif Addon.get_setting('rec_live') == 'true' and Addon.get_setting( 'dvr') == 'false' and name in [ 'CW', 'ABC', 'FOX', 'PBS', 'CBS', 'NBC', 'My9' ]: cm_menu = [cm_refresh, cm_rec] else: cm_menu = [cm_refresh] Addon.add_video_item(rURL, { 'title': title, 'plot': plot, 'mediatype': mediatype, 'tvshowtitle': tvshowtitle }, img=poster_url, fanart=logo, playable=c['playable'], cm=cm_menu, cm_replace=True) xbmcplugin.setContent(Addon.plugin_handle, 'movie') elif mode == 'recordings': stream_type = ['rtsp', 'rtmp'][int(Addon.get_setting('rec_stream_type'))] recordings_quality = int(Addon.get_setting('quality')) # This ensures that recordings are 1024kbps or less if recordings_quality == 3: recordings_quality = 2 recordings = ustv.get_recordings(int(recordings_quality), stream_type, 'recordings')
stream_url = freedo.resolve_video(play) else: stream_url = freedo.resolve_stream(play) Addon.resolve_url(stream_url) elif mode == 'main': Addon.log(mode) Addon.add_directory({'mode': 'list_live'}, Addon.get_string(30000)) Addon.add_directory({'mode': 'list_vid'}, Addon.get_string(30001)) elif mode == 'list_live': pn = int(Addon.plugin_queries.get('pn', 1)) Addon.log('mode: %s page: %d' % (mode, pn)) channels = freedo.get_channels(pn) for c in channels['channels']: Addon.add_video_item(c['id'], {'title': c['name']}, img=c['img']) if channels['more']: Addon.add_directory({'mode': 'list_live', 'pn': pn + 1}, Addon.get_string(30003)) elif mode == 'list_vid': pn = int(Addon.plugin_queries.get('pn', 1)) Addon.log('mode: %s page: %d' % (mode, pn)) videos = freedo.get_videos(pn) for v in videos['videos']: Addon.add_video_item(v['stream_url'], {'title': v['name']}, img=v['img']) if videos['more']: Addon.add_directory({'mode': 'list_vid', 'pn': pn + 1}, Addon.get_string(30003))
#network = Addon.plugin_queries['network'] Addon.log('playlist: %s' % play) videos = muzu.get_playlist(play) if Addon.get_setting('random_pl') == 'true': random.shuffle(videos) if Addon.get_setting('auto_pl') == 'true': pl = Addon.get_new_playlist(xbmc.PLAYLIST_VIDEO) #res_dir = os.path.join(Addon.addon.getAddonInfo('path'), 'resources') for v in videos: title = '%s: %s' % (v['artist'], v['title']) Addon.add_video_item(str(v['asset_id']), {'title': title, #'plot': v['description'], #'duration': str(v['duration']), }, img=v['thumb'], playlist=pl) autoPlay() mode = 'toplevel_playlist' else: for v in videos: title = '%s: %s' % (v['artist'], v['title']) Addon.add_video_item(str(v['asset_id']), {'title': title, #'plot': v['description'], #'duration': str(v['duration']), }, img=v['thumb'])
email = Addon.get_setting('email') or DEFAULT_EMAIL password = Addon.get_setting('password') or DEFAULT_PASSWORD print "Logging into ustvnow with email %s and password %s" % (email, password) ustv = ustvnow.Ustvnow(email, password) Addon.log('plugin url: ' + Addon.plugin_url) Addon.log('plugin queries: ' + str(Addon.plugin_queries)) Addon.log('plugin handle: ' + str(Addon.plugin_handle)) mode = Addon.plugin_queries['mode'] if mode == 'main': mode = 'live' Addon.log(mode) stream_type = ['rtmp', 'rtsp'][int(Addon.get_setting('stream_type'))] channels = ustv.get_channels(int(Addon.get_setting('quality')), stream_type) for c in channels: Addon.add_video_item(c['url'], {'title': '%s - %s' % (c['name'], c['now']['title']), 'plot': c['now']['plot']}, img=c['icon']) Addon.end_of_directory()
stream_url = freedo.resolve_video(play) else: stream_url = freedo.resolve_stream(play) Addon.resolve_url(stream_url) elif mode == 'main': Addon.log(mode) Addon.add_directory({'mode': 'list_live'}, Addon.get_string(30000)) Addon.add_directory({'mode': 'list_vid'}, Addon.get_string(30001)) elif mode == 'list_live': pn = int(Addon.plugin_queries.get('pn', 1)) Addon.log('mode: %s page: %d' % (mode, pn)) channels = freedo.get_channels(pn) for c in channels['channels']: Addon.add_video_item(c['id'], {'title': c['name']}, img=c['img']) if channels['more']: Addon.add_directory({ 'mode': 'list_live', 'pn': pn + 1 }, Addon.get_string(30003)) elif mode == 'list_vid': pn = int(Addon.plugin_queries.get('pn', 1)) Addon.log('mode: %s page: %d' % (mode, pn)) videos = freedo.get_videos(pn) for v in videos['videos']: Addon.add_video_item(v['stream_url'], {'title': v['name']}, img=v['img']) if videos['more']: Addon.add_directory({
'dvr') == 'false' and name in [ 'CW', 'ABC', 'FOX', 'PBS', 'CBS', 'NBC', 'My9' ]: cm_menu = [cm_refresh, cm_rec] else: cm_menu = [cm_refresh] if Addon.get_setting('extended_context') == 'true': cm_view = False else: cm_view = True Addon.add_video_item(rURL, { 'title': title, 'plot': plot, 'mediatype': mediatype, 'tvshowtitle': tvshowtitle }, img=poster_url, fanart=logo, playable=c['playable'], cm=cm_menu, cm_replace=cm_view) xbmcplugin.setContent(Addon.plugin_handle, 'movie') elif mode == 'recordings': recordings = ustv.get_recordings('recordings') if recordings: for r in recordings: rURL = "plugin://plugin.video.ustvnow/?scheduleid=" + str( r['scheduleid']) + "&mode=play_dvr"
'page': int(page) + 1, }, Addon.get_string(30000)) if mode == 'list_videos': page = Addon.plugin_queries.get('page', 0) Addon.log('%s: cid=%s page=%s' % (mode, Addon.plugin_queries['cid'], page)) quality = ['360', '480'][int(Addon.get_setting('quality'))] videos = crack.get_videos(Addon.plugin_queries['cid'], quality=quality, page=page) for v in videos['items']: Addon.add_video_item(v['video_url'], {'title': v['title'], 'plot': v['plot'], 'cast': v['cast'], 'director': v['director'], 'mpaa': v['mpaa'], }, img=v['thumb'], fanart=v['thumb']) if videos['more']: Addon.add_directory({'mode': 'list_videos', 'cid': Addon.plugin_queries['cid'], 'page': int(page) + 1, }, Addon.get_string(30000)) Addon.end_of_directory()
title = title.replace("&", "&"); title = '%s - %s' % (Addon.cleanChannel(channel), title) cm_refresh = (Addon.get_string(40000), 'XBMC.RunPlugin(%s/?mode=refresh)' % (Addon.plugin_url)) cm_menu = [cm_refresh] if quality == 3 and channel != 'PBS' and channel != 'My9': quality_name = 'High'; elif quality == 2 and channel != 'PBS' and channel != 'My9': quality_name = 'High'; elif quality == 1 and channel != 'PBS' and channel != 'My9': quality_name = 'Medium'; else: quality_name = 'Low'; Addon.add_video_item(rURL, {'title': title}, img=logo, playable=True, HD=quality_name, cm=cm_menu, cm_replace=False) xbmcplugin.setContent(Addon.plugin_handle, 'movie') elif mode == 'refresh': xbmc.executebuiltin('Container.Refresh') elif mode=='play': channel = Addon.plugin_queries['channel'] Addon.log(channel) channels = [] channels = tvtime.TVtime().get_link(quality) if channels: Addon.log(str(channels)) for c in channels: if c['channel'] == channel: