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

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 11-05-2008, 01:11 AM   #1
gilamon
Member
gilamon began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Nov 2008
Device: PRS-505
Question on TheAtlantic News Recipe

The recipe for the Atlantic that comes with Calibre works really well, but the font is a little large for my taste. So I decided to try the "nostylesheets" tweak on the recipe but can't seem to get it to work.

I downloaded the recipe from the documentation site and added the "Nostylesheets = true" line and saved it as a custom news source. When I try to run this recipe I get the error below. I tried running the unmodified recipe I downloaded and still get the same error. Running TheAtlantic recipe that came bundled with the app works fine.

Not sure if I'm missing something or what what. Any help would be appreciated.

------------------------

Job: **Fetch news from The Atlantic** **error**: (10054, 'Connection reset by peer') **Traceback**: Traceback (most recent call last): File "C:\Program Files\calibre\library.zip\calibre\parallel.py", line 749, in run File "C:\Program Files\calibre\library.zip\calibre\parallel.py", line 444, in control File "C:\Program Files\calibre\library.zip\calibre\parallel.py", line 405, in read File "C:\Program Files\calibre\library.zip\calibre\parallel.py", line 295, in read error: (10054, 'Connection reset by peer') **Log**: c:\users\gcanare\appdata\local\temp\calibre_0.4.10 0_nqq9qx_recipes\recipe0.py:39: DeprecationWarning: raising a string exception is deprecated
gilamon is offline   Reply With Quote
Old 11-05-2008, 01:16 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: 25,400
Karma: 4961459
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
you should add the line

html2lrf_options = ['--base-font-size', '10']
kovidgoyal is offline   Reply With Quote
 
Enthusiast
Old 11-05-2008, 12:40 PM   #3
gilamon
Member
gilamon began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Nov 2008
Device: PRS-505
I apologize in advance for my lack of python skills. Reading up on it now.

Is there a way to add that line to the built-in Atlantic recipe or can I get help on the issue below?

I downloaded the atlantic.py recipe from your site and added from file as a custom news source so I could add the extra parameter. However I can't seem to get it to work. When I run it it gives me this error.

Job: **Fetch news from The Atlantic** **error**: (10054, 'Connection reset by peer')

Am I skipping a step?

Thanks in advance.
gilamon is offline   Reply With Quote
Old 11-05-2008, 01:25 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: 25,400
Karma: 4961459
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You should be able to run the builtin recipe as a custom recipe. You only get that error when running it as a custom recipe?
kovidgoyal is offline   Reply With Quote
Old 11-05-2008, 02:25 PM   #5
gilamon
Member
gilamon began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Nov 2008
Device: PRS-505
When I go the Calibre --> Fetch News --> The Atlantic it works fine.

However when I do the following it doesn't:

1) download atlantic.py from ]http://bazaar.launchpad.net/~kovid/calibre/trunk/files/kovid%40kovidgoyal.net-20080509231359-le3xf7ynwc6eew90?file_id=1298%40b0dd1a5d-880a-0410-ada5-a57097536bc1%3Alibprs500%252Ftrunk%3Asrc%252Flibpr s500%252Fweb%252Ffeeds%252Frecipes

2) Go to Calibre --> Fetch News --> Add a Custom News Source --> Load recipe from file and load Atlantic.py exit to main menu

3) Go to Calibre --> Fetch News --> Custom News Source --> The Atlantic

4) get following error:

Job: **Fetch news from The Atlantic** **error**: (10054, 'Connection reset by peer') **Traceback**: Traceback (most recent call last): File "C:\Program Files\calibre\library.zip\calibre\parallel.py", line 749, in run File "C:\Program Files\calibre\library.zip\calibre\parallel.py", line 444, in control File "C:\Program Files\calibre\library.zip\calibre\parallel.py", line 405, in read File "C:\Program Files\calibre\library.zip\calibre\parallel.py", line 295, in read error: (10054, 'Connection reset by peer') **Log**: c:\users\gcanare\appdata\local\temp\calibre_0.4.10 0_q8g8ho_recipes\recipe0.py:38: DeprecationWarning: raising a string exception is deprecated
gilamon is offline   Reply With Quote
Old 11-05-2008, 02:36 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: 25,400
Karma: 4961459
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Hmm I just tried that and it worked for me:

Try the recipe below

Code:
#!/usr/bin/env  python

__license__   = 'GPL v3'
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
'''
theatlantic.com
'''
import re
from calibre.web.feeds.news import BasicNewsRecipe

class TheAtlantic(BasicNewsRecipe):
    
    title      = 'The Atlantic'
    __author__ = 'Kovid Goyal'
    description = 'Current affairs and politics focussed on the US'
    INDEX = 'http://www.theatlantic.com/doc/current'
    
    remove_tags_before = dict(name='div', id='storytop')
    remove_tags        = [dict(name='div', id=['seealso', 'storybottom', 'footer'])]
    no_stylesheets     = True
    
    def parse_index(self):
        articles = []
        
        soup = self.index_to_soup(self.INDEX)
        
        issue = soup.find('span', attrs={'class':'issue'})
        if issue:
            self.timefmt = ' [%s]'%self.tag_to_string(issue).rpartition('|')[-1].strip().replace('/', '-')
            
        cover = soup.find('img', alt=re.compile('Cover'), src=True)
        if cover is not None:
            self.cover_url = 'http://theatlantic.com'+cover['src']
        
        for item in soup.findAll('div', attrs={'class':'item'}):
            a = item.find('a')
            if a and a.has_key('href'):
                url = a['href']
                url = 'http://www.theatlantic.com/'+url.replace('/doc', 'doc/print')
                title = self.tag_to_string(a)
                byline = item.find(attrs={'class':'byline'})
                date = self.tag_to_string(byline) if byline else ''
                description = ''
                articles.append({
                                 'title':title,
                                 'date':date,
                                 'url':url,
                                 'description':description
                                })
                
        
        return [('Current Issue', articles)]
kovidgoyal is offline   Reply With Quote
Old 11-05-2008, 03:07 PM   #7
gilamon
Member
gilamon began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Nov 2008
Device: PRS-505
It fixed it and I was able to change the font size per your suggestion. Thanks for the insanely quick and personal response.
gilamon 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
Merging two news sources in same recipe cartesio Calibre 3 02-05-2012 04:05 PM
Catholic News Recipe Problem funkgut Calibre 4 04-23-2010 02:08 PM
Help with news recipe Acey Calibre 2 03-12-2010 06:36 AM
News recipe sorting OzAz Calibre 3 10-30-2009 06:28 PM
The Times news recipe? AprilHare Calibre 1 10-10-2008 01:48 PM


All times are GMT -4. The time now is 02:33 PM.


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