def show_tv_shows_view(modelMap, window): window.getControl(200).setVisible(False) window.getControl(400).setVisible(False) window.getControl(600).setVisible(False) window.getControl(800).setVisible(False) window.getControl(900).setVisible(False) window.getControl(100).setVisible(False) window.getControl(1000).setVisible(False) window.getControl(1100).setVisible(False) window.getControl(1200).setVisible(False) window.getControl(300).setVisible(True) window.getControl(305).setEnabled(True) logging.getLogger().debug('total tv shows: %s' % str(len(modelMap['tv_show_items']))) window.getControl(305).reset() window.getControl(305).addItems(modelMap['tv_show_items']) window.setFocusId(305) if modelMap.has_key('selected_tv_show_item'): window.getControl(305).selectItem(modelMap['selected_tv_show_item']) window.getControl(303).setLabel(modelMap['channel_name']) image = xbmcgui.ControlImage(30, 30, 174, 147, filename=modelMap['channel_image'], aspectRatio=0, colorDiffuse='0xFFF7F7F7') window.addControl(image) CacheManager().put('channel_image', modelMap['channel_image']) controls = CacheManager().get('controls_to_be_deleted') controls.append(image) logging.getLogger().debug('Inside VIEWS:list of temp controls to add size : %s' % str(len(controls)))
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 show_tv_show_options(modelMap, window): image = xbmcgui.ControlImage(30, 30, 174, 147, filename=CacheManager().get('channel_image'), aspectRatio=0, colorDiffuse='0xFFF7F7F7') window.addControl(image) controls = CacheManager().get('controls_to_be_deleted') controls.append(image) if modelMap.has_key('error-occurred') and modelMap['error-occurred']: logging.getLogger().debug('found an error message...') window.getControl(500).setVisible(False) system.hide_busy_dialog() window.getControl(600).setVisible(True) window.getControl(305).setEnabled(True) logging.getLogger().exception(modelMap['error']) else: window.getControl(502).setPercent(100) window.getControl(500).setVisible(False) system.hide_busy_dialog() window.getControl(502).setPercent(0) logging.getLogger().debug(len(modelMap['tv-show-images'])) window.getControl(901).reset() window.getControl(901).addItems(modelMap['tv-show-images']) window.getControl(900).setVisible(True) window.getControl(305).setEnabled(False) window.setFocusId(901) logging.getLogger().debug('list visible')
def show_refresh_view(modelMap, window): logging.getLogger().debug('Refresh cache attribute: %s' % str(modelMap['refresh_cache'])) if modelMap['refresh_cache']: window.getControl(201).setVisible(False) window.getControl(202).setVisible(False) window.getControl(203).setVisible(False) window.getControl(204).setVisible(False) window.getControl(300).setVisible(False) window.getControl(100).setVisible(False) window.getControl(400).setVisible(False) window.getControl(500).setVisible(False) window.getControl(600).setVisible(False) window.getControl(800).setVisible(False) window.getControl(900).setVisible(False) window.getControl(1000).setVisible(False) window.getControl(1100).setVisible(False) window.getControl(1200).setVisible(False) window.getControl(201).setVisible(True) window.getControl(202).setVisible(True) window.getControl(203).setVisible(False) window.getControl(204).setVisible(False) window.getControl(206).setPercent(0) window.getControl(206).setVisible(True) window.getControl(205).setLabel("LOADING TV SHOWS...") window.getControl(200).setVisible(True) modelMap['progress_control'] = window.getControl(206) image = xbmcgui.ControlImage(440, 320, 118, 100, filename="", aspectRatio=0, colorDiffuse='0xFFF7F7F7') window.addControl(image) image.setVisible(False) controls = CacheManager().get('controls_to_be_deleted') controls.append(image) modelMap['channel_image_control'] = image
def show_tv_channel_episodes_view(modelMap, window): window.getControl(200).setVisible(False) window.getControl(300).setVisible(False) window.getControl(400).setVisible(False) window.getControl(600).setVisible(False) window.getControl(800).setVisible(False) window.getControl(900).setVisible(False) window.getControl(100).setVisible(False) window.getControl(1001).setLabel(modelMap['channel_name']) image = xbmcgui.ControlImage(30, 30, 174, 147, filename=modelMap['channel_image'], aspectRatio=0, colorDiffuse='0xFFF7F7F7') window.addControl(image) CacheManager().put('channel_image', modelMap['channel_image']) controls = CacheManager().get('controls_to_be_deleted') controls.append(image) system.hide_busy_dialog() if modelMap.has_key('error-occurred') and modelMap['error-occurred']: logging.getLogger().debug('found an error message...') window.getControl(500).setVisible(False) system.hide_busy_dialog() window.getControl(600).setVisible(True) logging.getLogger().exception(modelMap['error']) else: logging.getLogger().debug('total tv show episodes: %s' % str(len(modelMap['tv_show_episode_items']))) window.getControl(1002).reset() window.getControl(1002).addItems(modelMap['tv_show_episode_items']) window.getControl(1000).setVisible(True) window.getControl(500).setVisible(False) system.hide_busy_dialog() window.getControl(600).setVisible(False) window.setFocusId(1002)
def do_clean(self): logging.getLogger().debug('addon exiting, deleting objects as part of exit plan...') self._xoze_context.do_clean() if self._current_addon is not None: self._current_addon.do_clean() del self._current_addon del self._current_addon_id if self._service_publisher is not None: self._service_publisher.unpublish_services() self._service_publisher.do_clean() del self._service_publisher del self._addon del self._addon_id del self._addon_ver del self._addon_path del self._addon_profile_path del self._configurations del self._xoze_context http_client = HttpClient() http_client.do_clean() del http_client cache_manager = CacheManager() cache_manager.do_clean() del cache_manager snap_video = SnapVideo() snap_video.do_clean() del snap_video
def hide_tv_show_options(modelMap, window): image = xbmcgui.ControlImage(30, 30, 174, 147, filename=CacheManager().get('channel_image'), aspectRatio=0, colorDiffuse='0xFFF7F7F7') window.addControl(image) controls = CacheManager().get('controls_to_be_deleted') controls.append(image) window.getControl(901).reset() window.getControl(900).setVisible(False) window.getControl(305).setEnabled(True) window.setFocusId(305)
def hide_tv_channel_episode_videos_list_view(modelMap, window): image = xbmcgui.ControlImage(30, 30, 174, 147, filename=CacheManager().get('channel_image'), aspectRatio=0, colorDiffuse='0xFFF7F7F7') window.addControl(image) controls = CacheManager().get('controls_to_be_deleted') controls.append(image) window.getControl(800).setVisible(False) window.getControl(1000).setVisible(True) window.getControl(600).setVisible(False) window.getControl(500).setVisible(False) system.hide_busy_dialog() window.setFocusId(1002)
def show_tv_show_episode_videos_view(modelMap, window): image = xbmcgui.ControlImage(30, 30, 174, 147, filename=CacheManager().get('channel_image'), aspectRatio=0, colorDiffuse='0xFFD1EEFC') window.addControl(image) controls = CacheManager().get('controls_to_be_deleted') controls.append(image) if modelMap.has_key('error-occurred') and modelMap['error-occurred']: logging.getLogger().debug('found an error message...') window.getControl(500).setVisible(False) window.getControl(600).setVisible(True) logging.getLogger().exception(modelMap['error']) else: modelMap['progress_control'] = window.getControl(502) window.getControl(501).setLabel('RESOLVING VIDEOS TO BE PLAYED, PLEASE WAIT...')
def show_tv_channel_episode_videos_list_view(modelMap, window): image = xbmcgui.ControlImage(30, 30, 174, 147, filename=CacheManager().get('channel_image'), aspectRatio=0, colorDiffuse='0xFFF7F7F7') window.addControl(image) controls = CacheManager().get('controls_to_be_deleted') controls.append(image) window.getControl(500).setVisible(False) system.hide_busy_dialog() window.getControl(600).setVisible(False) window.getControl(1000).setVisible(False) window.getControl(804).reset() logging.getLogger().debug('Channel name in show_tv_show_episode_videos_list_view = %s' % modelMap['channel-name']) window.getControl(801).setLabel(modelMap['channel-name']) window.getControl(802).setLabel(modelMap['tv-show-name']) window.getControl(803).setLabel(modelMap['episode-name']) window.getControl(804).addItems(modelMap['videos-item-list']) window.getControl(800).setVisible(True) window.setFocusId(804)
def show_tv_show_episodes_view(modelMap, window): image = xbmcgui.ControlImage(30, 30, 174, 147, filename=CacheManager().get('channel_image'), aspectRatio=0, colorDiffuse='0xFFD1EEFC') window.addControl(image) controls = CacheManager().get('controls_to_be_deleted') controls.append(image) if modelMap.has_key('error-occurred') and modelMap['error-occurred']: logging.getLogger().debug('found an error message...') window.getControl(500).setVisible(False) window.getControl(600).setVisible(True) logging.getLogger().exception(modelMap['error']) else: logging.getLogger().debug('total tv show episodes: %s' % str(len(modelMap['tv_show_episode_items']))) window.getControl(305).setEnabled(False) window.getControl(401).reset() window.getControl(401).addItems(modelMap['tv_show_episode_items']) window.getControl(400).setVisible(True) window.getControl(500).setVisible(False) window.getControl(600).setVisible(False) window.setFocusId(401)
def play_video_streams(modelMap, window): image = xbmcgui.ControlImage(30, 30, 174, 147, filename=CacheManager().get('channel_image'), aspectRatio=0, colorDiffuse='0xFFD1EEFC') window.addControl(image) controls = CacheManager().get('controls_to_be_deleted') controls.append(image) window.getControl(500).setVisible(False) if modelMap.has_key('error-occurred') and modelMap['error-occurred']: logging.getLogger().debug('found an error message...') window.getControl(600).setVisible(True) logging.getLogger().exception(modelMap['error']) else: playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO) playlist.clear() video_items = modelMap['video_streams'] logging.getLogger().debug('total video streams found = %s' % str(len(video_items))) for video_item in video_items: playlist.add(url=video_item.getProperty('streamLink'), listitem=video_item) logging.getLogger().debug('Playlist size = %s ' % str(playlist.size())) xbmc.Player().play(playlist)
def show_tv_show_episode_videos_view(modelMap, window): image = xbmcgui.ControlImage(30, 30, 174, 147, filename=CacheManager().get('channel_image'), aspectRatio=0, colorDiffuse='0xFFD1EEFC') window.addControl(image) controls = CacheManager().get('controls_to_be_deleted') controls.append(image) if modelMap.has_key('error-occurred') and modelMap['error-occurred']: logging.getLogger().debug('found an error message...') window.getControl(500).setVisible(False) window.getControl(600).setVisible(True) logging.getLogger().exception(modelMap['error']) else: modelMap['progress_control'] = window.getControl(502) window.getControl(501).setLabel( 'RESOLVING VIDEOS TO BE PLAYED, PLEASE WAIT...')
def hide_remove_favorite(modelMap, window): CacheManager().remove('selected_favorite') CacheManager().remove('selected_favorite_thumb') window.getControl(106).setVisible(False) if modelMap.has_key('reload_favorite_tv_shows_items' ) and modelMap['reload_favorite_tv_shows_items']: window.getControl(105).reset() if modelMap.has_key('favorite_tv_shows_items') and modelMap[ 'favorite_tv_shows_items'] is not None and len( modelMap['favorite_tv_shows_items']) > 0: window.getControl(105).setVisible(True) window.getControl(105).addItems( modelMap['favorite_tv_shows_items']) window.getControl(104).setVisible(False) window.getControl(1042).setVisible(False) else: window.getControl(104).setVisible(True) window.getControl(1042).setVisible(True) window.getControl(105).setVisible(False) window.setFocusId(102)
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 __init__(self, do_action_func, addon, addon_path): self._do_action_func = do_action_func self._addon_path = addon_path self._theme = addon.getSetting('theme') window_name = 'AddonWindow.xml' if self._theme is None or self._theme == '' or self._theme == '0': window_name = 'AddonWindow.xml' else: window_name = 'AddonWindow_' + self._theme + '.xml' logging.getLogger().debug('Going to load fonts.') MyFont.FontModifier(addon_path).loadMyFontFile() logging.getLogger().debug('Going to load window with name: %s' % window_name) self._addon_window = AddonWindow(window_name, addon_path) self._addon_window.set_handle_event_func(self.handle_event) self._current_view = None CacheManager().put('controls_to_be_deleted', [])
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 load_tv_shows(req_attrib, modelMap): logging.getLogger().debug('load tv shows...') tv_channels = CacheManager().get('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 tv_show_items = [] 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))) for tv_show in tv_shows: name = tv_show['name'] item = xbmcgui.ListItem(label=name) item.setProperty('channel-type', channel_type) item.setProperty('tv-show-name', name) item.setProperty('tv-show-url', tv_show['url']) tv_show_items.append(item) modelMap['tv_show_items'] = tv_show_items
def _write_favorite_tv_shows_cache_(filepath, data): CacheManager().put('dtb_tv_favorites', data) jsonfile.write_file(filepath, data)
def _read_favorite_tv_shows_cache_(filepath): favorites = CacheManager().get('dtb_tv_favorites') if favorites is None: favorites = jsonfile.read_file(filepath) CacheManager().put('dtb_tv_favorites', favorites) return favorites
def _read_live_tv_channels_cache_(filepath): live_tv_data = CacheManager().get('live_tv_data') if live_tv_data is None: live_tv_data = jsonfile.read_file(filepath) CacheManager().put('live_tv_data', live_tv_data) return live_tv_data
def _read_tv_channels_cache_(filepath): tv_data = CacheManager().get('dtb_tv_data') if tv_data is None: tv_data = jsonfile.read_file(filepath) CacheManager().put('dtb_tv_data', tv_data) return tv_data
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')
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')