From e882689f1752a1e0d7ef0dffbeb42be35c82fe44 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 14 Jun 2010 15:13:14 -0600 Subject: [PATCH] Corriero dello sport and Auto and Formula 1 by Gabriele Marini --- resources/recipes/auto.recipe | 63 +++++++++++++++++++ resources/recipes/corriere_dello_sport.recipe | 60 ++++++++++++++++++ src/calibre/devices/kindle/driver.py | 21 +++++++ 3 files changed, 144 insertions(+) create mode 100644 resources/recipes/auto.recipe create mode 100644 resources/recipes/corriere_dello_sport.recipe diff --git a/resources/recipes/auto.recipe b/resources/recipes/auto.recipe new file mode 100644 index 0000000000..959b9997a8 --- /dev/null +++ b/resources/recipes/auto.recipe @@ -0,0 +1,63 @@ +#!/usr/bin/env python +__license__ = 'GPL v3' +__author__ = 'GabrieleMarini, based on Darko Miletic' +__copyright__ = '2009, Darko Miletic , Gabriele Marini' +__version__ = 'v1.02 Marini Gabriele ' +__date__ = '14062010' +__description__ = 'Italian daily newspaper' + +''' +http://www.corrieredellosport.it/ +''' +from calibre.web.feeds.news import BasicNewsRecipe + +class Auto(BasicNewsRecipe): + __author__ = 'Gabriele Marini' + description = 'Auto and Formula 1' + + cover_url = 'http://www.auto.it/res/imgs/logo_Auto.png' + + + title = u'Auto' + publisher = 'CONTE Editore' + category = 'Sport' + + language = 'it' + timefmt = '[%a, %d %b, %Y]' + + oldest_article = 60 + max_articles_per_feed = 30 + use_embedded_content = False + recursion = 10 + + remove_javascript = True + no_stylesheets = True + + html2lrf_options = [ + '--comment', description + , '--category', category + , '--publisher', publisher + , '--ignore-tables' + ] + + html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\nlinearize_tables=True' + + keep_only_tags = [ + dict(name='h2', attrs={'class':['tit_Article y_Txt']}), + dict(name='h2', attrs={'class':['tit_Article']}), + dict(name='div', attrs={'class':['box_Img newsdet_new ']}), + dict(name='div', attrs={'class':['box_Img newsdet_as ']}), + dict(name='table', attrs={'class':['table_A']}), + dict(name='div', attrs={'class':['txt_Article txtBox_cms']}), + dict(name='testoscheda')] + + + feeds = [ + (u'Tutte le News' , u'http://www.auto.it/rss/articoli.xml' ), + (u'Prove su Strada' , u'http://www.auto.it/rss/prove+6.xml'), + (u'Novit\xe0' , u'http://www.auto.it/rss/novita+3.xml') + ] + + + + diff --git a/resources/recipes/corriere_dello_sport.recipe b/resources/recipes/corriere_dello_sport.recipe new file mode 100644 index 0000000000..ac93c702e3 --- /dev/null +++ b/resources/recipes/corriere_dello_sport.recipe @@ -0,0 +1,60 @@ +#!/usr/bin/env python +__license__ = 'GPL v3' +__author__ = 'GabrieleMarini, based on Darko Miletic' +__copyright__ = '2009, Darko Miletic , Gabriele Marini' +__version__ = ' ' +__date__ = '14-06-2010' +__description__ = 'Italian daily newspaper' + +''' +http://www.corrieredellosport.it/ +''' +from calibre.web.feeds.news import BasicNewsRecipe + +class ilCorrieredelloSport(BasicNewsRecipe): + __author__ = 'Gabriele Marini' + description = 'Italian daily newspaper' + + cover_url = 'http://edicola.corrieredellosport.it/newsmem/corsport/prima/nazionale_prima.jpg' + + + title = u'Il Corriere dello Sport' + publisher = 'CORRIERE DELLO SPORT s.r.l. ' + category = 'Sport' + + language = 'it' + timefmt = '[%a, %d %b, %Y]' + + oldest_article = 10 + max_articles_per_feed = 100 + use_embedded_content = False + recursion = 10 + + remove_javascript = True + no_stylesheets = True + + html2lrf_options = [ + '--comment', description + , '--category', category + , '--publisher', publisher + , '--ignore-tables' + ] + + html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\nlinearize_tables=True' + + keep_only_tags = [ + dict(name='h1', attrs={'class':['tit_Article']}), + dict(name='h1', attrs={'class':['tit_Article_mondiali']}), + dict(name='div', attrs={'class':['box_Img']}), + dict(name='p', attrs={'class':['summary','text']})] + + + + + feeds = [ + (u'Primo Piano' , u'http://www.corrieredellosport.it/rss/primo_piano.xml' ), + (u'Calcio' , u'http://www.corrieredellosport.it/rss/Calcio-3.xml'), + (u'Formula 1' , u'http://www.corrieredellosport.it/rss/Formula-1-7.xml'), + (u'Moto' , u'http://www.corrieredellosport.it/rss/Moto-8.xml'), + (u'Piu visti' , u'http://www.corrieredellosport.it/rss/piu_visti.xml') + ] diff --git a/src/calibre/devices/kindle/driver.py b/src/calibre/devices/kindle/driver.py index 31c7fae48e..cd56d210e1 100644 --- a/src/calibre/devices/kindle/driver.py +++ b/src/calibre/devices/kindle/driver.py @@ -13,6 +13,27 @@ from struct import unpack from calibre.devices.usbms.driver import USBMS +''' +Notes on collections: + +A collections cache is stored at system/collections.json +The cache is read only, changes made to it are overwritten (it is regenerated) +on device disconnect + +A log of collection creation/manipulation is available at +system/userannotationlog + +collections.json refers to books via a SHA1 hash of the absolute path to the +book (prefix is /mnt/us on my Kindle). The SHA1 hash may or may not be prefixed +by some characters, use the last 40 characters. + +Changing the metadata and resending the file doesn't seem to affect collections + +Adding a book to a collection on the Kindle does not change the book file at all +(i.e. it is binary identical). Therefore collection information is not stored in +file metadata. +''' + class KINDLE(USBMS): name = 'Kindle Device Interface'