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 02-06-2013, 04:39 AM   #1
surf
Member
surf began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Feb 2013
Device: kindle
Full-article blog, fetch, table of contents

I'm trying to fetch a full-article blog RSS.
In my recipe, the value use_embedded_content was set to True.

Since each item of the blog feeds is a very long article, the page of table of contents in the resulting ePub turn out be very long!

I wonder whether I can shorten the stuff shown in the TOC page, or simply retain only the title of each feed in the TOC page.

It seems that the Calibre API does not allow this modifcation.

Did anybody tried to solve this?

Thanks for sharing your solution!
surf is offline   Reply With Quote
Old 02-06-2013, 06:34 AM   #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: 43,842
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I dont understand the issue. Are you saying there are too many entries in the table of contents. Since each entry corresponds to an article, that would imply for entire epub is too long as well.
kovidgoyal is online now   Reply With Quote
Old 02-06-2013, 09:12 AM   #3
surf
Member
surf began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Feb 2013
Device: kindle
Quote:
Originally Posted by kovidgoyal View Post
I dont understand the issue. Are you saying there are too many entries in the table of contents. Since each entry corresponds to an article, that would imply for entire epub is too long as well.
Hi, Kovid, Thanks a lot for your response!

Pls let me give you a example.

The first pic, the problematic one, shows a redundant TOC page of an ePub fetched from full-article RSS feed with built-in functionality.

My question is, whether it's possible to control/remove the introductory contents under each article title from the TOC page.

The second pic shows a very concise TOC page of an ePub fetched from full-article RSS feed with customized parse_index() recipe.

Thanks!
Attached Thumbnails
Click image for larger version

Name:	111.jpg
Views:	205
Size:	186.4 KB
ID:	100779   Click image for larger version

Name:	222.jpg
Views:	205
Size:	104.0 KB
ID:	100780  
surf is offline   Reply With Quote
Old 02-06-2013, 01:13 PM   #4
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: 43,842
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Sure you can control pretty much everything in a recipe by simply overriding the base class functionality. In your case you will want to override the parse_feesdd function to remove the description from the feeds.
kovidgoyal is online now   Reply With Quote
Old 02-06-2013, 01:40 PM   #5
surf
Member
surf began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Feb 2013
Device: kindle
Quote:
Originally Posted by kovidgoyal View Post
Sure you can control pretty much everything in a recipe by simply overriding the base class functionality. In your case you will want to override the parse_feesdd function to remove the description from the feeds.
I spent 2+ hours studying parse_feeds.
But it seems to be much more difficult than understand parse_index.

Could you kindly provide some clues on how to remove the description?

Thanks!
surf is offline   Reply With Quote
Old 02-06-2013, 02:21 PM   #6
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: 43,842
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Call the base class parse_feeds, iterate over the returned value setting the description to an empty string for each entry.
kovidgoyal is online now   Reply With Quote
Old 02-06-2013, 02:58 PM   #7
surf
Member
surf began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Feb 2013
Device: kindle
Quote:
Originally Posted by kovidgoyal View Post
Call the base class parse_feeds, iterate over the returned value setting the description to an empty string for each entry.
Done with following codes

def parse_feeds(self):

feeds = BasicNewsRecipe.parse_feeds(self)

for currFeed in feeds:
for a,currArticle in enumerate(currFeed.articles):
currArticle.summary = ''

return feeds

Thank you!
surf is offline   Reply With Quote
Old 02-06-2013, 03:10 PM   #8
surf
Member
surf began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Feb 2013
Device: kindle
Quote:
Originally Posted by surf View Post
Done with following codes

def parse_feeds(self):

feeds = BasicNewsRecipe.parse_feeds(self)

for currFeed in feeds:
for a,currArticle in enumerate(currFeed.articles):
currArticle.summary = ''

return feeds

Thank you!
Sorry. It doesnot work.

currArticle.summary = '' would delete all the article content.

currArticle.text_summary is OK for the job.

Thanks!

Last edited by surf; 02-06-2013 at 03:12 PM.
surf is offline   Reply With Quote
Old 02-06-2013, 04:43 PM   #9
surf
Member
surf began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Feb 2013
Device: kindle
Quote:
Originally Posted by kovidgoyal View Post
Call the base class parse_feeds, iterate over the returned value setting the description to an empty string for each entry.
Hi, Kovid,

Could you advise how to change the time format showing in the left picture above?

I cann't figure out how to handle the following properties of the Article object

formatted_date
date


Thanks!
surf is offline   Reply With Quote
Old 02-06-2013, 05:32 PM   #10
surf
Member
surf began at the beginning.
 
Posts: 22
Karma: 10
Join Date: Feb 2013
Device: kindle
Already done with following code

Code:
from calibre import strftime

    def parse_feeds(self):

        feeds = BasicNewsRecipe.parse_feeds(self)

        for currFeed in feeds:
            for a,currArticle in enumerate(currFeed.articles):
                 currArticle.text_summary =  ''
                 currArticle.formatted_date =  strftime('[%Y.%m.%d]',currArticle.date)
 
        return feeds
Thanks!
surf is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Fetch all news from a blog joseprl89 Recipes 4 01-15-2013 07:13 AM
Table of Contents not being identified as Table of Contents openletter Conversion 2 10-19-2012 12:54 AM
Could not fetch article. Steven630 Recipes 4 05-05-2012 05:00 AM
calibre fetch news to epub for sony,no table of contents ich461 Calibre 6 06-12-2011 12:00 PM
Decorate article headings as hyperlinks to full article? tomsem Recipes 5 10-15-2010 08:30 PM


All times are GMT -4. The time now is 05:06 AM.


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