Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 02-06-2013, 05: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, 07: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: 26,436
Karma: 5383257
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, 10: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:	54
Size:	186.4 KB
ID:	100779   Click image for larger version

Name:	222.jpg
Views:	55
Size:	104.0 KB
ID:	100780  
surf is offline   Reply With Quote
Old 02-06-2013, 02: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: 26,436
Karma: 5383257
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, 02: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, 03: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: 26,436
Karma: 5383257
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, 03: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, 04: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 04:12 PM.
surf is offline   Reply With Quote
Old 02-06-2013, 05: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, 06: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

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


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


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