count += 1 fp = os.path.join(dirpath, f) total_size += os.path.getsize(fp) total_sizetext = "%.0f" % (total_size / 1024000.0) if count > maxpackage_zips or int(total_sizetext) > filesize: choice2 = xbmcgui.Dialog().yesno( "[COLOR=red]Autocleaner[/COLOR]", 'A pasta de pacotes e [COLOR red]' + str(total_sizetext) + ' MB [/COLOR] - [COLOR red]' + str(count) + '[/COLOR] zip files', 'A pasta pode ser limpa sem problemas para economizar espaco...', 'Voce quer limpa-lo agora?', yeslabel='Sim', nolabel='Nao') if choice2 == 1: control.purgePackages() for dirpath2, dirnames2, filenames2 in os.walk(thumbnails): for f2 in filenames2: fp2 = os.path.join(dirpath2, f2) total_size2 += os.path.getsize(fp2) total_sizetext2 = "%.0f" % (total_size2 / 1024000.0) if int(total_sizetext2) > filesize_thumb: choice2 = xbmcgui.Dialog().yesno( "[COLOR=red]Autocleaner[/COLOR]", 'A pasta de imagens e [COLOR red]' + str(total_sizetext2) + ' MB [/COLOR]', 'A pasta pode ser limpa sem problemas para economizar espaco...', 'Voce quer limpa-lo agora?', yeslabel='Sim',
filesize_thumb = int(setting('filesizethumb_alert')) maxpackage_zips = int(setting('packagenumbers_alert')) print("MAINTENANCE SETTINGS", maxpackage_zips, filesize, filesize_thumb) total_size2 = 0 total_size = 0 count = 0 for dirpath, dirnames, filenames in os.walk(packagesdir): count = 0 for f in filenames: count += 1 fp = os.path.join(dirpath, f) total_size += os.path.getsize(fp) total_sizetext = "%.0f" % (total_size/1024000.0) if count > maxpackage_zips or int(total_sizetext) > filesize: choice2 = xbmcgui.Dialog().yesno("[COLOR=red]Autocleaner[/COLOR]", 'The packages folder is [COLOR red]' + str(total_sizetext) +' MB [/COLOR] - [COLOR red]' + str(count) + '[/COLOR] zip files', 'The folder can be cleaned up without issues to save space...', 'Do you want to clean it now?', yeslabel='Yes',nolabel='No') if choice2 == 1: control.purgePackages() for dirpath2, dirnames2, filenames2 in os.walk(thumbnails): for f2 in filenames2: fp2 = os.path.join(dirpath2, f2) total_size2 += os.path.getsize(fp2) total_sizetext2 = "%.0f" % (total_size2/1024000.0) if int(total_sizetext2) > filesize_thumb: choice2 = xbmcgui.Dialog().yesno("[COLOR=red]Autocleaner[/COLOR]", 'The images folder is [COLOR red]' + str(total_sizetext2) + ' MB [/COLOR]', 'The folder can be cleaned up without issues to save space...', 'Do you want to clean it now?', yeslabel='Yes',nolabel='No') if choice2 == 1: control.deleteThumbnails() xbmc.executebuiltin('XBMC.Notification(%s, %s, %s, %s)' % ('Maintenance Status', 'Packages: '+ str(total_sizetext) + ' MB' ' - Images: ' + str(total_sizetext2) + ' MB' , '5000', iconpath))