def remove_art(): # TODO: seasons and episodes and whatever like "add missing artwork" does listitem = sys.listitem mediatype = get_mediatype(listitem) dbid = get_dbid(listitem) if not (dbid or mediatype): return if not xbmcgui.Dialog().yesno("Artwork Beef: " + L(32427), L(750)): return remove_localfiles = xbmcgui.Dialog().yesno("Artwork Beef", L(32062)) mediaitem = info.MediaItem(quickjson.get_item_details(dbid, mediatype)) mediaitem.selectedart = cleaner.remove_specific_arttype(mediaitem, '* all') if remove_localfiles: FileManager().remove_deselected_files(mediaitem, True) info.update_art_in_library(mediatype, dbid, mediaitem.selectedart) info.remove_local_from_texturecache(mediaitem.art.values(), True) xbmcgui.Dialog().notification("Artwork Beef", L(32027).format(len(mediaitem.selectedart)))
def update_art_for_items(items, start): changedcount = 0 for i, item in enumerate(items): if fg: progress.update(start + i * stepsize // len(items), item['label']) else: progress.update(start + i * stepsize // len(items)) item = info.MediaItem(item) if item.mediatype == mediatypes.SEASON: item.file = info.get_cached_tvshow(item.tvshowid)['file'] updates = function(item) if isinstance(updates, int): changedcount += updates else: processed = utils.get_simpledict_updates(item.art, updates) if processed: info.update_art_in_library(item.mediatype, item.dbid, processed) changedcount += len(processed) if monitor.abortRequested() or fg and progress.iscanceled(): break return changedcount
def add_art_to_library(mediatype, seasons, dbid, selectedart): if not selectedart: return for arttype, url in selectedart.items(): # Kodi doesn't cache gifs, so force download in `downloader` and # don't leave any HTTP URLs if they can't be saved if arttype.startswith('animated') and url and url.startswith('http'): selectedart[arttype] = None if mediatype == mediatypes.TVSHOW: for season, season_id in seasons.iteritems(): info.update_art_in_library( mediatypes.SEASON, season_id, dict((arttype.split('.')[2], url) for arttype, url in selectedart.iteritems() if arttype.startswith('season.{0}.'.format(season)))) info.update_art_in_library( mediatype, dbid, dict((arttype, url) for arttype, url in selectedart.iteritems() if '.' not in arttype)) else: info.update_art_in_library(mediatype, dbid, selectedart) info.remove_local_from_texturecache(selectedart.values())