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

« back to all changes in this revision

Viewing changes to src/calibre/web/feeds/recipes/recipe_tijd.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:
 
1
#!/usr/bin/env  python
 
2
 
 
3
__license__   = 'GPL v3'
 
4
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
 
5
'''
 
6
www.tijd.be
 
7
'''
 
8
from calibre.web.feeds.news import BasicNewsRecipe
 
9
from calibre.ebooks.BeautifulSoup import Tag
 
10
 
 
11
class DeTijd(BasicNewsRecipe):
 
12
    title                 = 'De Tijd'
 
13
    __author__            = 'Darko Miletic'
 
14
    description           = 'News from Belgium in Dutch'
 
15
    publisher             = 'De Tijd'
 
16
    category              = 'news, politics, Belgium'
 
17
    oldest_article        = 2
 
18
    max_articles_per_feed = 100
 
19
    no_stylesheets        = True
 
20
    use_embedded_content  = False
 
21
    encoding              = 'utf-8'
 
22
    language              = _('Dutch')
 
23
    lang                  = 'nl-BE'
 
24
    direction             = 'ltr'
 
25
 
 
26
    html2lrf_options = [
 
27
                          '--comment'  , description
 
28
                        , '--category' , category
 
29
                        , '--publisher', publisher
 
30
                        ]
 
31
 
 
32
    html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\noverride_css=" p {text-indent: 0cm; margin-top: 0em; margin-bottom: 0.5em} "'
 
33
 
 
34
    keep_only_tags = [dict(name='div', attrs={'id':'lcol'})]
 
35
    remove_tags    = [
 
36
                         dict(name=['embed','object'])
 
37
                       , dict (name='div',attrs={'id':'art_reactwrap'})
 
38
                     ]
 
39
    remove_tags_after  = dict(name='div', attrs={'id':'art_author'})
 
40
 
 
41
    feeds = [
 
42
              (u'Volledig nieuwsaanbod', u'http://www.tijd.be/rss/nieuws.xml'        )
 
43
             ,(u'Markten'              , u'http://www.tijd.be/rss/markten.xml'       )
 
44
             ,(u'Ondernemingen'        , u'http://www.tijd.be/rss/ondernemingen.xml' )
 
45
             ,(u'Chemie-Farma'         , u'http://www.tijd.be/rss/chemie_farma.xml'  )
 
46
             ,(u'Consumptie'           , u'http://www.tijd.be/rss/consumptie.xml'    )
 
47
             ,(u'Diensten'             , u'http://www.tijd.be/rss/diensten.xml'      )
 
48
             ,(u'Energie'              , u'http://www.tijd.be/rss/energie.xml'       )
 
49
             ,(u'Financen'             , u'http://www.tijd.be/rss/financien.xml'     )
 
50
             ,(u'Industrie'            , u'http://www.tijd.be/rss/industrie.xml'     )
 
51
             ,(u'Media'                , u'http://www.tijd.be/rss/media_telecom.xml' )
 
52
             ,(u'Technologie'          , u'http://www.tijd.be/rss/technologie.xml'   )
 
53
             ,(u'Economie & Financien' , u'http://www.tijd.be/rss/economie.xml'      )
 
54
             ,(u'Binnenland'           , u'http://www.tijd.be/rss/binnenland.xml'    )
 
55
             ,(u'Buitenland'           , u'http://www.tijd.be/rss/buitenland.xml'    )
 
56
             ,(u'De wijde wereld'      , u'http://www.tijd.be/rss/cultuur.xml'       )
 
57
            ]
 
58
 
 
59
    def preprocess_html(self, soup):
 
60
        del soup.body['onload']
 
61
        for item in soup.findAll(style=True):
 
62
            del item['style']
 
63
        soup.html['lang']     = self.lang
 
64
        soup.html['dir' ]     = self.direction
 
65
        mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)])
 
66
        mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")])
 
67
        soup.head.insert(0,mlang)
 
68
        soup.head.insert(1,mcharset)
 
69
        return soup
 
70