From 37b410705228ecac6e1362371560327963a7d051 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 1 Dec 2011 07:59:03 +0530 Subject: [PATCH 1/6] gs24.pl by Michal Szkutnik --- recipes/gs24_pl.recipe | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 recipes/gs24_pl.recipe diff --git a/recipes/gs24_pl.recipe b/recipes/gs24_pl.recipe new file mode 100644 index 0000000000..db7125b116 --- /dev/null +++ b/recipes/gs24_pl.recipe @@ -0,0 +1,43 @@ +# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai + +import re +import string +from calibre.web.feeds.news import BasicNewsRecipe + +class AdvancedUserRecipe1322322819(BasicNewsRecipe): + title = u'GS24.pl (Głos Szczeciński)' + description = u'Internetowy serwis Głosu Szczecińskiego' + __author__ = u'Michał Szkutnik' + __license__ = u'GPL v3' + language = 'pl' + publisher = 'Media Regionalne sp. z o.o.' + category = 'news, szczecin' + oldest_article = 2 + max_articles_per_feed = 100 + auto_cleanup = True + cover_url = "http://www.gs24.pl/images/top_logo.png" + + feeds = [ + # (u'Wszystko', u'http://www.gs24.pl/rss.xml'), + (u'Szczecin', u'http://www.gs24.pl/szczecin.xml'), + (u'Stargard', u'http://www.gs24.pl/stargard.xml'), + (u'Świnoujście', u'http://www.gs24.pl/swinoujscie.xml'), + (u'Goleniów', u'http://www.gs24.pl/goleniow.xml'), + (u'Gryfice', u'http://www.gs24.pl/gryfice.xml'), + (u'Kamień Pomorski', u'http://www.gs24.pl/kamienpomorski.xml'), + (u'Police', u'http://www.gs24.pl/police.xml'), + (u'Region', u'http://www.gs24.pl/region.xml'), + (u'Sport', u'http://www.gs24.pl/sport.xml'), + ] + + def get_article_url(self, article): + s = re.search("""/0L0S(gs24.*)/story01.htm""", article.link) + s = s.group(1) + replacements = { "0B" : ".", "0C" : "/", "0H" : ",", "0I" : "_", "0D" : "?", "0F" : "="} + for (a, b) in replacements.iteritems(): + s = string.replace(s, a, b) + s = string.replace(s, "0A", "0") + return "http://"+s + + def print_version(self, url): + return url + "&Template=printpicart" From 61e828b2c2c6647d92e21973be2eba9ff9f0e8bb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 1 Dec 2011 08:33:47 +0530 Subject: [PATCH 2/6] Metadata download, do not strip # from titles. Fixes #898310 (Special characters stripped rather than encoded when getting metadata) --- src/calibre/ebooks/metadata/sources/amazon.py | 8 ++++++++ src/calibre/ebooks/metadata/sources/base.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/metadata/sources/amazon.py b/src/calibre/ebooks/metadata/sources/amazon.py index 52dd109b47..8f663bcf86 100644 --- a/src/calibre/ebooks/metadata/sources/amazon.py +++ b/src/calibre/ebooks/metadata/sources/amazon.py @@ -741,6 +741,14 @@ if __name__ == '__main__': # tests {{{ isbn_test, title_test, authors_test) com_tests = [ # {{{ + ( # # in title + {'title':'Expert C# 2008 Business Objects', + 'authors':['Lhotka']}, + [title_test('Expert C# 2008 Business Objects', exact=True), + authors_test(['Rockford Lhotka']) + ] + ), + ( # Description has links {'identifiers':{'isbn': '9780671578275'}}, [title_test('A Civil Campaign: A Comedy of Biology and Manners', diff --git a/src/calibre/ebooks/metadata/sources/base.py b/src/calibre/ebooks/metadata/sources/base.py index f04291eae9..9ae8902671 100644 --- a/src/calibre/ebooks/metadata/sources/base.py +++ b/src/calibre/ebooks/metadata/sources/base.py @@ -344,7 +344,7 @@ class Source(Plugin): # Remove single quotes not followed by 's' (r"'(?!s)", ''), # Replace other special chars with a space - (r'''[:,;+!@#$%^&*(){}.`~"\s\[\]/]''', ' ') + (r'''[:,;+!@$%^&*(){}.`~"\s\[\]/]''', ' '), ]] for pat, repl in title_patterns: From 3e711576078592f3e5e1019a11bb4ee3a9e583a1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 1 Dec 2011 08:48:05 +0530 Subject: [PATCH 3/6] Driver for Blackberry Playbook --- src/calibre/customize/builtins.py | 4 ++-- src/calibre/devices/blackberry/driver.py | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/calibre/customize/builtins.py b/src/calibre/customize/builtins.py index bff4fe4060..b29d67065d 100644 --- a/src/calibre/customize/builtins.py +++ b/src/calibre/customize/builtins.py @@ -545,7 +545,7 @@ from calibre.customize.profiles import input_profiles, output_profiles from calibre.devices.apple.driver import ITUNES from calibre.devices.hanlin.driver import HANLINV3, HANLINV5, BOOX, SPECTRA -from calibre.devices.blackberry.driver import BLACKBERRY +from calibre.devices.blackberry.driver import BLACKBERRY, PLAYBOOK from calibre.devices.cybook.driver import CYBOOK, ORIZON from calibre.devices.eb600.driver import (EB600, COOL_ER, SHINEBOOK, POCKETBOOK360, GER2, ITALICA, ECLICTO, DBOOK, INVESBOOK, @@ -646,7 +646,7 @@ plugins += [ plugins += [ HANLINV3, HANLINV5, - BLACKBERRY, + BLACKBERRY, PLAYBOOK, CYBOOK, ORIZON, ILIAD, diff --git a/src/calibre/devices/blackberry/driver.py b/src/calibre/devices/blackberry/driver.py index 1ae6a6c49f..4a85fa695a 100644 --- a/src/calibre/devices/blackberry/driver.py +++ b/src/calibre/devices/blackberry/driver.py @@ -28,3 +28,26 @@ class BLACKBERRY(USBMS): EBOOK_DIR_MAIN = 'eBooks' SUPPORTS_SUB_DIRS = True + +class PLAYBOOK(USBMS): + + name = 'Blackberry Playbook Interface' + gui_name = 'Playbook' + description = _('Communicate with the Blackberry playbook.') + author = _('Kovid Goyal') + supported_platforms = ['windows', 'linux', 'osx'] + + # Ordered list of supported formats + FORMATS = ['epub'] + + VENDOR_ID = [0x0fca] + PRODUCT_ID = [0x8010] + BCD = [0x1] + + VENDOR_NAME = 'GENERIC-' + WINDOWS_MAIN_MEM = 'MULTI-CARD' + + MAIN_MEMORY_VOLUME_LABEL = 'Blackberry' + + EBOOK_DIR_MAIN = 'media/books' + SUPPORTS_SUB_DIRS = True From 184ffa4d5cc44a2c62ec536429a8090f53ce3c35 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 1 Dec 2011 10:08:35 +0530 Subject: [PATCH 4/6] ... --- src/calibre/manual/faq.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/manual/faq.rst b/src/calibre/manual/faq.rst index b58b87cc5e..4fc13ef80d 100644 --- a/src/calibre/manual/faq.rst +++ b/src/calibre/manual/faq.rst @@ -374,6 +374,8 @@ any |app| developers will ever feel motivated enough to support it. There is how that allows you to create collections on your Kindle from the |app| metadata. It is available `from here `_. +.. note:: Amazon have removed the ability to manipulate collections completely in their newer models, like the Kindle Touch and Kindle Fire, making even the above plugin useless. If you really want the ability to manage collections on your Kindle via a USB connection, we encourage you to complain to Amazon about it, or get a reader where this is supported, like the SONY Readers. + Library Management ------------------ From a4a9b15fa688ac023763feaf15d5dc2b2fcb0486 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 1 Dec 2011 10:09:31 +0530 Subject: [PATCH 5/6] Metadata search and replace, make the regular expressions unicode aware --- src/calibre/gui2/dialogs/metadata_bulk.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/calibre/gui2/dialogs/metadata_bulk.py b/src/calibre/gui2/dialogs/metadata_bulk.py index 928be3843c..c956036fda 100644 --- a/src/calibre/gui2/dialogs/metadata_bulk.py +++ b/src/calibre/gui2/dialogs/metadata_bulk.py @@ -743,6 +743,8 @@ class MetadataBulkDialog(ResizableDialog, Ui_MetadataBulkDialog): else: flags = re.I + flags |= re.UNICODE + try: if self.search_mode.currentIndex() == 0: self.s_r_obj = re.compile(re.escape(unicode(self.search_for.text())), flags) From 87b37ac4e294b169d0c4d7dfda853ecd5398efd3 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 1 Dec 2011 15:04:18 +0530 Subject: [PATCH 6/6] Gazeta.pl Szczecin by Michal Szkutnik. Fixes #898378 (Gazeta.pl Szczecin recipe submission) --- recipes/gazeta_pl_szczecin.recipe | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 recipes/gazeta_pl_szczecin.recipe diff --git a/recipes/gazeta_pl_szczecin.recipe b/recipes/gazeta_pl_szczecin.recipe new file mode 100644 index 0000000000..af229c5721 --- /dev/null +++ b/recipes/gazeta_pl_szczecin.recipe @@ -0,0 +1,35 @@ +# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai + +import re +import string +from calibre.web.feeds.news import BasicNewsRecipe + +class GazetaPlSzczecin(BasicNewsRecipe): + title = u'Gazeta.pl Szczecin' + description = u'Wiadomości ze Szczecina na portalu Gazeta.pl.' + __author__ = u'Michał Szkutnik' + __license__ = u'GPL v3' + language = 'pl' + publisher = 'Agora S.A.' + category = 'news, szczecin' + oldest_article = 2 + max_articles_per_feed = 100 + auto_cleanup = True + remove_tags = [ { "name" : "a", "attrs" : { "href" : "http://szczecin.gazeta.pl/szczecin/www.gazeta.pl" }}] + cover_url = "http://bi.gazeta.pl/i/hp/hp2009/logo.gif" + feeds = [(u'Wszystkie', u'http://rss.feedsportal.com/c/32739/f/530434/index.rss')] + + def get_article_url(self, article): + s = re.search("""/0L(szczecin.*)/story01.htm""", article.link) + s = s.group(1) + replacements = { "0B" : ".", "0C" : "/", "0H" : ",", "0I" : "_"} + for (a, b) in replacements.iteritems(): + s = string.replace(s, a, b) + s = string.replace(s, "0A", "0") + return "http://"+s + + def print_version(self, url): + s = re.search("""/(\d*),(\d*),(\d*),.*\.html""", url) + no1 = s.group(2) + no2 = s.group(3) + return """http://szczecin.gazeta.pl/szczecin/2029020,%s,%s.html""" % (no1, no2)