![]() |
#1 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 405
Karma: 479729
Join Date: Feb 2011
Device: Kindle 3, Kindle Paperwhite 2
|
Are recipes doable for a programming noob?
Are calibre recipes the sort of thing that someone with little or no programming background can grok, or does one need to spend a few hours/days/months/years studying Programming 101?
I enjoy learning new things, but I don't quite know where to start. Shoot, I'm not even sure what language calibre uses! (I know that I'm probably posting in the wrong section, but I didn't know where else to put this... ![]() |
![]() |
![]() |
![]() |
#2 |
Connoisseur
![]() Posts: 73
Karma: 44
Join Date: Sep 2010
Device: kindle 3
|
Recipes are made in pyton language but you don't need to know much to create one.
First try to check some recipes examples. To do that open Calibre and press the arrow near Fetch news -> Add custom news source-> Customize buildin recipe and select ScienceDaily[en] by Darko Miletic - this is a clean and easy to understand recipe. Copy ScienceDaily template in a file, rename it, set extension .recipe then change: keep_only_tags – represents what html tags will appear in subscription. keep_only_tags = [ dict(name='h1', attrs={'class':'story'}) - ScienceDaily recipe take content from tag h1 with css class named story remove_tags_after - where parsing operation have to stop remove_tags_after = dict(name='div', attrs={'id':'citationbox'}) - parsing operation stop after tag div with id=citationbox remove_tags – what html tags will be removed from elements parsed using keep_only_tags remove_tags = [dict(name='div', attrs={'id':'citationbox'} - will remove tag div with id=citationbox feeds – your rss list feeds = [(u"ScienceDaily", u'http://www.sciencedaily.com/newsfeed.xml')] You have to change class name, title, description and cover_url. Copy your recipe in folder where Calibre is installed and run this in command prompt: C:\Program Files\Calibre2>ebook-convert YourRecipe.recipe D:\temp –test -vv Check index.html from D:\temp. To inspect a html file i recommend firebug plugin and firefox You can find a recipe tutorial at calibre-ebook Last edited by sorin; 02-16-2011 at 05:05 AM. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 405
Karma: 479729
Join Date: Feb 2011
Device: Kindle 3, Kindle Paperwhite 2
|
Thank you, sorin... your post was very helpful.
Follow-up question: do recipes only work with .xml feeds? The blogs that I'd like to have feeds for all give .rdf files when I click their RSS links. |
![]() |
![]() |
![]() |
#4 |
Enthusiast
![]() ![]() Posts: 49
Karma: 196
Join Date: Jan 2011
Device: Kindle 3
|
.rdf files works fine at my (little) experience making recipes, look for a recipe in Calibre called "Blog de David Bravo", it's a example of a feed with .rdf format.
|
![]() |
![]() |
![]() |
#5 | |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 22
Karma: 1756
Join Date: Jan 2011
Location: Moscow, RU
Device: Kindle3, iPhone4, iPad2
|
Quote:
![]() All you need to do in order: 1. Install python. I used this portable all included version 2.6.1. 2. Study python basics. I'm reading Dive Into Python and highly recommend it. Chapters 2-8 are enough to start. 3. Read the introductory manual to news fetching here. 4. Study BeautifulSoup and BasicNewsRecipes documentation. After this you can start coding your first recipe and will be satisfied with results. ![]() |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 405
Karma: 479729
Join Date: Feb 2011
Device: Kindle 3, Kindle Paperwhite 2
|
Thank you, tolyluis!
Do I need anything special to edit python, or can I just use a simple text editor to make my changes? ETA: Oh, I managed to figure out how to use the "Basic Mode". I assume that the "Advanced Mode" will let me fine tune the style sheet? I definitely need to do something to limit the size of photographs (or eliminate them, I suppose). Last edited by stickybuns; 02-16-2011 at 05:38 PM. Reason: Oh, hey, nifty! |
![]() |
![]() |
![]() |
#7 | |
Zealot
![]() ![]() Posts: 115
Karma: 150
Join Date: Jul 2008
Location: Netherlands Veenendaal
Device: Palm T5, Sony PRS-505, Nook Color
|
Quote:
Start at http://www.phyton.org and read up on its documentation. Parsing webpages needs BeautifulSoup I think. Regards, Joop |
|
![]() |
![]() |
![]() |
#8 | |
Connoisseur
![]() Posts: 73
Karma: 44
Join Date: Sep 2010
Device: kindle 3
|
Quote:
|
|
![]() |
![]() |
![]() |
#9 |
Evangelist
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 405
Karma: 479729
Join Date: Feb 2011
Device: Kindle 3, Kindle Paperwhite 2
|
Thank you Thearr, JvdW, sorin, and tolyluis for all of your feedback and linkage. Looks like I'll be spending the weekend reading up on python
![]() |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Kindle DX and Programming books | fulcrum | Amazon Kindle | 4 | 01-12-2010 04:30 PM |
PRS-500 500 Programming | MarzKrishna | Sony Reader Dev Corner | 1 | 12-17-2009 08:43 PM |
Hacks Foreign language support - doable on 1.0? | seajewel | Amazon Kindle | 31 | 03-09-2009 01:49 PM |
For-free and priced ebooks doable? | Moejoe | Lounge | 8 | 02-09-2009 10:20 AM |
Advanced Linux Programming | Alexander Turcic | Deals and Resources (No Self-Promotion or Affiliate Links) | 0 | 03-28-2003 01:20 PM |