~ubuntu-branches/ubuntu/karmic/calibre/karmic

« back to all changes in this revision

Viewing changes to src/calibre/web/feeds/recipes/recipe_linuxdevices.py

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-07-30 12:49:41 UTC
  • mfrom: (1.3.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20090730124941-qjdsmri25zt8zocn
Tags: 0.6.3+dfsg-0ubuntu1
* New upstream release. Please see http://calibre.kovidgoyal.net/new_in_6/
  for the list of new features and changes.
* remove_postinstall.patch: Update for new version.
* build_debug.patch: Does not apply any more, disable for now. Might not be
  necessary any more.
* debian/copyright: Fix reference to versionless GPL.
* debian/rules: Drop obsolete dh_desktop call.
* debian/rules: Add workaround for weird Python 2.6 setuptools behaviour of
  putting compiled .so files into src/calibre/plugins/calibre/plugins
  instead of src/calibre/plugins.
* debian/rules: Drop hal fdi moving, new upstream version does not use hal
  any more. Drop hal dependency, too.
* debian/rules: Install udev rules into /lib/udev/rules.d.
* Add debian/calibre.preinst: Remove unmodified
  /etc/udev/rules.d/95-calibre.rules on upgrade.
* debian/control: Bump Python dependencies to 2.6, since upstream needs
  it now.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
'''
5
5
Fetch Linuxdevices.
6
6
'''
7
 
 
 
7
import re
8
8
from calibre.web.feeds.news import BasicNewsRecipe
9
9
 
10
10
 
11
11
class Sueddeutsche(BasicNewsRecipe):
12
 
    
 
12
 
13
13
    title = u'Linuxdevices'
14
14
    description = 'News about Linux driven Hardware'
15
15
    __author__ = 'Oliver Niesner'
16
16
    use_embedded_content   = False
17
17
    timefmt = ' [%a %d %b %Y]'
18
18
    max_articles_per_feed = 50
 
19
    language = _('English')
19
20
    no_stylesheets = True
20
21
    html2epub_options = 'linearize_tables = True\nbase_font_size2=14'
 
22
    html2lrf_options = ['--ignore-tables']
21
23
    encoding = 'latin1'
22
24
 
23
25
 
71
73
                   dict(id='nnav-logo'),
72
74
                   dict(id='nnav-oly'),
73
75
                   dict(id='readcomment')]
74
 
    
75
 
 
76
 
 
77
 
    feeds =  [ (u'Linuxdevices', u'http://www.linuxdevices.com/backend/headlines.rss') ] 
 
76
 
 
77
 
 
78
 
 
79
    feeds =  [ (u'Linuxdevices', u'http://www.linuxdevices.com/backend/headlines.rss') ]
 
80
 
 
81
    def preprocess_html(self, soup):
 
82
        for item in soup.findAll(re.compile('^a')):
 
83
            item.extract()
 
84
        match = re.compile(r"^Related")
 
85
        for item in soup.findAll('b', text=match):
 
86
            item.extract()
 
87
        for item in soup.findAll(re.compile('^li')):
 
88
            item.extract()
 
89
        for item in soup.findAll(re.compile('^ul')):
 
90
            item.extract()
 
91
        for item in soup.find(re.compile('^br')):
 
92
            item.extract()
 
93
        for item in soup.findAll('br', limit=10):
 
94
            item.extract()
 
95
        return soup
 
96
 
 
97
 
 
98
    def postprocess_html(self, soup, first):
 
99
        for tag in soup.findAll(name=['table', 'tr', 'td']):
 
100
            tag.name = 'div'
 
101
        return soup
 
102
 
 
103
 
78
104