def clear_thumbs(type=None): from resources.libs import db dialog = xbmcgui.Dialog() thumb_locations = {CONFIG.THUMBNAILS, os.path.join(CONFIG.ADDON_DATA, 'script.module.metadatautils', 'animatedgifs'), os.path.join(CONFIG.ADDON_DATA, 'script.extendedinfo', 'images')} latest = db.latest_db('Textures') if type is not None: choice = 1 else: choice = dialog.yesno(CONFIG.ADDONTITLE, '[COLOR {0}]Le gustaria eliminar {1} y las carpetas de miniaturas relacionadas?'.format(CONFIG.COLOR2, latest) + '\n' + "Ellas se repoblarán en la próxima puesta en marcha.[/COLOR]", nolabel='[B][COLOR red]No Eliminar[/COLOR][/B]', yeslabel='[B][COLOR dodgerblue]Eliminar Pulgares[/COLOR][/B]') if choice == 1: try: tools.remove_file(os.path.join(CONFIG.DATABASE, latest)) except: logging.log('Error al eliminar, Purgando DB.') db.purge_db_file(latest) for i in thumb_locations: tools.remove_folder(i) else: logging.log('Borrar nombres en miniatura cancelados') tools.redo_thumbs()
def clear_thumbs(type=None): from resources.libs import db dialog = xbmcgui.Dialog() thumb_locations = { CONFIG.THUMBNAILS, os.path.join(CONFIG.ADDON_DATA, 'script.module.metadatautils', 'animatedgifs'), os.path.join(CONFIG.ADDON_DATA, 'script.extendedinfo', 'images') } latest = db.latest_db('Textures') if type is not None: choice = 1 else: choice = dialog.yesno( CONFIG.ADDONTITLE, '[COLOR {0}]Would you like to delete the {1} and related thumbnail folders?' .format(CONFIG.COLOR2, latest) + '\n' + "They will repopulate on the next startup[/COLOR]", nolabel='[B][COLOR red]Don\'t Delete[/COLOR][/B]', yeslabel='[B][COLOR springgreen]Delete Thumbs[/COLOR][/B]') if choice == 1: try: tools.remove_file(os.path.join(CONFIG.DATABASE, latest)) except: logging.log('Failed to delete, Purging DB.') db.purge_db_file(latest) for i in thumb_locations: tools.remove_folder(i) else: logging.log('Clear thumbnames cancelled') tools.redo_thumbs()
def clear_thumbs(type=None): from resources.libs import db dialog = xbmcgui.Dialog() thumb_locations = {CONFIG.THUMBNAILS, os.path.join(CONFIG.ADDON_DATA, 'script.module.metadatautils', 'animatedgifs'), os.path.join(CONFIG.ADDON_DATA, 'script.extendedinfo', 'images')} latest = db.latest_db('Textures') if type is not None: choice = 1 else: choice = dialog.yesno(CONFIG.ADDONTITLE, '[COLOR {0}]Você gostaria de excluir o {1} e as pastas de miniaturas relacionadas?'.format(CONFIG.COLOR2, latest) + '\n' + "Eles irão repovoar na próxima inicialização[/COLOR]", nolabel='[B][COLOR red]Não apagar[/COLOR][/B]', yeslabel='[B][COLOR springgreen]Apagar Thumbs[/COLOR][/B]') if choice == 1: try: tools.remove_file(os.path.join(CONFIG.DATABASE, latest)) except: logging.log('Failed to delete, Purging DB.') db.purge_db_file(latest) for i in thumb_locations: tools.remove_folder(i) else: logging.log('Clear thumbnames cancelled') tools.redo_thumbs()