From 5ec3d6e5ee6e8990a69a2a2f38ecab69f6db89e8 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 16 Feb 2011 16:03:38 -0700 Subject: [PATCH] ... --- src/calibre/ebooks/metadata/sources/amazon.py | 22 +++++++++++++++++++ src/calibre/ebooks/metadata/sources/google.py | 5 ++--- src/calibre/ebooks/metadata/sources/test.py | 3 ++- 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 src/calibre/ebooks/metadata/sources/amazon.py diff --git a/src/calibre/ebooks/metadata/sources/amazon.py b/src/calibre/ebooks/metadata/sources/amazon.py new file mode 100644 index 0000000000..88ac1213c5 --- /dev/null +++ b/src/calibre/ebooks/metadata/sources/amazon.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai +from __future__ import (unicode_literals, division, absolute_import, + print_function) + +__license__ = 'GPL v3' +__copyright__ = '2011, Kovid Goyal ' +__docformat__ = 'restructuredtext en' + + +from calibre.ebooks.metadata.sources.base import Source + +class Amazon(Source): + + name = 'Amazon' + description = _('Downloads metadata from Amazon') + + capabilities = frozenset(['identify', 'cover']) + touched_fields = frozenset(['title', 'authors', 'isbn', 'pubdate', + 'comments', 'cover_data']) + + diff --git a/src/calibre/ebooks/metadata/sources/google.py b/src/calibre/ebooks/metadata/sources/google.py index fbc3aaa226..c59bbe6dc5 100644 --- a/src/calibre/ebooks/metadata/sources/google.py +++ b/src/calibre/ebooks/metadata/sources/google.py @@ -162,8 +162,7 @@ class GoogleBooks(Source): touched_fields = frozenset(['title', 'authors', 'isbn', 'tags', 'pubdate', 'comments', 'publisher', 'author_sort']) # language currently disabled - def create_query(self, log, title=None, authors=None, identifiers={}, - start_index=1): + def create_query(self, log, title=None, authors=None, identifiers={}): BASE_URL = 'http://books.google.com/books/feeds/volumes?' isbn = identifiers.get('isbn', None) q = '' @@ -188,7 +187,7 @@ class GoogleBooks(Source): return BASE_URL+urlencode({ 'q':q, 'max-results':20, - 'start-index':start_index, + 'start-index':1, 'min-viewability':'none', }) diff --git a/src/calibre/ebooks/metadata/sources/test.py b/src/calibre/ebooks/metadata/sources/test.py index 3892f31623..cd7e7ab6e8 100644 --- a/src/calibre/ebooks/metadata/sources/test.py +++ b/src/calibre/ebooks/metadata/sources/test.py @@ -87,5 +87,6 @@ def test_identify_plugin(name, tests): prints('Log saved to', lf) raise SystemExit(1) - prints('Log saved to', lf) + if os.stat(lf).st_size > 10: + prints('There were some errors, see log', lf)