def set_extra_values(item, json, path): logger.debug() ret = Item() for key in json: if key == 'quality': ret.quality = json[key] if ret.quality and not ret.quality[0].isdigit(): ret.quality = ret.quality.upper() elif key == 'language': ret.language = json[key].upper() elif key == 'plot': ret.plot = json[key] elif key in ['poster', 'thumbnail']: ret.thumb = json[key] if ':/' in json[key] else filetools.join( path, json[key]) if '/' in json[key] else get_thumb(json[key]) elif key == 'fanart': ret.fanart = json[key] if ':/' in json[key] else filetools.join( path, json[key]) elif key in ['url', 'link']: ret.url = json[key] if ':/' in json[key] or type( json[key]) == dict else filetools.join(path, json[key]) elif key == 'seasons_list': ret.url = {} ret.url['seasons_list'] = json['seasons_list'] elif key == 'episodes_list': ret.url = {} ret.url['episodes_list'] = json['episodes_list'] elif key in ['links', 'find_links']: ret.url = {} ret.url[key] = json[key] ret.url['videolibrary'] = json.get('videolibrary', True) ret.url['autoplay'] = json.get('autoplay', False) elif key == 'filter': filterkey = [k for k in json[key].keys()][0] ret.filter = json[key][filterkey] ret.filterkey = filterkey elif key == 'description': ret.description = json[key] elif key == 'info': ret.info = json[key] if not ret.thumb: if 'get_search_menu' in inspect.stack()[1][3]: ret.thumb = get_thumb('search.png') else: ret.thumb = item.thumbnail if not ret.fanart: ret.fanart = item.fanart if not ret.plot: ret.plot = item.plot logger.debug(ret.url) return ret
def set_extra_values(item, json, path): support.log() ret = Item() for key in json: if key == 'quality': ret.quality = json[key].upper() elif key == 'language': ret.language = json[key].upper() elif key == 'plot': ret.plot = json[key] elif key in ['poster', 'thumbnail']: ret.thumb = json[key] if ':/' in json[key] else filetools.join( path, json[key]) if '/' in json[key] else get_thumb(json[key]) elif key == 'fanart': ret.fanart = json[key] if ':/' in json[key] else filetools.join( path, json[key]) elif key in ['url', 'link']: ret.url = json[key] if ':/' in json[key] or type( json[key]) == dict else filetools.join(path, json[key]) elif key == 'seasons_list': ret.url = {} ret.url['seasons_list'] = json['seasons_list'] elif key == 'episodes_list': ret.url = {} ret.url['episodes_list'] = json['episodes_list'] elif key == 'links': ret.url = {} ret.url['links'] = json[key] elif key == 'filter': filterkey = json[key].keys()[0] ret.filter = json[key][filterkey] ret.filterkey = filterkey elif key == 'description': ret.description = json[key] if not ret.thumb: if 'get_search_menu' in inspect.stack()[1][3]: ret.thumb = get_thumb('search.png') else: ret.thumb = item.thumbnail if not ret.fanart: ret.fanart = item.fanart if not ret.plot: ret.plot = item.plot return ret