I was trying to get cross-device sync to work with the epubs that I bought from B&N and converted to .mobi.
It was not working with the UUID that is generated/created by default.
So, I modified "calibre/src/calibre/ebooks/mobi/writer2/main.py"
I modified the ASIN set block to look like this:
Code:
# Write UUID as ASIN
uuid = None
from calibre.ebooks.oeb.base import OPF
for x in oeb.metadata['identifier']:
if x.get(OPF('scheme'), None).lower() == 'asin' or unicode(x).startswith('urn:asin:'):
uuid = unicode(x).split(':')[-1]
break
if x.get(OPF('scheme'), None).lower() == 'amazon' or unicode(x).startswith('urn:amazon:'):
uuid = unicode(x).split(':')[-1]
break
if uuid is None:
for x in oeb.metadata['identifier']:
if x.get(OPF('scheme'), None).lower() == 'uuid' or unicode(x).startswith('urn:uuid:'):
uuid = unicode(x).split(':')[-1]
break
if isinstance(uuid, unicode):
uuid = uuid.encode('utf-8')
if not self.opts.share_not_sync:
exth.write(pack(b'>II', 113, len(uuid) + 8))
exth.write(uuid)
nrecs += 1
I feel like this provides support for the Amazon sync feature while still allowing a value to be input (UUID) without user intervention.
This feature only works if an ASIN has been set on the ebook.
Feedback welcome! (I've never done python before I just made this work because I wanted the feature. I wanted to share it here in case other people needed it.)