View Single Post
Old 11-27-2014, 07:05 PM   #860
zephyrot
Junior Member
zephyrot began at the beginning.
 
zephyrot's Avatar
 
Posts: 7
Karma: 10
Join Date: Nov 2010
Location: Where no man has gone before
Device: BQ Cervantes Touch Light
Hello.

Thanks for such a great plugin!.

I do know nothing at all about python language (so sorry if my changes are horrible), but anyway I did an small modification to your plugin for my own personal use.

This is because I wanted your plugin to remove certain files that bother me a lot within epub files. They are mostly covers with ads from webpages, or book resumes that had spanish file names and thus they were not deleted with "delete all jackets" option.

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)
	for name in list(container.name_path_map.keys()):
		if 'sinopsis' in name and name.endswith('.xhtml'):
			data = container.get_parsed_etree(name)
			log('\t Sinopsis jacket found: ', name)
			dirtied = True
			container.delete_from_manifest(name)
	for name in list(container.name_path_map.keys()):
		if 'Cubierta' in name and name.endswith('.xhtml'):
                       data = container.get_parsed_etree(name)
                       log('\t Cubierta jacket found: ', name)
                       dirtied = True
                       container.delete_from_manifest(name)
	for name in list(container.name_path_map.keys()):		
		if 'titulo' in name and name.endswith('.xhtml'):
                       data = container.get_parsed_etree(name)
                       log('\t Titulo jacket found: ', name)
                       dirtied = True
                       container.delete_from_manifest(name)
    return dirtied
This will delete files "sinopsis.xhtml", "cubierta.xhtml" and "titulo.xhtml". It has worked very well for my large collection of downloaded books where most of them had those files.

So, would you be so kind to consider in next version (or if you feel bored enough) to add one option to automatically delete certain files that match a given name?.
This can be useful for many countries where english is not the main language.

Thanks in advance and greetings from Spain.

Last edited by zephyrot; 11-27-2014 at 07:54 PM. Reason: used "quote" instead of "code" LOL
zephyrot is offline   Reply With Quote