def refresh_cache(req_attrib, modelMap): if not modelMap['refresh_cache']: return logging.getLogger().debug('Reloading cache...') tv_data = {"channels": {}} 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) __retrieve_channel_tv_shows__(tv_channel_name, tv_channel) 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('tv_data', tv_data) AddonContext().get_addon().setSetting('drForceRefresh', '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')
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 _write_favorite_tv_shows_cache_(filepath, data): CacheManager().put('dtb_tv_favorites', data) jsonfile.write_file(filepath, 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')
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') CHANNEL_TYPE_IND = 'IND' CHANNEL_TYPE_PAK = 'PAK' 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 = []