File asin.patch of Package calibre

--- src/calibre/ebooks/mobi/writer8/exth.py
+++ src/calibre/ebooks/mobi/writer8/exth.py
@@ -108,7 +108,19 @@
 
     if isinstance(uuid, unicode):
         uuid = uuid.encode('utf-8')
-    if not share_not_sync:
+
+    asin = None
+    for x in metadata['identifier']:
+        if (x.get(OPF('scheme'), None).lower() == 'mobi-asin' or
+                unicode(x).startswith('urn:mobi-asin:')):
+            asin = unicode(x).split(':')[-1].encode('utf-8')
+            break
+
+    if asin is not None:
+        exth.write(pack(b'>II', 113, len(asin) + 8))
+        exth.write(asin)
+        nrecs += 1
+    elif not share_not_sync:
         exth.write(pack(b'>II', 113, len(uuid) + 8))
         exth.write(uuid)
         nrecs += 1
openSUSE Build Service is sponsored by