11-06-2011, 07:39 AM | #1 |
Enthusiast
Posts: 32
Karma: 10
Join Date: Nov 2011
Device: Kindle
|
BBC Recipe conversion_options explaination needed.
Currently the various BBC News recipes either do not work at all or do not work very well (including the one posted on 07-23-2010 by Starson17 on this board). Part of the reason is changes to the site and partly that the HTML used by the news site developers often seems to have minor errors in, Eg. a double space used in a tag, a trailing space at the end of it, a missing '-' in a tag and so on.
I am in the process of completely re-writing the recipe, including using regular expressions for all the elements in the keep_only and remove tags lists in an effort to make the recipe robust. Being a recipe noob, though with a strong programming background, there is one aspect of the existing BBC News recipes which I do not understand. Code:
Eg. From the Darko Miletic / Starson17 recipe (link below): https://www.mobileread.com/forums/showpost.php?p=1022483&postcount=14 conversion_options = { 'comments' : description, 'tags' : category, 'language' : language, 'publisher' : publisher, 'linearize_tables' : True } Many thanks. |
11-06-2011, 10:10 AM | #2 |
creator of calibre
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Conversion options are passed to the conversion system. See
ebook-convert dummy.epub dummy2.epub -h for help on all the conversion options. |
Advert | |
|
11-06-2011, 11:42 AM | #3 |
Enthusiast
Posts: 32
Karma: 10
Join Date: Nov 2011
Device: Kindle
|
Thanks very much kovidgoyal, now I understand what they do.
Some variables seem to be passed to ebook-convert automatically from the recipe without the need for an entry in the conversion_options list. The class variables 'title', 'extra_css', '__author__', all seem to be passed from the recipe to ebook-convert. Also the ebook-convert command line option '--pubdate' is filled automatically by the string described in 'timefmt'. Have I got that all correct? Or should I be doing this? Code:
conversion_options = { 'title' : title, 'authors' : __author__, 'comments' : description, 'tags' : category, 'language' : language, 'publisher' : publisher, 'extra-css' : extra_css, 'linearize_tables' : False } PS. Should I explicitly set 'linearize_tables' to False? Or is that the default? PPS. Is there somewhere where I can read what gets passed to ebook-convert without the need of an entry in conversion_options? Cheers. |
11-06-2011, 10:04 PM | #4 |
creator of calibre
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You should not pass any metadata options in conversion_options. That field is really meant for options that affect how the ebook is generated. Any non-metadata option that you do not pass takes its default value, which you can check with ebook-convert -h
|
11-07-2011, 12:44 PM | #5 |
Enthusiast
Posts: 32
Karma: 10
Join Date: Nov 2011
Device: Kindle
|
Thanks again kovidgoyal.
On your suggestion I've taken out the metadata I was setting using the conversion_options list in my recipe but now find that the resulting mobi ebook that's been created by ebook-convert has 'calibre' listed as both 'author' and 'publisher'. Is this what is supposed to happen (designed that way) or perhaps it's because I'm using Calibre v. 0.7.50 on Ubuntu/Lucid (which was got via a PPA called ppa:n-muench/calibre-lucid) and not the latest version 0.8.25? Thanks. PS. BTW looking through a couple of dozen recipes I've just seen that quite a lot set metadata using the conversion_options list. Last edited by mattst; 11-07-2011 at 12:49 PM. |
Advert | |
|
11-07-2011, 02:05 PM | #6 | ||
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
Quote:
|
||
11-07-2011, 05:33 PM | #7 |
Enthusiast
Posts: 32
Karma: 10
Join Date: Nov 2011
Device: Kindle
|
|
11-07-2011, 09:40 PM | #8 |
creator of calibre
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
It is designed that way. The fact that you can override it via conversion_options is an accident and is not guaranteed to continue working (I just dont care about this issue enough to fix the accident).
|
11-08-2011, 09:43 AM | #9 |
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
That's odd. I've seen several recipes that have tag settings, but don't produce tags in the calilbre GUI. I tested one just before posting and it failed. I've never looked into it, but I vaguely recall a post saying it can't be done, and I know I tried it once before and it failed. Would you post a recipe that sets tags and let me try it?
|
11-08-2011, 10:06 AM | #10 |
creator of calibre
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
The OP is probably talking about the tags in the output file when converted via the command line.
|
11-08-2011, 10:29 AM | #11 |
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
|
11-08-2011, 10:30 AM | #12 | ||
Enthusiast
Posts: 32
Karma: 10
Join Date: Nov 2011
Device: Kindle
|
Quote:
Quote:
Code:
class Whatever(BasicNewsRecipe): ... tags = 'news, sport' ... conversion_options = { 'tags' : tags } ... ebook-convert Whatever.recipe out.mobi HTH. PS. You replied while I was writing my reply! |
||
11-08-2011, 10:34 AM | #13 |
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Yes, that's how it's attempted. It has no direct affect on the tags in the GUI, which is what most people want. The Adventure Gamers recipe, which I often point people to for a recipe that handles multipage (it's alphabetically the first with that type of code) has that exact form, but does not create tags in the GUI database. It will bring them in if imported in a separate step.
|
11-08-2011, 10:51 AM | #14 | |
Enthusiast
Posts: 32
Karma: 10
Join Date: Nov 2011
Device: Kindle
|
Quote:
May I ask what the reasoning for setting both the 'author(s)' and 'publisher' metadata to 'calibre' is (when using ebook-convert to create an ebook from a recipe)? While I can see why calibre is being set as the author, I don't understand why it could be considered the publisher? In news.py the class BasicNewsRecipe(Recipe) defines this: Code:
#: Publication type #: Set to newspaper, magazine or blog publication_type = 'unknown' Finally am I setting 'smarten-punctuation' correctly below, I seem to be having some problems with it? Code:
conversion_options = { 'smarten-punctuation' : True } PS. (Being a noob) I've only just realized that you are the creator of calibre. Excellent, excellent, excellent piece of software - thanks so much for it. |
|
11-08-2011, 11:07 AM | #15 | |
Enthusiast
Posts: 32
Karma: 10
Join Date: Nov 2011
Device: Kindle
|
EDIT: Ok got it now. When running the recipe from within the Calibre GUI, the tags do not get added. END EDIT
Quote:
http://www.zilefile.com/files/16978_...ot_Calibre.png PS. I'm using Calibre v. 0.7.50 on Ubuntu/Lucid. Last edited by mattst; 11-09-2011 at 12:46 PM. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Recipe for Real-World Economics Review Blog (wordpress) needed | marksoc | Recipes | 4 | 10-29-2011 04:33 AM |
I KNEW that there was a logical explaination for Roswell! | ardeegee | Lounge | 8 | 05-20-2011 01:26 AM |
New recipe request - BBC News Ukrainian | storkozos | Introduce Yourself | 7 | 10-25-2010 11:36 AM |
Recipe for BBC Ukrainian | storkozos | Recipes | 1 | 10-21-2010 07:01 AM |
Recipe help needed for looping through sections of a website | Acey | Calibre | 1 | 10-16-2008 01:09 PM |