From d661b15ae232ef805ce1ce7699e495c943fd9d82 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 3 Feb 2013 22:35:41 +0530 Subject: [PATCH] Read calibre book uuid when reading metadata from MOBI files, needed for round-tripping to preserve the uuid when tweaking --- src/calibre/ebooks/mobi/reader/headers.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/calibre/ebooks/mobi/reader/headers.py b/src/calibre/ebooks/mobi/reader/headers.py index 690b4b488e..8e96475e36 100644 --- a/src/calibre/ebooks/mobi/reader/headers.py +++ b/src/calibre/ebooks/mobi/reader/headers.py @@ -123,6 +123,12 @@ class EXTHHeader(object): # {{{ raw = check_isbn(content[len(isig):]) if raw and not self.mi.isbn: self.mi.isbn = raw + elif content.startswith('calibre:'): + # calibre book uuid is stored here by recent calibre + # releases + cid = content[len('calibre:'):] + if cid: + self.mi.application_id = self.mi.uuid = cid except: pass elif idx == 113: # ASIN or other id