def load_favorite_tv_shows(req_attrib, modelMap): context = AddonContext() filepath = file.resolve_file_path(context.get_addon_data_path(), extraDirPath='data', filename='DTB_Favorites.json', makeDirs=False) logging.getLogger().debug('loading favorite tv shows from file : %s' % filepath) favorite_tv_shows = _read_favorite_tv_shows_cache_(filepath) if favorite_tv_shows is None: return favorite_tv_shows_items = [] tv_show_names = favorite_tv_shows.keys() tv_show_names.sort() for tv_show_name in tv_show_names: favorite_tv_show = favorite_tv_shows[tv_show_name] item = xbmcgui.ListItem( label=tv_show_name, iconImage=favorite_tv_show['tv-show-thumb'], thumbnailImage=favorite_tv_show['tv-show-thumb']) item.setProperty('channel-type', favorite_tv_show['channel-type']) item.setProperty('channel-name', favorite_tv_show['channel-name']) item.setProperty('tv-show-name', tv_show_name) item.setProperty('tv-show-url', favorite_tv_show['tv-show-url']) item.setProperty('tv-show-thumb', favorite_tv_show['tv-show-thumb']) favorite_tv_shows_items.append(item) modelMap['favorite_tv_shows_items'] = favorite_tv_shows_items
def check_wish(req_attrib, modelMap): logging.getLogger().debug('Wish needed ***********************') logging.getLogger().debug('Wish settings = %s' % AddonContext().get_addon().getSetting('wishDisplayed')) displayedCounter = AddonContext().get_addon().getSetting('wishDisplayed') if displayedCounter == '' or displayedCounter == 'hide': return 'redirect:displaySourceList'
def add_tv_show_favorite(req_attrib, modelMap): logging.getLogger().debug('add tv show favorite...') tv_show_url = req_attrib['tv-show-url'] tv_show_name = req_attrib['tv-show-name'] tv_show_thumb = req_attrib['tv-show-thumb'] channel_type = req_attrib['channel-type'] channel_name = req_attrib['channel-name'] logging.getLogger().debug('add tv show favorite...' + tv_show_url) favorites = CacheManager().get('dtb_tv_favorites') if favorites is None: favorites = {} elif favorites.has_key(tv_show_name): favorites.pop(tv_show_name) favorites[tv_show_name] = { 'tv-show-name': tv_show_name, 'tv-show-thumb': tv_show_thumb, 'tv-show-url': tv_show_url, 'channel-name': channel_name, 'channel-type': channel_type } context = AddonContext() filepath = file.resolve_file_path(context.get_addon_data_path(), extraDirPath='data', filename='DTB_Favorites.json', makeDirs=False) logging.getLogger().debug(favorites) _write_favorite_tv_shows_cache_(filepath, favorites) notification = "XBMC.Notification(%s,%s,%s,%s)" % ( tv_show_name, 'ADDED TO FAVORITES', 2500, tv_show_thumb) xbmc.executebuiltin(notification)
def check_cache(req_attrib, modelMap): logging.getLogger().debug('Check cache for DTF ***********************') logging.getLogger().debug(req_attrib) refresh_cache = True context = AddonContext() filepath = file.resolve_file_path(context.get_addon_data_path(), extraDirPath='data', filename='DTF_Channels.json', makeDirs=True) logging.getLogger().debug(filepath) refresh = context.get_addon().getSetting('dtfForceRefresh') if refresh == None or refresh != 'true': modified_time = file.get_last_modified_time(filepath) if modified_time is not None: diff = long((time.time() - modified_time) / 3600) if diff < 720: refresh_cache = False else: logging.getLogger().debug( 'DTF_Channels.json was last created 30 days ago, refreshing data.' ) else: logging.getLogger().debug('Request to force refresh.') modelMap['refresh_cache'] = refresh_cache modelMap['cache_filepath'] = filepath
def remove_favorite(req_attrib, modelMap): logging.getLogger().debug('remove tv show favorite...') favorite = CacheManager().get('selected_favorite') favorite_thumb = CacheManager().get('selected_favorite_thumb') favorites = CacheManager().get('tv_favorites') if favorites is None: favorites = {} elif favorites.has_key(favorite): favorites.pop(favorite) context = AddonContext() filepath = file.resolve_file_path(context.get_addon_data_path(), extraDirPath='data', filename='DTB_Favorites.json', makeDirs=False) logging.getLogger().debug(favorites) _write_favorite_tv_shows_cache_(filepath, favorites) notification = "XBMC.Notification(%s,%s,%s,%s)" % (favorite, 'REMOVED FAVORITE', 2500, favorite_thumb) xbmc.executebuiltin(notification) modelMap['reload_favorite_tv_shows_items'] = True if len(favorites) > 0: favorite_tv_shows_items = [] for tv_show_name in favorites: favorite_tv_show = favorites[tv_show_name] item = xbmcgui.ListItem(label=tv_show_name, iconImage=favorite_tv_show['tv-show-thumb'], thumbnailImage=favorite_tv_show['tv-show-thumb']) item.setProperty('channel-type', favorite_tv_show['channel-type']) item.setProperty('channel-name', favorite_tv_show['channel-name']) item.setProperty('tv-show-name', tv_show_name) item.setProperty('tv-show-url', favorite_tv_show['tv-show-url']) item.setProperty('tv-show-thumb', favorite_tv_show['tv-show-thumb']) favorite_tv_shows_items.append(item) modelMap['favorite_tv_shows_items'] = favorite_tv_shows_items
def determine_source(req_attrib, modelMap): if req_attrib is not None and req_attrib.has_key('source-id'): AddonContext().get_addon().setSetting('tvShowsSource', req_attrib['source-id']) sourceChosen = int(AddonContext().get_addon().getSetting('tvShowsSource')) if sourceChosen == 0: return 'redirect:dr-checkCache' elif sourceChosen == 1: return 'redirect:dtb-checkCache'
def test_load_xml(self): addon_context = AddonContext( addon_id="addon.id", conf={ "contextFiles": ["xoze.xml"], "webServiceEnabled": True, "webServicePath": "/Xoze", "webServicePort": 8080, }, ) addon_context.do_clean() pass
def load_tv_shows(req_attrib, modelMap): logging.getLogger().debug('load tv shows...') tv_channels = CacheManager().get('dtb_tv_data')['channels'] channel_name = req_attrib['channel-name'] tv_channel = tv_channels[channel_name] channel_type = tv_channel['channelType'] modelMap['channel_image'] = tv_channel['iconimage'] modelMap['channel_name'] = channel_name selected_tv_show_name = '' if req_attrib.has_key('tv-show-name'): selected_tv_show_name = req_attrib['tv-show-name'] tv_show_items = [] index = 0 if tv_channel.has_key('running_tvshows'): tv_shows = tv_channel['running_tvshows'] logging.getLogger().debug('total tv shows to be displayed: %s' % str(len(tv_shows))) index = _prepare_tv_show_items_(tv_shows, channel_type, channel_name, selected_tv_show_name, tv_show_items, False, modelMap, index) hideFinishedShow = AddonContext().get_addon().getSetting('drHideFinished') if tv_channel.has_key( 'finished_tvshows' ) and hideFinishedShow is not None and hideFinishedShow == 'false': tv_shows = tv_channel["finished_tvshows"] logging.getLogger().debug( 'total finsihed tv shows to be displayed: %s' % str(len(tv_shows))) index = _prepare_tv_show_items_(tv_shows, channel_type, channel_name, selected_tv_show_name, tv_show_items, True, modelMap, index) modelMap['tv_show_items'] = tv_show_items
def load_favorite_tv_shows(req_attrib, modelMap): context = AddonContext() filepath = file.resolve_file_path(context.get_addon_data_path(), extraDirPath='data', filename='DR_Favorites.json', makeDirs=False) logging.getLogger().debug('loading favorite tv shows from file : %s' % filepath) favorite_tv_shows = _read_favorite_tv_shows_cache_(filepath) if favorite_tv_shows is None: return favorite_tv_shows_items = [] for tv_show_name in favorite_tv_shows: favorite_tv_show = favorite_tv_shows[tv_show_name] item = xbmcgui.ListItem(label=tv_show_name, iconImage=favorite_tv_show['tv-show-thumb'], thumbnailImage=favorite_tv_show['tv-show-thumb']) item.setProperty('channel-type', favorite_tv_show['channel-type']) item.setProperty('channel-name', favorite_tv_show['channel-name']) item.setProperty('tv-show-name', tv_show_name) item.setProperty('tv-show-url', favorite_tv_show['tv-show-url']) item.setProperty('tv-show-thumb', favorite_tv_show['tv-show-thumb']) favorite_tv_shows_items.append(item) modelMap['favorite_tv_shows_items'] = favorite_tv_shows_items
def check_cache(req_attrib, modelMap): logging.getLogger().debug('DTB - Check cache ***********************') logging.getLogger().debug(req_attrib) refresh_cache = True context = AddonContext() filepath = file.resolve_file_path(context.get_addon_data_path(), extraDirPath='data', filename='DTB_Channels.json', makeDirs=True) refresh = context.get_addon().getSetting('dtbForceRefresh') if refresh == None or refresh != 'true': modified_time = file.get_last_modified_time(filepath) if modified_time is not None: diff = long((time.time() - modified_time) / 3600) if diff < 720: refresh_cache = False else: logging.getLogger().debug('DTB_Channels.json was last created 30 days ago, refreshing data.') else: logging.getLogger().debug('Request to force refresh.') modelMap['refresh_cache'] = refresh_cache modelMap['cache_filepath'] = filepath
def remove_favorite(req_attrib, modelMap): logging.getLogger().debug('remove tv show favorite...') favorite = CacheManager().get('dtb_selected_favorite') favorite_thumb = CacheManager().get('dtb_selected_favorite_thumb') favorites = CacheManager().get('dtb_tv_favorites') if favorites is None: favorites = {} elif favorites.has_key(favorite): favorites.pop(favorite) context = AddonContext() filepath = file.resolve_file_path(context.get_addon_data_path(), extraDirPath='data', filename='DTB_Favorites.json', makeDirs=False) logging.getLogger().debug(favorites) _write_favorite_tv_shows_cache_(filepath, favorites) notification = "XBMC.Notification(%s,%s,%s,%s)" % ( favorite, 'REMOVED FAVORITE', 2500, favorite_thumb) xbmc.executebuiltin(notification) modelMap['reload_favorite_tv_shows_items'] = True if len(favorites) > 0: favorite_tv_shows_items = [] for tv_show_name in favorites: favorite_tv_show = favorites[tv_show_name] item = xbmcgui.ListItem( label=tv_show_name, iconImage=favorite_tv_show['tv-show-thumb'], thumbnailImage=favorite_tv_show['tv-show-thumb']) item.setProperty('channel-type', favorite_tv_show['channel-type']) item.setProperty('channel-name', favorite_tv_show['channel-name']) item.setProperty('tv-show-name', tv_show_name) item.setProperty('tv-show-url', favorite_tv_show['tv-show-url']) item.setProperty('tv-show-thumb', favorite_tv_show['tv-show-thumb']) favorite_tv_shows_items.append(item) modelMap['favorite_tv_shows_items'] = favorite_tv_shows_items
def check_cache(req_attrib, modelMap): logging.getLogger().debug("Check cache for DTF ***********************") logging.getLogger().debug(req_attrib) refresh_cache = True context = AddonContext() filepath = file.resolve_file_path( context.get_addon_data_path(), extraDirPath="data", filename="DTF_Channels.json", makeDirs=True ) logging.getLogger().debug(filepath) refresh = context.get_addon().getSetting("dtfForceRefresh") if refresh == None or refresh != "true": modified_time = file.get_last_modified_time(filepath) if modified_time is not None: diff = long((time.time() - modified_time) / 3600) if diff < 720: refresh_cache = False else: logging.getLogger().debug("DTF_Channels.json was last created 30 days ago, refreshing data.") else: logging.getLogger().debug("Request to force refresh.") modelMap["refresh_cache"] = refresh_cache modelMap["cache_filepath"] = filepath
def add_tv_show_favorite(req_attrib, modelMap): logging.getLogger().debug('add tv show favorite...') tv_show_url = req_attrib['tv-show-url'] tv_show_name = req_attrib['tv-show-name'] tv_show_thumb = req_attrib['tv-show-thumb'] channel_type = req_attrib['channel-type'] channel_name = req_attrib['channel-name'] logging.getLogger().debug('add tv show favorite...' + tv_show_url) favorites = CacheManager().get('dtb_tv_favorites') if favorites is None: favorites = {} elif favorites.has_key(tv_show_name): favorites.pop(tv_show_name) favorites[tv_show_name] = {'tv-show-name':tv_show_name, 'tv-show-thumb':tv_show_thumb, 'tv-show-url':tv_show_url, 'channel-name':channel_name, 'channel-type':channel_type} context = AddonContext() filepath = file.resolve_file_path(context.get_addon_data_path(), extraDirPath='data', filename='DTB_Favorites.json', makeDirs=False) logging.getLogger().debug(favorites) _write_favorite_tv_shows_cache_(filepath, favorites) notification = "XBMC.Notification(%s,%s,%s,%s)" % (tv_show_name, 'ADDED TO FAVORITES', 2500, tv_show_thumb) xbmc.executebuiltin(notification)
def _retrieve_playlist_streams_(progress_bar, playlist_items): lazyLoadStream = AddonContext().get_addon().getSetting('drLazyLoadStream') current_index = 1 total_iteration = len(playlist_items) video_items = [] for item in playlist_items: logging.getLogger().debug('About to retrieve video link %s' % item) video_item = None if lazyLoadStream is None or lazyLoadStream == 'false': video_item = SnapVideo().resolveVideoStream(item['videoLink']) else: video_item = _create_video_stream_item(item['videoLink'], str(current_index)) video_items.append(video_item) percent = (current_index * 100) / total_iteration progress_bar.setPercent(percent) current_index = current_index + 1 return video_items
def handle_init(window, control_id): window.getControl(100).setVisible(False) window.getControl(200).setVisible(False) window.getControl(300).setVisible(False) window.getControl(400).setVisible(False) window.getControl(500).setVisible(False) window.getControl(600).setVisible(False) window.getControl(700).setVisible(False) window.getControl(800).setVisible(False) window.getControl(900).setVisible(False) window.getControl(1000).setVisible(False) window.getControl(1100).setVisible(True) window.setFocusId(1100) displayBackControl = AddonContext().get_addon().getSetting('displayBackControl') if displayBackControl is not None and displayBackControl == 'true': window.getControl(10).setVisible(True) else: window.getControl(10).setVisible(False)
def watch_live(req_attrib, modelMap): channel_name = req_attrib['channel-name'] live_filepath = file.resolve_file_path( AddonContext().get_addon_data_path(), extraDirPath='data', filename='Live.json', makeDirs=True) live_file_channels = _read_live_tv_channels_cache_(live_filepath) tv_channel = None if LIVE_CHANNELS.has_key(channel_name): tv_channel = LIVE_CHANNELS[channel_name] if live_file_channels is not None and live_file_channels.has_key( channel_name): tv_channel = live_file_channels[channel_name] item = xbmcgui.ListItem(label=channel_name, iconImage=tv_channel['iconimage'], thumbnailImage=tv_channel['iconimage']) item.setProperty('streamLink', tv_channel['channelUrl']) modelMap['live_item'] = item
def display_wish(req_attrib, modelMap): logging.getLogger().debug('Wish needed ***********************') displayedCounter = int( AddonContext().get_addon().getSetting('wishDisplayed')) modelMap['displayedCounter'] = displayedCounter
def end_menu(req_attrib, modelMap): logging.getLogger().debug('end menu ***********************') if int(AddonContext().get_addon().getSetting('tvShowsSource')) == 0: return 'redirect:displaySourceList' else: return 'redirect:end'
def determine_source(req_attrib, modelMap): sourceChosen = int(AddonContext().get_addon().getSetting('tvShowsSource')) if sourceChosen == 0: return 'redirect:dr-checkCache' elif sourceChosen == 1: return 'redirect:dtf-checkCache'
def refresh_cache(req_attrib, modelMap): if not modelMap['refresh_cache']: return logging.getLogger().debug('Reloading cache...') tv_data = { "channels": { "UTV Stars": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/uu/utv_stars.jpg", "channelType": "IND", "running_tvshows_url": "/television/utv-stars/" }, "Star Plus": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/ss/star_plus_in_hd.jpg", "channelType": "IND", "running_tvshows_url": "/television/star-plus/" }, "Zee TV": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/zz/zee_tv.jpg", "channelType": "IND", "running_tvshows_url": "/television/zee-tv/" }, "Sony TV": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/ss/set_in.jpg", "channelType": "IND", "running_tvshows_url": "/television/sony-tv/" }, "Life OK": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/ll/life_ok_in.jpg", "channelType": "IND", "running_tvshows_url": "/television/life-ok/" }, "Star Utsav": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/ss/star_utsav.jpg", "channelType": "IND", "running_tvshows_url": "/television/star-utsav/" }, "Sahara One": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/ss/sahara_one.jpg", "channelType": "IND", "running_tvshows_url": "/television/sahara-one/" }, "Colors TV": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/cc/colors_in.jpg", "channelType": "IND", "running_tvshows_url": "/television/colors-tv/" }, "Sab TV": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/ss/sony_sab_tv.jpg", "channelType": "IND", "running_tvshows_url": "/television/sabtv/" }, "MTV": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/mm/mtv_india.jpg", "channelType": "IND", "running_tvshows_url": "/television/mtv/" }, "Bindass TV": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/uu/utv_bindass.jpg", "channelType": "IND", "running_tvshows_url": "/television/bindass-tv/" }, "Channel [V]": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/cc/channel_v_in.jpg", "channelType": "IND", "running_tvshows_url": "/television/channel-v/" }, "DD National": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/dd/dd_national.jpg", "channelType": "IND", "running_tvshows_url": "/television/dd-national/" }, "Sun TV": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/ss/sun_tv_in.jpg", "channelType": "IND", "running_tvshows_url": "/television/sun-tv/" }, "Big Magic": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/bb/big_magic.jpg", "channelType": "IND", "running_tvshows_url": "/television/big-magic/" }, "Star One": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/ss/star_one.jpg", "channelType": "IND", "running_tvshows_url": "/television/star-one-tv/" }, "Star World Premiere HD": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/ss/star_world_premiere_hd_in.jpg", "channelType": "IND", "running_tvshows_url": "/television/star-world-premiere-hd/" }, "Star World": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/ss/star_world_in_hd.jpg", "channelType": "IND", "running_tvshows_url": "/television/star-world/" }, "NDTV Imagine": { "iconimage": "http://upload.wikimedia.org/wikipedia/en/thumb/f/f7/NDTV_Imagine.svg/200px-NDTV_Imagine.svg.png", "channelType": "IND", "running_tvshows_url": "/television/ndtv-imagine/" }, "Real TV": { "iconimage": "http://upload.wikimedia.org/wikipedia/en/8/82/RealTv.jpg", "channelType": "IND", "running_tvshows_url": "/television/real-tv/" }, "AXN": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/aa/axn_in.jpg", "channelType": "IND", "running_tvshows_url": "/television/axn/" }, "9X INX Media": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/num/9x_in.jpg", "channelType": "IND", "running_tvshows_url": "/television/9x-inx-media/" }, "Awards & Concerts": { "iconimage": "http://1.bp.blogspot.com/-63HEiUpB9rk/T2oJwqA-O8I/AAAAAAAAG78/g4WdztLscJE/s1600/filmfare-awards-20121.jpg", "channelType": "IND", "running_tvshows_url": "/television/shows-concerts/" } } } current_index = 0 tv_channels = tv_data['channels'] total_iteration = len(tv_channels) progress_bar = modelMap['progress_control'] for tv_channel_name, tv_channel in tv_channels.iteritems(): logging.getLogger().debug('About to retrieve tv shows for channel %s' % tv_channel_name) __retrieve_channel_tv_shows__(tv_channel_name, tv_channel) current_index = current_index + 1 percent = (current_index * 100) / total_iteration progress_bar.setPercent(percent) status = jsonfile.write_file(modelMap['cache_filepath'], tv_data) if status is not None: logging.getLogger().debug('Saved status = ' + str(status)) CacheManager().put('tv_data', tv_data) AddonContext().get_addon().setSetting('dtfForceRefresh', 'false')
if response['status'] == 'success': logging.getLogger().debug(response['streamLink']) import xbmcgui, xbmcplugin # @UnresolvedImport xbmcplugin.setResolvedUrl( int(sys.argv[1]), True, xbmcgui.ListItem(path=response['streamLink'])) elif response['status'] == 'exception': logging.getLogger().error(response['message']) else: from xoze.context import AddonContext addon_context = AddonContext( addon_id='plugin.video.xceltv', conf={ 'contextFiles': ['actions.xml', 'dr_actions.xml', 'dtf_actions.xml'], 'webServiceEnabled': True, 'webServicePath': '/xceltv', 'webServicePort': 11421 }) addon_context.get_current_addon().get_action_controller().do_action( 'start') addon_context.do_clean() del addon_context except Exception, e: logging.getLogger().exception(e) raise e
def load_channels(req_attrib, modelMap): logging.getLogger().debug('load channels...') tv_channels = _read_tv_channels_cache_( modelMap['cache_filepath'])['channels'] tv_channel_items = [] live_tv_channel_items = [] display_channel_type = 1 live_channels_all = {} live_channels_all.update(LIVE_CHANNELS) live_filepath = file.resolve_file_path( AddonContext().get_addon_data_path(), extraDirPath='data', filename='Live.json', makeDirs=True) live_file_channels = _read_live_tv_channels_cache_(live_filepath) if live_file_channels is not None: live_channels_all.update(live_file_channels) channel_names = live_channels_all.keys() channel_names.sort() for channel_name in channel_names: channel_obj = live_channels_all[channel_name] if ((display_channel_type == 1 and channel_obj['channelType'] == CHANNEL_TYPE_IND) or (display_channel_type == 0)): item = xbmcgui.ListItem(label=channel_name, iconImage=channel_obj['iconimage'], thumbnailImage=channel_obj['iconimage']) item.setProperty('channel-name', channel_name) item.setProperty('live-link', 'true') item.setProperty('direct-link', 'false') live_tv_channel_items.append(item) for channel_name in DIRECT_CHANNELS: channel_obj = DIRECT_CHANNELS[channel_name] if ((display_channel_type == 1 and channel_obj['channelType'] == CHANNEL_TYPE_IND) or (display_channel_type == 0)): item = xbmcgui.ListItem(label=channel_name, iconImage=channel_obj['iconimage'], thumbnailImage=channel_obj['iconimage']) item.setProperty('channel-name', channel_name) item.setProperty('direct-link', 'true') item.setProperty('live-link', 'false') tv_channel_items.append(item) channel_names = tv_channels.keys() channel_names.sort() for channel_name in channel_names: channel_obj = tv_channels[channel_name] if ((display_channel_type == 1 and channel_obj['channelType'] == CHANNEL_TYPE_IND) or (display_channel_type == 2 and channel_obj['channelType'] == CHANNEL_TYPE_PAK) or (display_channel_type == 0)): item = xbmcgui.ListItem(label=channel_name, iconImage=channel_obj['iconimage'], thumbnailImage=channel_obj['iconimage']) item.setProperty('channel-name', channel_name) item.setProperty('direct-link', 'false') item.setProperty('live-link', 'false') tv_channel_items.append(item) modelMap['tv_channel_items'] = tv_channel_items modelMap['live_tv_channel_items'] = live_tv_channel_items
def refresh_cache(req_attrib, modelMap): if not modelMap['refresh_cache']: return logging.getLogger().debug('Reloading cache...') tv_data = { "channels": { "Star Plus": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/ss/star_plus.png", "channelType": "IND", "running_tvshows_url": "/star-plus/" }, "Zee TV": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/zz/zee_tv.png", "channelType": "IND", "running_tvshows_url": "/zee-tv/" }, "Sony TV": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/ss/set_in.png", "channelType": "IND", "running_tvshows_url": "/sony-tv/" }, "Sony Pal": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/ss/sony_pal_in.png", "channelType": "IND", "running_tvshows_url": "/sony-pal/" }, "Life OK": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/ll/life_ok_in.png", "channelType": "IND", "running_tvshows_url": "/life-ok/" }, "Sahara One": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/ss/sahara_one.png", "channelType": "IND", "running_tvshows_url": "/sahara-one/" }, "Colors TV": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/cc/colors_in.png", "channelType": "IND", "running_tvshows_url": "/colors-tv/" }, "Sab TV": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/ss/sony_sab_tv.png", "channelType": "IND", "running_tvshows_url": "/sab-tv/" }, "&TV": { "iconimage": "http://akamai.vidz.zeecdn.com/zeedigital/AndTV/domain-data/logo/andtv-logo-pink-1421822560.png", "channelType": "IND", "running_tvshows_url": "/and-tv/" }, "MTV": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/mm/mtv_india.png", "channelType": "IND", "running_tvshows_url": "/mtv-channel/" }, "Bindass TV": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/uu/utv_bindass.png", "channelType": "IND", "running_tvshows_url": "/utv-bindass/" }, "Channel [V]": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/cc/channel_v_in.png", "channelType": "IND", "running_tvshows_url": "/channel-v/" }, "Zindagi TV": { "iconimage": "http://www.lyngsat-logo.com/logo/tv/zz/zee_zindagi_in.png", "channelType": "IND", "running_tvshows_url": "/zindagi/" } } } current_index = 0 tv_channels = tv_data['channels'] total_iteration = len(tv_channels) progress_bar = modelMap['progress_control'] channel_image = modelMap['channel_image_control'] for tv_channel_name, tv_channel in tv_channels.iteritems(): logging.getLogger().debug('About to retrieve tv shows for channel %s' % tv_channel_name) channel_image.setImage(tv_channel['iconimage']) channel_image.setVisible(True) loaded_tv_channel = __retrieve_channel_tv_shows__( tv_channel_name, tv_channel['running_tvshows_url']) tv_channel["running_tvshows"] = loaded_tv_channel["running_tvshows"] tv_channel["finished_tvshows"] = loaded_tv_channel["finished_tvshows"] channel_image.setVisible(False) current_index = current_index + 1 percent = (current_index * 100) / total_iteration progress_bar.setPercent(percent) status = jsonfile.write_file(modelMap['cache_filepath'], tv_data) if status is not None: logging.getLogger().debug('Saved status = ' + str(status)) CacheManager().put('dtb_tv_data', tv_data) AddonContext().get_addon().setSetting('dtbForceRefresh', 'false')
logging.getLogger().debug(response['streamLink']) import xbmcgui, xbmcplugin # @UnresolvedImport xbmcplugin.setResolvedUrl( int(sys.argv[1]), True, xbmcgui.ListItem(path=response['streamLink'])) elif response['status'] == 'exception': logging.getLogger().error(response['message']) else: from xoze.context import AddonContext addon_context = AddonContext( addon_id='plugin.video.tvondesizonexl', conf={ 'contextFiles': ['actions.xml', 'dr_actions.xml', 'dtb_actions.xml'], 'webServiceEnabled': True, 'webServicePath': '/TVonDESIZONE', 'webServicePort': 11421 }) import xbmc #@UnresolvedImport xbmc.executebuiltin('Dialog.Close(busydialog)') addon_context.get_current_addon().get_action_controller().do_action( 'start') addon_context.do_clean() del addon_context except Exception, e: logging.getLogger().exception(e) raise e
import logging import sys try: if len(sys.argv) >= 3: from xoze.utils import http sysParams = str(sys.argv[2]) logging.getLogger().debug('Found params %s' % sysParams) params = http.parse_url_params(sysParams) videoLink = params['videoLink'] logging.getLogger().debug(videoLink) client = Server('http://localhost:%d/TVonDESIZONE' % 11421) response = client.resolveStream(videoLink=videoLink) logging.getLogger().debug(response) if response['status'] == 'success': logging.getLogger().debug(response['streamLink']) import xbmcgui, xbmcplugin # @UnresolvedImport xbmcplugin.setResolvedUrl(int(sys.argv[ 1 ]), True, xbmcgui.ListItem(path=response['streamLink'])) elif response['status'] == 'exception': logging.getLogger().error(response['message']) else: from xoze.context import AddonContext addon_context = AddonContext(addon_id='plugin.video.tvondesizonexl', conf={'contextFiles':['actions.xml', 'dr_actions.xml', 'dtb_actions.xml'], 'webServiceEnabled':True, 'webServicePath':'/TVonDESIZONE', 'webServicePort':11421}) addon_context.get_current_addon().get_action_controller().do_action('start') addon_context.do_clean() del addon_context except Exception, e: logging.getLogger().exception(e) raise e