From f62c31fd447940cfb1705297631efebdad6ab626 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 6 Oct 2012 09:49:45 +0530 Subject: [PATCH 1/7] Fix #1062486 (Unhandled exception configuring MTP device) --- src/calibre/gui2/device_drivers/mtp_config.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/device_drivers/mtp_config.py b/src/calibre/gui2/device_drivers/mtp_config.py index dbb31a3e3d..5ab1dd692e 100644 --- a/src/calibre/gui2/device_drivers/mtp_config.py +++ b/src/calibre/gui2/device_drivers/mtp_config.py @@ -146,7 +146,7 @@ class SendToConfig(QWidget): # {{{ def browse(self): b = Browser(self.device.filesystem_cache, show_files=False, parent=self) - if b.exec_() == b.Accepted: + if b.exec_() == b.Accepted and b.current_item is not None: sid, path = b.current_item self.t.setText('/'.join(path[1:])) @@ -250,7 +250,7 @@ class Rule(QWidget): def browse(self): b = Browser(self.device.filesystem_cache, show_files=False, parent=self) - if b.exec_() == b.Accepted: + if b.exec_() == b.Accepted and b.current_item is not None: sid, path = b.current_item self.folder.setText('/'.join(path[1:])) From b6559b4f7d503754ebf8d1d2dc6442429d9c901e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 6 Oct 2012 09:52:33 +0530 Subject: [PATCH 2/7] Mobile Nations, The Verge and Television WIthout Pity by Krittika Goyal --- recipes/mobilenations.recipe | 21 +++++++++++++++++++++ recipes/television_without_pity.recipe | 21 +++++++++++++++++++++ recipes/the_verge.recipe | 21 +++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 recipes/mobilenations.recipe create mode 100644 recipes/television_without_pity.recipe create mode 100644 recipes/the_verge.recipe diff --git a/recipes/mobilenations.recipe b/recipes/mobilenations.recipe new file mode 100644 index 0000000000..c81bffc029 --- /dev/null +++ b/recipes/mobilenations.recipe @@ -0,0 +1,21 @@ +from calibre.web.feeds.news import BasicNewsRecipe + +class HindustanTimes(BasicNewsRecipe): + title = u'Mobile Nations' + language = 'en' + __author__ = 'Krittika Goyal' + oldest_article = 1 #days + max_articles_per_feed = 25 + #encoding = 'cp1252' + use_embedded_content = False + + no_stylesheets = True + auto_cleanup = True + #auto_cleanup_keep = '//div[@class="story-image shadowbox entry-content-asset"]' + + + feeds = [ +('News', + 'http://www.mobilenations.com/rss/mb.xml'), +] + diff --git a/recipes/television_without_pity.recipe b/recipes/television_without_pity.recipe new file mode 100644 index 0000000000..e48bce5859 --- /dev/null +++ b/recipes/television_without_pity.recipe @@ -0,0 +1,21 @@ +from calibre.web.feeds.news import BasicNewsRecipe + +class HindustanTimes(BasicNewsRecipe): + title = u'Television Without Pity' + language = 'en' + __author__ = 'Krittika Goyal' + oldest_article = 1 #days + max_articles_per_feed = 25 + #encoding = 'cp1252' + use_embedded_content = False + + no_stylesheets = True + auto_cleanup = True + #auto_cleanup_keep = '//div[@class="float_right"]' + + + feeds = [ +('News', + 'http://www.televisionwithoutpity.com/rss.xml'), +] + diff --git a/recipes/the_verge.recipe b/recipes/the_verge.recipe new file mode 100644 index 0000000000..83c1ed5e70 --- /dev/null +++ b/recipes/the_verge.recipe @@ -0,0 +1,21 @@ +from calibre.web.feeds.news import BasicNewsRecipe + +class HindustanTimes(BasicNewsRecipe): + title = u'The Verge' + language = 'en' + __author__ = 'Krittika Goyal' + oldest_article = 1 #days + max_articles_per_feed = 25 + #encoding = 'cp1252' + use_embedded_content = False + + no_stylesheets = True + auto_cleanup = True + auto_cleanup_keep = '//div[@class="story-image shadowbox entry-content-asset"]' + + + feeds = [ +('News', + 'http://www.theverge.com/rss/index.xml'), +] + From 704219fb4ffa8c377a61cb13315cba63315f9e09 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 6 Oct 2012 10:18:36 +0530 Subject: [PATCH 3/7] KF8 Output: Fix handling of input documents that have URL unsafe characters in the file names of their images. Fixes #1062477 (KF8 generation fails with images in PG epubs) --- src/calibre/ebooks/mobi/writer8/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/ebooks/mobi/writer8/main.py b/src/calibre/ebooks/mobi/writer8/main.py index 5acb04ebb3..b1479ee7c3 100644 --- a/src/calibre/ebooks/mobi/writer8/main.py +++ b/src/calibre/ebooks/mobi/writer8/main.py @@ -106,7 +106,7 @@ class KF8Writer(object): not used for fonts. ''' def pointer(item, oref): - ref = item.abshref(oref) + ref = urlnormalize(item.abshref(oref)) idx = self.resources.item_map.get(ref, None) if idx is not None: is_image = self.resources.records[idx-1][:4] not in {b'FONT'} From 263836432b597e843f6f65a80440fe0c41d20028 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 6 Oct 2012 10:43:21 +0530 Subject: [PATCH 4/7] ... --- manual/gui.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manual/gui.rst b/manual/gui.rst index 4d276664f6..0dbb29228c 100755 --- a/manual/gui.rst +++ b/manual/gui.rst @@ -51,7 +51,7 @@ Add books 2. **Add books from directories, including sub-directories (One book per directory, assumes every ebook file is the same book in a different format)**: Allows you to choose a directory. The directory and all its sub-directories are scanned recursively, and any ebooks found are added to the library. |app| assumes that each directory contains a single book. All ebook files in a directory are assumed to be the same book in different formats. This action is the inverse of the :ref:`Save to disk ` action, i.e. you can :guilabel:`Save to disk`, delete the books and re-add them with no lost information except for the date. - 3. **Add books from directories, including sub-directories (Multiple books per directory, assumes every ebook file is a different book)**: Allows you to choose a directory. The directory and all its sub-directories are scanned recursively and any ebooks found are added to the library. |app| assumes that each directory contains many books. All ebook files with the same name in a directory are assumed to be the same book in different formats. Ebooks with different names are added as different books. This action is the inverse of the :ref:`Save to disk ` action, i.e. you can :guilabel:`Save to disk`, delete the books and re-add them with no lost information except for the date. + 3. **Add books from directories, including sub-directories (Multiple books per directory, assumes every ebook file is a different book)**: Allows you to choose a directory. The directory and all its sub-directories are scanned recursively and any ebooks found are added to the library. |app| assumes that each directory contains many books. All ebook files with the same name in a directory are assumed to be the same book in different formats. Ebooks with different names are added as different books. 4. **Add empty book. (Book Entry with no formats)**: Allows you to create a blank book record. This can be used to then manually fill out the information about a book that you may not have yet in your collection. From e08971b2eaf98cdd8267691e6accc81b919420f9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 6 Oct 2012 10:44:14 +0530 Subject: [PATCH 5/7] ... --- manual/gui.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manual/gui.rst b/manual/gui.rst index 0dbb29228c..a51ced54d3 100755 --- a/manual/gui.rst +++ b/manual/gui.rst @@ -49,7 +49,7 @@ Add books 1. **Add books from a single directory**: Opens a file chooser dialog and allows you to specify which books in a directory should be added. This action is *context sensitive*, i.e. it depends on which :ref:`catalog ` you have selected. If you have selected the :guilabel:`Library`, books will be added to the library. If you have selected the ebook reader device, the books will be uploaded to the device, and so on. - 2. **Add books from directories, including sub-directories (One book per directory, assumes every ebook file is the same book in a different format)**: Allows you to choose a directory. The directory and all its sub-directories are scanned recursively, and any ebooks found are added to the library. |app| assumes that each directory contains a single book. All ebook files in a directory are assumed to be the same book in different formats. This action is the inverse of the :ref:`Save to disk ` action, i.e. you can :guilabel:`Save to disk`, delete the books and re-add them with no lost information except for the date. + 2. **Add books from directories, including sub-directories (One book per directory, assumes every ebook file is the same book in a different format)**: Allows you to choose a directory. The directory and all its sub-directories are scanned recursively, and any ebooks found are added to the library. |app| assumes that each directory contains a single book. All ebook files in a directory are assumed to be the same book in different formats. This action is the inverse of the :ref:`Save to disk ` action, i.e. you can :guilabel:`Save to disk`, delete the books and re-add them with no lost information except for the date (this assumes you have not changed any of the setting for the Save to disk action). 3. **Add books from directories, including sub-directories (Multiple books per directory, assumes every ebook file is a different book)**: Allows you to choose a directory. The directory and all its sub-directories are scanned recursively and any ebooks found are added to the library. |app| assumes that each directory contains many books. All ebook files with the same name in a directory are assumed to be the same book in different formats. Ebooks with different names are added as different books. From 6926dcbdb80762ec028596d55f7434806532d428 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 6 Oct 2012 10:52:19 +0530 Subject: [PATCH 6/7] ... --- src/calibre/devices/interface.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/devices/interface.py b/src/calibre/devices/interface.py index 3004278dc5..2b3bbd4fd6 100644 --- a/src/calibre/devices/interface.py +++ b/src/calibre/devices/interface.py @@ -634,7 +634,7 @@ class DevicePlugin(Plugin): of prefs['something']. Your method should call device_prefs.set_overrides(pref=val, pref=val, ...). Currently used for: - metadata management (prefs['manage_device_metadata']) + metadata management (prefs['manage_device_metadata']) ''' device_prefs.set_overrides() From 1447f1257581a3f8d95e4a91e38528304edcd878 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 6 Oct 2012 11:07:08 +0530 Subject: [PATCH 7/7] Fix regression that caused calibre to not use OPF files when adding books recursively from directories with multiple books per directory --- src/calibre/library/database2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 07747180f1..5b4f7eec7e 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -3664,7 +3664,7 @@ books_series_link feeds if not ext: continue ext = ext[1:].lower() - if ext not in BOOK_EXTENSIONS: + if ext not in BOOK_EXTENSIONS and ext != 'opf': continue key = os.path.splitext(path)[0]