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 12-22-2010, 08:43 PM   #1
daviestown
Member
daviestown began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Dec 2010
Device: Sony Reader PRS-650
Adding a Table of Contents for PRS-650

Hi, I'm downloading Financial Times articles and would like to have a "Table of Contents" created for the eBook... using the each feed's title as the separate sections.

Here is the code... can you help guide me on how to add this feature?

Thank you so much!

Davies Town


Code:

Spoiler:

class AdvancedUserRecipe1293009575(BasicNewsRecipe):
title = 'Financial Times'
description = 'Financial Times'
publisher = 'Financial Times'
oldest_article = 2
max_articles_per_feed = 100
no_stylesheets = True
use_embedded_content = False
needs_subscription = True
simultaneous_downloads= 5
delay = 0
LOGIN = 'https://registration.ft.com/registration/barrier/login'


def get_browser(self):
br = BasicNewsRecipe.get_browser()
if self.username is not None and self.password is not None:
br.open(self.LOGIN)
br.select_form(name='loginForm')
br['username'] = self.username
br['password'] = self.password
br.submit()
return br

keep_only_tags = [ dict(name='div', attrs={'id':'cont'}) ]
remove_tags_after = dict(name='p', attrs={'class':'copyright'})
remove_tags = [ dict(name='div', attrs={'id':'floating-con'}) ]
remove_tags = [ dict(name='p', attrs={'class':'copyright'}) ]

feeds = [(u'World', u'http://www.ft.com/rss/world')
,(u'US', u'http://www.ft.com/rss/world/us')
,(u'Canada', u'http://www.ft.com/rss/world/canada')
,(u'Asia-Pacific', u'http://www.ft.com/rss/world/asiapacific')
,(u'Equities', u'http://www.ft.com/rss/markets/equities')
,(u'Commodities', u'http://www.ft.com/rss/markets/commodities')
]

def preprocess_html(self, soup):
content_type = soup.find('meta', {'http-equiv':'Content-Type'})
if content_type:
content_type['content'] = 'text/html; charset=utf-8'
return soup


daviestown is offline   Reply With Quote
Old 12-22-2010, 11: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: 25,626
Karma: 4998489
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
table of contents are created automatically as long as you have your output profile set to SONY and use calibre to send the news file to the device.
kovidgoyal is online now   Reply With Quote
 
Enthusiast
Old 12-31-2010, 03:27 AM   #3
daviestown
Member
daviestown began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Dec 2010
Device: Sony Reader PRS-650
For some reason, the Table of Contents appears fine when viewing the FT "book" in Calibre but, the same book does not have a ToC when viewing on my PRS-650. It only shows there is a front page.

Is this a coding error?

Thanks for your help!
daviestown is offline   Reply With Quote
Old 12-31-2010, 11:04 AM   #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: 25,626
Karma: 4998489
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You mean you're not getting a row of buttons at the button that have next article next section, table of contents in them?


And your output profile is set to a SONY output profile?
kovidgoyal is online now   Reply With Quote
Old 12-31-2010, 11:18 AM   #5
mufc
Connoisseur
mufc doesn't littermufc doesn't litter
 
Posts: 99
Karma: 170
Join Date: Nov 2010
Location: Airdrie Alberta
Device: Sony 650
same problem sommetimes

I have the sony 650 and Calibre is set up properly but some of mine do not have all the buttons at the bottom. An example is BBC news fast does not but BBC Sport does. I have examined both recipes and the only difference is BBC News fast has the line
#delay = 1
have not checked yet whether removing that will make any difference.
Most of my downloads work properly with all the buttons available but some only have the one button 'Table of Contents'
Not a big deal but if there is a fix I would like to know.
Kudos for Calibre by the way.
I
mufc is offline   Reply With Quote
Old 12-31-2010, 11:20 AM   #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: 25,626
Karma: 4998489
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I'd guess the difference is between recipes with single level and multi-levels TOCS. Probably the SONY readers can't handle single level TOCs.
kovidgoyal is online now   Reply With Quote
Old 12-31-2010, 10:39 PM   #7
Doogman
Connoisseur
Doogman has learned how to read e-booksDoogman has learned how to read e-booksDoogman has learned how to read e-booksDoogman has learned how to read e-booksDoogman has learned how to read e-booksDoogman has learned how to read e-booksDoogman has learned how to read e-booksDoogman has learned how to read e-books
 
Doogman's Avatar
 
Posts: 52
Karma: 945
Join Date: Jun 2010
Device: Nook ST
Ahhh, I was wondering why "The Guardian" news recipe provides all the buttons at the bottom, while "BBC" only has a TOC button which doesn't work correctly.

This is using a Sony 350.
Doogman 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
Adding Table of Contents to ePub problems... cates Calibre 2 10-10-2010 04:18 PM
Help with my Table of Contents Skylinefranc Calibre 0 03-19-2010 12:55 AM
Table of Contents PRS 505 - sehr langsamer Aufbau growlin_mad Erste Hilfe 1 05-28-2009 04:22 PM
only the table of contents wang960 Sony Reader 3 08-29-2008 12:45 PM
Creator Table of Contents Nate the great Kindle Formats 5 07-10-2008 05:55 AM


All times are GMT -4. The time now is 04:21 AM.


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