Recipe for La Nacion (thanks to Darko Miletic)

This commit is contained in:
Kovid Goyal 2008-11-12 09:58:32 -08:00
parent d7b7110358
commit 5423801c2e
4 changed files with 60 additions and 10 deletions

View File

@ -53,28 +53,28 @@ class MetadataBulkDialog(QDialog, Ui_MetadataBulkDialog):
au = qstring_to_unicode(self.authors.text())
if au:
au = string_to_authors(au)
self.db.set_authors(id, au)
self.db.set_authors(id, au, notify=False)
aus = qstring_to_unicode(self.author_sort.text())
if aus:
self.db.set_author_sort(id, aus)
self.db.set_author_sort(id, aus, notify=False)
if self.write_rating:
self.db.set_rating(id, 2*self.rating.value())
self.db.set_rating(id, 2*self.rating.value(), notify=False)
pub = qstring_to_unicode(self.publisher.text())
if pub:
self.db.set_publisher(id, pub)
self.db.set_publisher(id, pub, notify=False)
tags = qstring_to_unicode(self.tags.text()).strip()
if tags:
tags = map(lambda x: x.strip(), tags.split(','))
self.db.set_tags(id, tags, append=True)
self.db.set_tags(id, tags, append=True, notify=False)
remove_tags = qstring_to_unicode(self.remove_tags.text()).strip()
if remove_tags:
remove_tags = [i.strip() for i in remove_tags.split(',')]
self.db.unapply_tags(id, remove_tags)
self.db.unapply_tags(id, remove_tags, notify=False)
if self.write_series:
self.db.set_series(id, qstring_to_unicode(self.series.currentText()))
self.db.set_series(id, qstring_to_unicode(self.series.currentText()), notify=False)
if self.remove_format.currentIndex() > -1:
self.db.remove_format(id, unicode(self.remove_format.currentText()), index_is_id=True)
self.db.remove_format(id, unicode(self.remove_format.currentText()), index_is_id=True, notify=False)
self.changed = True

View File

@ -905,6 +905,16 @@ class LibraryDatabase2(LibraryDatabase):
if notify:
self.notify('metadata', [id])
def unapply_tags(self, book_id, tags, notify=True):
for tag in tags:
id = self.conn.get('SELECT id FROM tags WHERE name=?', (tag,), all=False)
if id:
self.conn.execute('DELETE FROM books_tags_link WHERE tag=? AND book=?', (id, book_id))
self.conn.commit()
self.data.refresh_ids(self.conn, [book_id])
if notify:
self.notify('metadata', [id])
def set_series(self, id, series, notify=True):
self.conn.execute('DELETE FROM books_series_link WHERE book=?',(id,))

View File

@ -8,7 +8,7 @@ recipes = [
'newsweek', 'atlantic', 'economist', 'portfolio',
'nytimes', 'usatoday', 'outlook_india', 'bbc', 'greader', 'wsj',
'wired', 'globe_and_mail', 'smh', 'espn', 'business_week',
'ars_technica', 'upi', 'new_yorker', 'irish_times', 'iht',
'ars_technica', 'upi', 'new_yorker', 'irish_times', 'iht', 'lanacion',
'discover_magazine', 'scientific_american', 'new_york_review_of_books',
'daily_telegraph', 'guardian', 'el_pais', 'new_scientist', 'b92', 'politika'
]

View File

@ -0,0 +1,40 @@
#!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
'''
lanacion.com.ar
'''
from calibre.web.feeds.news import BasicNewsRecipe
class Lanacion(BasicNewsRecipe):
title = u'La Nacion'
__author__ = 'Darko Miletic'
description = 'Noticias de Argentina y el resto del mundo'
oldest_article = 7
max_articles_per_feed = 100
no_stylesheets = True
use_embedded_content = False
keep_only_tags = [dict(name='div', attrs={'class':'nota floatFix'})]
remove_tags = [
dict(name='div' , attrs={'class':'notaComentario floatFix noprint' })
,dict(name='ul' , attrs={'class':'cajaHerramientas cajaTop noprint'})
,dict(name='div' , attrs={'class':'cajaHerramientas noprint' })
]
feeds = [
(u'Ultimas noticias' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?origen=2' )
,(u'Diario de hoy' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?origen=1' )
,(u'Politica' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=30' )
,(u'Economia' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=272' )
,(u'Deportes' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=131' )
,(u'Informacion General' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=21' )
,(u'Cultura' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=1' )
,(u'Opinion' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=28' )
,(u'Espectaculos' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=120' )
,(u'Exterior' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=7' )
,(u'Ciencia/Salud' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=498' )
,(u'Revista' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=494' )
]