Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 10-16-2014, 12:28 AM   #856
Kaetrin
Connoisseur
Kaetrin can eat soup with a fork.Kaetrin can eat soup with a fork.Kaetrin can eat soup with a fork.Kaetrin can eat soup with a fork.Kaetrin can eat soup with a fork.Kaetrin can eat soup with a fork.Kaetrin can eat soup with a fork.Kaetrin can eat soup with a fork.Kaetrin can eat soup with a fork.Kaetrin can eat soup with a fork.Kaetrin can eat soup with a fork.
 
Kaetrin's Avatar
 
Posts: 82
Karma: 9402
Join Date: Jul 2009
Location: Adelaide, South Australia
Device: Kobo Libra Colour
excellent, thx!
Kaetrin is offline   Reply With Quote
Old 10-31-2014, 09:47 PM   #857
LadyKate
Fanatic
LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.
 
Posts: 515
Karma: 1470724
Join Date: Jul 2013
Location: Quebec CA
Device: android 4 (samsung tablet and asus tablet)
Just updated to 2.8 from 1.48 and can't update epub

I just changed the language on an epub and it will not update. The error is

Modify ePubs
Logfile for book ID 111824 (Bookname / Author Name)
111824
Modifying: C:\Users\Kate\AppData\Local\Temp\calibre_hyfut4\pl _lz0_modify_epub\111824.epub
Updating metadata and cover
Parsing xml file: content.opf
Parsing xml file: toc.ncx
Looking for files to remove: [u'META-INF/calibre_bookmarks.txt']
BookName - ERROR: Traceback (most recent call last):
File "calibre_plugins.modify_epub.modify", line 79, in process_book
File "calibre_plugins.modify_epub.modify", line 134, in _process_book
KeyError: u'strip_spans'

ePub not changed after 0.19 seconds


This epub did not have any bookmarks but the plugin is configured to remove bookmarks, update metadata, smarten punctuation, remove metadata covers

This is the first time I've tried to use it since updating to 2.x of Calibre.
LadyKate is offline   Reply With Quote
Advert
Old 10-31-2014, 10:30 PM   #858
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
@LadyKate: Can you make sure you have the latest version of the plugin installed. This is 1.3.12.

If that doesn't help, delete the saved settings for the plugin. To do this, open the calibre preferences, go to the "Miscellaneous" section and press the "Open calibre configuration Then go into the directory "plugins" and find the file "Modify ePub.json" and delete it. The restart calibre and try the plugin again.
davidfor is offline   Reply With Quote
Old 11-01-2014, 12:19 AM   #859
LadyKate
Fanatic
LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.LadyKate ought to be getting tired of karma fortunes by now.
 
Posts: 515
Karma: 1470724
Join Date: Jul 2013
Location: Quebec CA
Device: android 4 (samsung tablet and asus tablet)
Thanks for responding davidfor. I must have needed a few more restarts of calibre. I had updated the plugins... all of them, and restarted BUT after making a couple of other changes and restarting about six times the next time I tried (which I did after almost every restart) it worked. Must have been in limbo or something. Sorry for bothering all.

Must be because it was a major update, I hadn't updated from 1.48 until tonight.
LadyKate is offline   Reply With Quote
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
Advert
Old 11-27-2014, 08:19 PM   #861
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by zephyrot View Post
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.
davidfor is offline   Reply With Quote
Old 11-28-2014, 03:48 AM   #862
Rev. Bob
Wizard
Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.
 
Rev. Bob's Avatar
 
