Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 01-09-2010, 06:52 PM   #1
BrianG
Member
BrianG began at the beginning.
 
Posts: 23
Karma: 22
Join Date: Dec 2009
Device: Kindle DX
Break up feed

I'm working on a recipe for Reader's Digest, and I ran into an issue that is beyond my abilities. Hoping to find some recipe/Python suggestions.

There's one large "main" feed that I have included in the FEEDS part of the recipe. There's no problem creating or formatting the actual articles into content that's useable by Calibre, but there is one wrinkle: the individual articles are one of two things:

1) Typical RD stories that I'd be interested in reading
2) A bunch of cooking recipes (like for muffins, etc.) that are not that interesting to me.

I was looking at the documentation on the BasicNewsRecipe, and couldn't find exactly what I was hoping for. I wanted to do any one of a few things:


Ideally, I'd like to divide this feed into two "logical feeds" with two separate sections in the TOC. I'd want to programatically read the big feed and take action based on the name of the article (e.g. if it has the word "recipe" in it).

I'd like to take something like:

MAIN FEED
article1
article2
recipe1
article3
recipe2

and have it show up in the TOC as:

MAIN
article1
article2
article3

RECIPES
recipe1
recipe2


If the methods aren't there to easily do this, I wouldn't mind ordering the articles (regardless of feed retrieval order) in the same section like:

MAIN
article1
article2
article3
recipe1
recipe2



Or ... if all else fails, I'd like to add code to find the title of the URL that is passed into my existing print_version method and if it contains the word "recipe" I'd like to null out the URL (or whatever it takes) to skip the article all-together.



Does anyone have any ideas about which methods might help a Python
n00B with any of these manipulations?


thanks...
BrianG is offline   Reply With Quote
Old 01-09-2010, 07:02 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,534
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You can override the parse_feeds method like this

Code:
def parse_feeds(self):
   feeds = BasicNewsRecipe.parse_feeds(self)
   # do whatever yuo want with feeds
   return feeds
kovidgoyal is offline   Reply With Quote
Advert
Old 01-09-2010, 07:13 PM   #3
BrianG
Member
BrianG began at the beginning.
 
Posts: 23
Karma: 22
Join Date: Dec 2009
Device: Kindle DX
Thanks

Awesome, thanks.
BrianG is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter break crutledge Sigil 2 08-19-2010 08:37 AM
Help! Did I break my Kindle? ficbot Amazon Kindle 9 02-07-2010 05:16 AM
Why Jail Break? daffy4u Apple Devices 46 09-18-2009 12:24 PM
break even at 24 europas_ice News 46 02-24-2009 12:02 PM


All times are GMT -4. The time now is 11:21 PM.


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