Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 12-12-2010, 10:35 AM   #1
mean_gene
Enthusiast
mean_gene began at the beginning.
 
Posts: 41
Karma: 10
Join Date: Dec 2010
Device: Kindle 3G/Wifi
Feed Elements

Anyone know the syntax for accessing the different feed elements?

There's a bit of info in the sample code sticky but it doesn't work (might be missing an import...feedparser?).

I'm guessing this is the title of the article:
curarticle.title

Not sure what this is:
curarticle.title.upper

This is probably used for loops:
curfeed.articles
mean_gene is offline   Reply With Quote
Old 12-12-2010, 11:08 AM   #2
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by mean_gene View Post
Anyone know the syntax for accessing the different feed elements?
There are 4 elements in an article of a feed - This will print them:
Code:
    def parse_feeds (self): 
      feeds = BasicNewsRecipe.parse_feeds(self) 
      for feed in feeds:
        for article in feed.articles[:]:
          print 'article.title is: ', article.title
          print 'article.url is: ', article.url
          print 'article.date is: ', article.date
          print 'article.text_summary is: ', article.text_summary
      return feeds
A Feed has a feed name and a list of articles. You set the feed name in the recipe.

Quote:
I'm guessing this is the title of the article:
curarticle.title
"title" is the title and "curarticle" is the article being processed in a loop - see above.

Quote:
Not sure what this is:
curarticle.title.upper
The title has been forced to upper case.

Last edited by Starson17; 12-12-2010 at 11:12 AM.
Starson17 is offline   Reply With Quote
Advert
Old 12-12-2010, 12:04 PM   #3
mean_gene
Enthusiast
mean_gene began at the beginning.
 
Posts: 41
Karma: 10
Join Date: Dec 2010
Device: Kindle 3G/Wifi
Thanks for the quick response; that helps a lot.
Is "feed.title" the title of the feed?

Also, does python care where I place the parse_feeds block of code (i.e. above/below the "feeds=[]" section)
mean_gene is offline   Reply With Quote
Old 12-12-2010, 02:29 PM   #4
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by mean_gene View Post
Thanks for the quick response; that helps a lot.
Is "feed.title" the title of the feed?
The title of a feed object is assigned in the recipe. I've never needed to access it, since I've always assigned the title I want it to have. Why do you want to know the variable name?

Quote:
Also, does python care where I place the parse_feeds block of code (i.e. above/below the "feeds=[]" section)
No.
Starson17 is offline   Reply With Quote
Old 12-12-2010, 03:48 PM   #5
mean_gene
Enthusiast
mean_gene began at the beginning.
 
Posts: 41
Karma: 10
Join Date: Dec 2010
Device: Kindle 3G/Wifi
Quote:
Why do you want to know the variable name?
Merging two feeds together.
mean_gene is offline   Reply With Quote
Advert
Old 12-12-2010, 05:21 PM   #6
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by mean_gene View Post
Merging two feeds together.
I've never needed to do that, but the sticky code has the best info I know of.
Starson17 is offline   Reply With Quote
Old 12-12-2010, 07:31 PM   #7
mean_gene
Enthusiast
mean_gene began at the beginning.
 
Posts: 41
Karma: 10
Join Date: Dec 2010
Device: Kindle 3G/Wifi
Yeah I've been reading through the sticky code to get some ideas. I should have something working for me soon...
mean_gene is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML5 elements in iPad magazines Chang Workshop 5 06-22-2011 04:25 AM
Styling Elements in CSS - ADE and Sony toskpro Sony Reader 0 07-19-2010 01:55 PM
Help me out: First use of these 4 sci-fi literary elements Steven Lake Writers' Corner 7 12-31-2009 10:02 AM
ePub elements pulled from the internet? melisen ePub 1 12-08-2009 09:59 PM
Windows 7 To Incorporate Multitouch Elements NatCh News 22 05-29-2008 12:15 PM


All times are GMT -4. The time now is 09:24 AM.


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