![]() |
#16 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 868
Karma: 2676800
Join Date: Aug 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
|
Tweak/fix epub css and/or xpgt
Hi folks.
Well, when I purchase a book, I like to retain all it's formatting and don't like doing an epub-to-epub conversion. However, most publishers don't do a "perfect" epub (in my opinion) and usually require a few css and xpgt tweaks before I load it on to my reader. However, the publishers use a master template, so the changes I like to make to one book are identical to any other book by that publisher. This of course gets very repetitive very quickly... So I was wondering if it were possible if someone was interested in making a plugin that would open an epub, run a series of find/replace operations on the css and xpgt files within and repackage the epub -- basically an "automated" Tweak Epub feature. Example: For some reason, Penguin books scale down the fonts by one "size". so a typical body paragraph has the following style Code:
.tx { font-size: small; text-align: justify; text-indent: 15px; } I also like to change the margins in the page-template.xpgt to 5px. Any thoughts? |
![]() |
![]() |
![]() |
#17 |
Connoisseur
![]() ![]() ![]() ![]() ![]() Posts: 54
Karma: 442
Join Date: Oct 2010
Location: Detroit
Device: iPad
|
Scrape and Update a Custom field PLugin
OK the Title Goal ("Scrape and Update a Custom field PLugin") is probably way too generic. But I have not let go the idea of having a custom DCC column in my Calibre Library (it would be useful to me).
So a Plugin that takes the ISBN of the selected record and hits (for example)the Classify web service, and then "beautiful Soups" the result to grab the DCC, and then saves it back into the nominated custom column. would be awesome ![]() I have been tinkering and have figured out how to use the Beautiful Soup py Module to target response XML and to Lift a certain element within the response. My difficulty comes with getting my head around how to perform an update of a custom column associated with the selected record. (ie I'm having trouble navigating the data updating code of Calibre.) A Plugin of this kind, while initially being targeted at a specific case, could potentially be expanded to become a generic plug-in for fetching and populating custom columns of various types from various services. Some other examples might be:- - a cost column to track how much I have spent on my ebooks. - an IMDB movie column with a link to movies made of the book. - a country column denoting which country the author came from. - a notification service, which alerts you when a new book in the current book series is published. Oh and I'm aware of the 'fragility" issue, however Classify, for instance, is more a web services than an http:html response and one could expect that the xml element names would remain constant even if their position in the response changed. Last edited by garcle; 01-31-2011 at 05:45 PM. Reason: more info |
![]() |
![]() |
Advert | |
|
![]() |
#18 | |
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,667
Karma: 2162246
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
Quote:
I don't have a need for such a plugin myself but I can understand the issue and technically there is no great difficulty. One question that comes to mind if someone was to assist you with writing it is the nature of the find/replace operations and how those are specified. Could you get away with substituting an entire css file? Or do you substitute just specific styles? Maybe if you could list (as an example) all of the substitutions you do currently that you require, put them either in an attachment or spoiler section for someone to take a look at. If the find/replace operations are quite complex then you are probably going to want them specified using regular expressions for instance. |
|
![]() |
![]() |
![]() |
#19 | |
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,667
Karma: 2162246
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
Quote:
![]() I've got the GoodReads plugin as next on my todo list to investigate so that will keep me out of trouble for a few days. But if no-one else has stepped in after that to help you with this then I could be tempted to offer help if needed, sounds an interesting challenge. |
|
![]() |
![]() |
![]() |
#20 | |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 868
Karma: 2676800
Join Date: Aug 2008
Location: Taranaki - NZ
Device: Kobo Aura H2O, Kobo Forma
|
Quote:
![]() But anyway, back on topic... I tend to prefer replacing specific styles rather than substituting in a new stylesheet. It wouldn't need anything too exotic, basic search is all that's necessary, although regular expressions would be much more flexible and powerful. My idea was to use a basic text file with a series of search/replace terms that the plugin would perform on the .css and .xpgt files found in the epub. So, for the Penguin example, the text file could look a little something like this: Spoiler:
|
|
![]() |
![]() |
Advert | |
|
![]() |
#21 |
Member
![]() Posts: 11
Karma: 10
Join Date: Dec 2010
Location: Jacksonville, FL
Device: Pandigital Novel Black
|
Hello, just had a thought of a plugin idea for Calibre:
I wish I could set calibre to take my list of authors, and find new releases from an author and let me know in a popup box, could do it once a week, maybe by checking against Amazon or something like that....I don't know if anyone else would be interested in it, just thought i would throw it out there |
![]() |
![]() |
![]() |
#22 | |
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,667
Karma: 2162246
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
Quote:
I keep my favourite authors in a user category, I think it would be great from time to time to be able to use a plugin to find out what books they have coming out or that I may have missed without having to one by one look them up... |
|
![]() |
![]() |
![]() |
#23 | |
reader, ebook junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 110
Karma: 436806
Join Date: Dec 2007
Location: western nebraska
Device: in use kindle oasis 2nd and 3rd gen, kobo forma, boox poke5
|
Quote:
http://www.fictfact.com/ |
|
![]() |
![]() |
![]() |
#24 | |
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,667
Karma: 2162246
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
Quote:
|
|
![]() |
![]() |
![]() |
#25 | ||
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24
Karma: 4472
Join Date: Jan 2011
Device: Kindle
|
Quote:
That would be a good candidate, series_index_auto_increment could be another. Quote:
|
||
![]() |
![]() |
![]() |
#26 | ||
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,667
Karma: 2162246
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
Quote:
So at best in the plugin choosing from multiple values in a dropdown menu to change a tweak value would restart Calibre after making the change. However because of this restart requirement I would again ask the question what tweak values you feel the need to frequently change and why? It may be that if Kovid agrees with you the setting could be moved from Tweaks to Preferences - in which case a convenient way to swap values makes sense for the Quick Preferences plugin. Or it may be that there is a different way to approach what you are trying to achieve. My overriding sense of what you are asking is not really for the ability to quickly change between tweak settings, but more for a GUI to change the values in Tweaks? Quote:
And no, updating book metadata is certainly not in the scope of the "Quick Preferences" plugin. Although if someone comes up with some scenario where they want to right-click apply some change to book metadata using a different plugin that is certainly feasible. |
||
![]() |
![]() |
![]() |
#27 |
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,667
Karma: 2162246
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
Another idea I had for a plugin yesterday - a "Manage Series" plugin.
With the future of the LibraryThing metadata download plugin questionable at best (and frequently mish-mashed quality of data even when it was working) the onus is going to be more and more on users to edit the series metadata themselves manually. I'm not a fan of the careful [] bracket editing required in Calibre currently when you renumber something - it is fine for an ad-hoc edit but anyone who has tried to renumber a large series knows it quickly becomes painful. My idea is a right-click option which will present the books you have selected in a list, allowing you to move them up/down to change their order in the "series". You would be able to specify a series name (defaulted from first found in the selection if any) and a starting number (defaulting at 1). It would display read-only columns of title, author, pubdate and the "current" series value, plus a new series value based on order in the list as you move stuff around. Perhaps also supporting some left/right buttons for when you want an item to have a "x.1" number in the middle of the main sequence. Maybe also a button to bring up the FantasticFiction webpage for the author for those not using the "Search the Internet" plugin or who opened this dialog first... This might also be useful to quickly create a "fake" series for an author where you want to read in order of "published date" but find the data sourced into Calibre is incorrect (as I do) due to the wrong ISBNs being picked up or data missing. If it sounds of interest let me know. |
![]() |
![]() |
![]() |
#28 | |
reader, ebook junkie
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 110
Karma: 436806
Join Date: Dec 2007
Location: western nebraska
Device: in use kindle oasis 2nd and 3rd gen, kobo forma, boox poke5
|
Quote:
|
|
![]() |
![]() |
![]() |
#29 | |||
US Navy, Retired
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 9,865
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
|
Quote:
Quote:
Quote:
I also think the rest of your ideas sound good. |
|||
![]() |
![]() |
![]() |
#30 |
Guru
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 657
Karma: 64171
Join Date: Sep 2010
Location: Kent, England, Sol 3, ZZ9 plural Z Alpha
Device: Sony PRS-300, Kobo Aura HD, iPad (Marvin)
|
This would be a good plugin.
I have another 'feature', as well as the left/right to add small increments, how about one feature to skip some numbers (for when you've got books missing and haven't got 'dummy' records) and then all subsequent numbers are adjusted as well. |
![]() |
![]() |
![]() |
Tags |
calibre, chatbot, cover, epub fix, epub-fix, google books, kindle, metadata calibre title, missing, pdf, pdf and calibre, plugin development, scribe |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
PRS-505 Any ideas what this might be? | Neupy | Sony Reader | 4 | 07-03-2012 07:19 AM |
New Plugin Type Idea: Library Plugin | cgranade | Plugins | 3 | 09-15-2010 12:11 PM |
Ideas? | mike_bike_kite | Which one should I buy? | 10 | 06-13-2010 03:37 PM |
Ideas | F1Wild | Amazon Kindle | 4 | 07-10-2009 06:01 AM |