Posts: 1,760
Karma: 9918418
Join Date: Feb 2013
Location: Here on the perimeter, there are no stars
Device: Kobo H2O, iPad mini 3, Kindle Touch
Quote:
Originally Posted by davidfor View Post
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.
I'm not exactly in charge of the plugin, but FWIW, I agree with this assessment. It seems like too much of a gamble for me; too many false negatives and false positives alike.
Rev. Bob is offline   Reply With Quote
Old 11-28-2014, 04:35 AM   #863
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,636
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
I'm not in charge either but, knowing a bit of Spanish , I agree that it's not sure to make those changes. It's like saying you're going to remove "title.xhtml", "jacket.xhtml" (if it's not standard) and "summary.xhtml" by default.

Last edited by Terisa de morgan; 11-30-2014 at 05:07 AM. Reason: Typos
Terisa de morgan is offline   Reply With Quote
Old 11-28-2014, 11:12 AM   #864
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
Smile

Hi Davidfor, Rev. Bob and Terisa de Morgan.

Thanks for your kind concern, I do see and understand your points so let me give you more background on my particular taste.

As per my knowledge, Calibre don't detect, edit, update or remove jackets whose filename is written in another language rather than english. This means that I have to manually check each and every file with Sigil or Calibre "Edit epub" tool to remove such duplicated jackets. This can be really tiresome as my book collection is rather large, exactly 4179 books right now, all obtained from many different places with many different jacket schemes, font sizes, paragraph sizes........

As I said I understand your view, but my intention is explicitly this:
"Removing certain named files to avoid having duplicate covers and synopsis".
Spanish filenames are used only for certain files that calibre will generate anyway, so I'm not really concerned about potentially deleted files. It is very unlikely and "original_epub" can be used to bring the missing pages back. A list is needed to manually set which files to remove, though.

To be honest, I will probably die from age before finishing reading half of them, given that my little fiddling around with Kiwidude plugin with a limited set of books was successful I'm willing to apply it to all my books.
I just though that this could be useful for someone else but I can't know if there is much request about this feature.

Davidfor: Thanks for your kind update. I had no idea about how to code with Python. Since my first try worked perfectly I left it as is, but I will gladly update with your suggestion.

Oh, at last I regret to say that I forgot to use a real nice word that should be mandatory when requesting things: "Please".

Thank you all and have a nice weekend


Edit: I overlooked a particular point on Davidfor post. Yes, I do think that this needs to have an option to select what filenames to remove if found, we just can't leave this as is. I'm sorry I missed it. I have added the clarification on the post.

Last edited by zephyrot; 11-28-2014 at 11:29 AM. Reason: Clarification.
zephyrot is offline   Reply With Quote
Old 11-28-2014, 03:48 PM   #865
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,636
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
@zephyrot: Yes, if something like this is implemented, the user should select the name: I would never have a file called "cubierta" but "sobrecubierta", neither "sinopsis" but "resumen", for example.

But the main point is: the removed file isn't "sobrecubierta" in English, but the standard name and extension (that's important: jacket.xhtml works, jacket.html doesn't) that calibre uses for including this jacket. You're not removing something which is a normal part of the book, but something calibre has added.
Terisa de morgan is offline   Reply With Quote
Old 11-28-2014, 04:05 PM   #866
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,785
Karma: 146391129
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
That would be a nice option to have Modidy ePub present us with a list of files in the ePub for us to select which ones we want removed and then they can be removed from the OPF and NCX ToC (if there).
JSWolf is offline   Reply With Quote
Old 11-28-2014, 07:57 PM   #867
Rev. Bob
Wizard
Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.Rev. Bob ought to be getting tired of karma fortunes by now.
 
Rev. Bob's Avatar
 
Posts: 1,760
Karma: 9918418
Join Date: Feb 2013
Location: Here on the perimeter, there are no stars
Device: Kobo H2O, iPad mini 3, Kindle Touch
Quote:
Originally Posted by zephyrot View Post
As I said I understand your view, but my intention is explicitly this:
"Removing certain named files to avoid having duplicate covers and synopsis".
Spanish filenames are used only for certain files that calibre will generate anyway, so I'm not really concerned about potentially deleted files.
Stupid question time:

If the goal is to avoid duplicates, because Calibre is making duplicate files, why not remove the Calibre-made files? That should be much easier to control.
Rev. Bob is offline   Reply With Quote
Old 11-28-2014, 09:16 PM   #868
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,737
Karma: 30237526
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by JSWolf View Post
That would be a nice option to have Modidy ePub present us with a list of files in the ePub for us to select which ones we want removed and then they can be removed from the OPF and NCX ToC (if there).
I think you would need a page preview too, I just looked at an epub from PG, the file names give no clue as to what's in the file.

Also just because a file is named something doesn't guarantee that's what it is, I'm sure I've seen epubs where the Title.xhtml file contained the half title, title and colophon.

- I have a hacked version of Modify that puts the calibre jacket at the back of the book.

It would be nice if Modify had an option to put the jacket.xhtml after the titlepage.xhtml (as it does now) or as the last file in the book. I won't offer my hack - because it removes functionality that others undoubtedly use.

BR
BetterRed is offline   Reply With Quote
Old 11-28-2014, 10:03 PM   #869
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,785
Karma: 146391129
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
I have no need for a jacket. So I remove them if they exist. So to me, it matters not where the jacket is placed. I'll remove it.

Another thing I remove the the page of reviews we sometimes get. I already have the book, I don't need to read review snippets.
JSWolf is offline   Reply With Quote
Old 11-28-2014, 11:19 PM   #870
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 21,737
Karma: 30237526
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Jon, as you are with jackets so am I with covers, the reason I first used Modify was to remove them. I like to have a jacket with all the metadata in the book, because the readers I have on my Tab are limited to displaying the DC elements only.
BetterRed is offline   Reply With Quote
Reply

Tags
modify epub


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[GUI Plugin] Quality Check kiwidude Plugins 1251 07-07-2025 09:13 PM
[GUI Plugin] Open With kiwidude Plugins 404 02-21-2025 05:42 AM
[GUI Plugin] Manage Series kiwidude Plugins 167 07-28-2024 03:07 PM
Modify ePub plugin dev thread kiwidude Development 346 09-02-2013 05:14 PM
[GUI Plugin] Plugin Updater **Deprecated** kiwidude Plugins 159 06-19-2011 12:27 PM


All times are GMT -4. The time now is 08:50 PM.


MobileRead.com is a privately owned, operated and funded community.