View Single Post
Old 12-30-2016, 10:22 AM   #9
Helmut G
Junior Member
Helmut G began at the beginning.
 
Helmut G's Avatar
 
Posts: 1
Karma: 10
Join Date: Dec 2016
Device: tablet, kindle pw, kobo aura one
Quote:
Originally Posted by kovidgoyal View Post
Metadata download does not use mobi-asin as there is no way to know which country store a mobi-asin corresponds to. You can use the search and replace feature of te bulk metadata edit dialog to mass convert the mobi-asin: to amazon: identifiers before running the download.
This is undoutably true. However, as most users who buy ebooks from amazon do this via one country-specific portal, it would be handy to be able to use this for inital metadata retrieval. After initial retrieval, the correct country-specific amazon identifier will be set correctly.
Of course this should be handled as an option to the amazon module defaulting to false.
After playing around with this I came up with the following changes to amazon.py.
I know there are different ways to work around this, but this is really easy to use (at least if most of your ebooks come from a single amazon portal that is available for selection in your amazon.py module.)
Would you be willing to consider adding something like that to you upstream module?

Code:
--- a/src/calibre/ebooks/metadata/sources/amazon.py
+++ b/src/calibre/ebooks/metadata/sources/amazon.py
@@ -793,6 +793,9 @@ class Amazon(Source):
             Option('domain', 'choices', 'com', _('Amazon website to use:'),
                 _('Metadata from Amazon will be fetched using this '
                     'country\'s Amazon website.'), choices=AMAZON_DOMAINS),
+           Option('use_mobi_asin', 'bool', False,
+               _('use ebook-internal mobi-asin to match eBook'),
+               _('Match eBook on selected Amazon site using the mobi-asin identifier contained in most Amazon eBooks')),
             )

     def __init__(self, *args, **kwargs):
@@ -837,6 +840,8 @@ class Amazon(Source):
             key = key.lower()
             if key in ('amazon', 'asin'):
                 return 'com', val
+            if (self.prefs['use_mobi_asin'] and key in ('mobi-asin')):
+                return self.prefs['domain'], val
             if key.startswith('amazon_'):
                 domain = key.partition('_')[-1]
                 if domain and (domain in self.AMAZON_DOMAINS or domain in extra_domains):
Helmut G is offline   Reply With Quote