diff --git a/resources/recipes/lanacion.recipe b/resources/recipes/lanacion.recipe index 000b4fb0f6..068f6b3555 100644 --- a/resources/recipes/lanacion.recipe +++ b/resources/recipes/lanacion.recipe @@ -9,17 +9,22 @@ from calibre.web.feeds.news import BasicNewsRecipe class Lanacion(BasicNewsRecipe): title = 'La Nacion' __author__ = 'Darko Miletic' - description = 'Noticias de Argentina y el resto del mundo' + description = "lanacion.com - Informacion actualizada las 24 horas, con noticias de Argentina y del mundo" publisher = 'La Nacion S.A.' category = 'news, politics, Argentina' - oldest_article = 2 + oldest_article = 1 max_articles_per_feed = 100 use_embedded_content = False no_stylesheets = True language = 'es' - encoding = 'cp1252' + publication_type = 'newspaper' + remove_empty_feeds = True masthead_url = 'http://www.lanacion.com.ar/imgs/layout/logos/ln341x47.gif' - extra_css = ' h1{font-family: Georgia,serif} body{font-family: Arial,sans-serif} img{margin-top: 0.5em; margin-bottom: 0.2em} .notaEpigrafe{font-size: x-small} ' + extra_css = """ h1{font-family: Georgia,serif} + body{font-family: Arial,sans-serif} + img{margin-top: 0.5em; margin-bottom: 0.2em} + .notaEpigrafe{font-size: x-small} + .topNota h1{font-family: Arial,sans-serif} """ conversion_options = { @@ -29,19 +34,19 @@ class Lanacion(BasicNewsRecipe): , 'language' : language } - keep_only_tags = [dict(name='div', attrs={'class':'nota floatFix'})] + keep_only_tags = [dict(name='div', attrs={'class':['nota floatFix','topNota','nota','post']})] remove_tags = [ dict(name='div' , attrs={'class':'notaComentario floatFix noprint' }) - ,dict(name='ul' , attrs={'class':'cajaHerramientas cajaTop noprint'}) + ,dict(name='ul' , attrs={'class':['cajaHerramientas cajaTop noprint','herramientas noprint']}) ,dict(name='div' , attrs={'class':'cajaHerramientas noprint' }) - ,dict(attrs={'class':['titulosMultimedia','derecha','techo color']}) - ,dict(name=['iframe','embed','object']) + ,dict(attrs={'class':['titulosMultimedia','derecha','techo color','encuesta','izquierda compartir','floatFix']}) + ,dict(name=['iframe','embed','object','form','base','hr']) ] - remove_attributes = ['height','width'] + remove_tags_after = dict(attrs={'class':['tags','nota-destacado']}) + remove_attributes = ['height','width','visible'] 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' ) @@ -50,8 +55,23 @@ class Lanacion(BasicNewsRecipe): ,(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'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' ) + ,(u'Enfoques' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=421' ) + ,(u'Comercio Exterior' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=347' ) + ,(u'Tecnologia' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=432' ) + ,(u'Arquitectura' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=366' ) + ,(u'Turismo' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=504' ) + ,(u'Al volante' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=371' ) + ,(u'El Campo' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=337' ) + ,(u'Moda y Belleza' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=1312' ) + ,(u'Inmuebles Comerciales', u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=1363' ) + ,(u'Countries' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=1348' ) + ,(u'adnCultura' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=6734' ) + ,(u'The Wall Street Journal Americas', u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=6373' ) + ,(u'Estilo de vida' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=7353' ) + ,(u'Management' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=7380' ) + ,(u'Bicentenario' , u'http://www.lanacion.com.ar/herramientas/rss/index.asp?categoria_id=7276' ) ] def preprocess_html(self, soup): diff --git a/resources/recipes/novosti.recipe b/resources/recipes/novosti.recipe index 3c770e883b..eecae620e4 100644 --- a/resources/recipes/novosti.recipe +++ b/resources/recipes/novosti.recipe @@ -11,7 +11,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class Novosti(BasicNewsRecipe): title = 'Vecernje Novosti' __author__ = 'Darko Miletic' - description = 'Vesti' + description = 'U početku su bile istinske večernje novine - pokrenute u vreme Tršćanske krize, Italijansko-jugoslovenskog konflikta oko grada Trsta - ali su brzo izrasle u dnevni informativno-politički list, koji već godinama ima najveći tiraž u Srbiji.' publisher = 'Kompanija Novosti' category = 'news, politics, Serbia' oldest_article = 2 @@ -21,24 +21,22 @@ class Novosti(BasicNewsRecipe): encoding = 'utf-8' language = 'sr' publication_type = 'newspaper' - extra_css = '@font-face {font-family: "serif1";src:url(res:///opt/sony/ebook/FONT/tt0011m_.ttf)} @font-face {font-family: "sans1";src:url(res:///opt/sony/ebook/FONT/tt0003m_.ttf)} .article_description,body{font-family: Tahoma,Arial,Helvetica,sans1,sans-serif} ' + extra_css = """ @font-face {font-family: "sans1";src:url(res:///opt/sony/ebook/FONT/tt0003m_.ttf)} + .article_description,body{font-family: Arial,Helvetica,sans1,sans-serif} + .author{font-size: small} + .articleLead{font-size: large; font-weight: bold} + """ conversion_options = { - 'comment' : description - , 'tags' : category - , 'publisher' : publisher - , 'language' : language - , 'linearize_tables' : True + 'comment' : description + , 'tags' : category + , 'publisher' : publisher + , 'language' : language } preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')] - keep_only_tags = [dict(name='div', attrs={'class':'jednaVest'})] - remove_tags = [dict(name='div', attrs={'class':['info','info_bottom','clip_div']})] + keep_only_tags = [dict(attrs={'class':['articleTitle','author','articleLead','articleBody']})] + remove_tags = [dict(name=['embed','object','iframe','base'])] - feeds = [(u'Vesti', u'http://www.novosti.rs/php/vesti/rss.php')] - - def preprocess_html(self, soup): - for item in soup.findAll(style=True): - del item['style'] - return self.adeify_images(soup) + feeds = [(u'Vesti', u'http://www.novosti.rs/rss/rss-vesti')] diff --git a/src/calibre/__init__.py b/src/calibre/__init__.py index f84941d371..34801d39ca 100644 --- a/src/calibre/__init__.py +++ b/src/calibre/__init__.py @@ -413,15 +413,13 @@ def entity_to_unicode(match, exceptions=[], encoding='cp1252', return check("'") if ent == 'hellips': ent = 'hellip' - if ent.lower().startswith(u'#x'): - num = int(ent[2:], 16) - if encoding is None or num > 255: - return check(my_unichr(num)) - return check(chr(num).decode(encoding)) - if ent.startswith(u'#'): + if ent.startswith('#'): try: - num = int(ent[1:]) - except ValueError: + if ent[1] in ('x', 'X'): + num = int(ent[2:], 16) + else: + num = int(ent[1:]) + except: return '&'+ent+';' if encoding is None or num > 255: return check(my_unichr(num)) diff --git a/src/calibre/customize/builtins.py b/src/calibre/customize/builtins.py index 35cb0ad3d2..1387f162af 100644 --- a/src/calibre/customize/builtins.py +++ b/src/calibre/customize/builtins.py @@ -460,7 +460,7 @@ from calibre.devices.hanvon.driver import N516, EB511, ALEX, AZBOOKA, THEBOOK from calibre.devices.edge.driver import EDGE from calibre.devices.teclast.driver import TECLAST_K3, NEWSMY, IPAPYRUS from calibre.devices.sne.driver import SNE -from calibre.devices.misc import PALMPRE, AVANT, SWEEX, PDNOVEL +from calibre.devices.misc import PALMPRE, AVANT, SWEEX, PDNOVEL, PROMEDIA from calibre.devices.folder_device.driver import FOLDER_DEVICE_FOR_CONFIG from calibre.devices.kobo.driver import KOBO @@ -564,6 +564,7 @@ plugins += [ MENTOR, SWEEX, PDNOVEL, + PROMEDIA, ITUNES, ] plugins += [x for x in list(locals().values()) if isinstance(x, type) and \ diff --git a/src/calibre/devices/misc.py b/src/calibre/devices/misc.py index 6c2a912bd2..6b421ad17a 100644 --- a/src/calibre/devices/misc.py +++ b/src/calibre/devices/misc.py @@ -96,3 +96,20 @@ class PDNOVEL(USBMS): with open('%s.jpg' % os.path.join(path, filename), 'wb') as coverfile: coverfile.write(coverdata[2]) +class PROMEDIA(USBMS): + + name = 'Promedia eBook Reader' + gui_name = 'Promedia' + description = _('Communicate with the Promedia eBook reader') + author = 'Kovid Goyal' + supported_platforms = ['windows', 'linux', 'osx'] + FORMATS = ['epub', 'rtf', 'pdf'] + + VENDOR_ID = [0x525] + PRODUCT_ID = [0xa4a5] + BCD = [0x319] + + EBOOK_DIR_MAIN = 'calibre' + SUPPORTS_SUB_DIRS = True + + diff --git a/src/calibre/gui2/layout.py b/src/calibre/gui2/layout.py index 012a9b5ce3..e0a8325e0d 100644 --- a/src/calibre/gui2/layout.py +++ b/src/calibre/gui2/layout.py @@ -349,6 +349,7 @@ class ShareConnMenu(QMenu): # {{{ for ac in self.email_actions: self.removeAction(ac) self.email_actions = [] + self.memory = [] opts = email_config().parse() if opts.accounts: self.email_to_menu = QMenu(_('Email to')+'...', self) @@ -361,6 +362,7 @@ class ShareConnMenu(QMenu): # {{{ action2 = DeviceAction(dest, True, False, I('mail.svg'), _('Email to')+' '+account+ _(' and delete from library')) map(self.email_to_menu.addAction, (action1, action2)) + map(self.memory.append, (action1, action2)) if default: map(self.addAction, (action1, action2)) map(self.email_actions.append, (action1, action2))