Quote:
Originally Posted by zephyrot
I changed file "jacket.py" lines 61 ~70 to the following:
Code:
def remove_all_jackets(container, log):
log('\tLooking for all jackets')
dirtied = False
for name in list(container.name_path_map.keys()):
if 'jacket' in name and name.endswith('.xhtml'):
data = container.get_parsed_etree(name)
if is_current_jacket(data) or is_legacy_jacket(data):
log('\t Jacket removed: ', name)
dirtied = True
container.delete_from_manifest(name)
if 'sinopsis' in name and name.endswith('.xhtml'):
log('\t Sinopsis jacket found: ', name)
dirtied = True
container.delete_from_manifest(name)
if 'Cubierta' in name and name.endswith('.xhtml'):
log('\t Cubierta jacket found: ', name)
dirtied = True
container.delete_from_manifest(name)
if 'titulo' in name and name.endswith('.xhtml'):
log('\t Titulo jacket found: ', name)
dirtied = True
container.delete_from_manifest(name)
return dirtied
|
I have made some changes. You didn't need to do a loop for each filename. Plus, the extra loops were within another and you were calling get_parsed_etree for each without using the data. I haven't tested this, and you will need to check the indentation, but it should work.
I don't know about others, but I would feel uncomfortable about including something like this. There is to big a risk of hitting something that shouldn't be removed. Maybe if there was an option to specify a list of names or a regex for the files to be removed. I'm also not exactly sure how much of a need there is.