mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 07:23:09 +02:00
MOBI Output: Add option in Preferences->Output Options->MOBI Output to enable the share via Facebook feature for calibre produced MOBI files. Note that enabling this disables the sync last read position across multiple devices feature. Don't ask me why, ask Amazon.
This commit is contained in:
parent
c8a78a83bc
commit
2e994081ed
5 changed files with 20 additions and 5 deletions
|
|
@ -330,9 +330,11 @@ def update_exth_record(rec):
|
|||
prefs = load_defaults('mobi_output')
|
||||
pas = prefs.get('prefer_author_sort', False)
|
||||
kindle_pdoc = prefs.get('personal_doc', None)
|
||||
share_not_sync = prefs.get('share_not_sync', False)
|
||||
except:
|
||||
pas = False
|
||||
kindle_pdoc = None
|
||||
share_not_sync = False
|
||||
if mi.author_sort and pas:
|
||||
authors = mi.author_sort
|
||||
update_exth_record((100, normalize(authors).encode(self.codec, 'replace')))
|
||||
|
|
@ -376,7 +378,7 @@ def update_exth_record(rec):
|
|||
# Add a 113 record if not present to allow Amazon syncing
|
||||
if (113 not in self.original_exth_records and
|
||||
self.original_exth_records.get(501, None) == 'EBOK' and
|
||||
not added_501):
|
||||
not added_501 and not share_not_sync):
|
||||
from uuid import uuid4
|
||||
update_exth_record((113, str(uuid4())))
|
||||
if 503 in self.original_exth_records:
|
||||
|
|
|
|||
|
|
@ -55,6 +55,11 @@ class MOBIOutput(OutputFormatPlugin):
|
|||
' specified directory. If the directory already '
|
||||
'exists, it will be deleted.')
|
||||
),
|
||||
OptionRecommendation(name='share_not_sync', recommended_value=False,
|
||||
help=_('Enable sharing of book content via Facebook etc. '
|
||||
' on the Kindle. WARNING: Using this feature means that '
|
||||
' the book will not auto sync its last read position '
|
||||
' on multiple devices. Complain to Amazon.'))
|
||||
])
|
||||
|
||||
def check_for_periodical(self):
|
||||
|
|
|
|||
|
|
@ -529,9 +529,10 @@ def build_exth(self): # EXTH Header {{{
|
|||
|
||||
if isinstance(uuid, unicode):
|
||||
uuid = uuid.encode('utf-8')
|
||||
exth.write(pack(b'>II', 113, len(uuid) + 8))
|
||||
exth.write(uuid)
|
||||
nrecs += 1
|
||||
if not self.opts.share_not_sync:
|
||||
exth.write(pack(b'>II', 113, len(uuid) + 8))
|
||||
exth.write(uuid)
|
||||
nrecs += 1
|
||||
|
||||
# Write cdetype
|
||||
if not self.is_periodical:
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ def __init__(self, parent, get_option, get_help, db=None, book_id=None):
|
|||
Widget.__init__(self, parent,
|
||||
['prefer_author_sort', 'rescale_images', 'toc_title',
|
||||
'mobi_ignore_margins', 'mobi_toc_at_start',
|
||||
'dont_compress', 'no_inline_toc',
|
||||
'dont_compress', 'no_inline_toc', 'share_not_sync',
|
||||
'personal_doc']#, 'mobi_navpoints_only_deepest']
|
||||
)
|
||||
self.db, self.book_id = db, book_id
|
||||
|
|
|
|||
|
|
@ -75,6 +75,13 @@
|
|||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="opt_share_not_sync">
|
||||
<property name="text">
|
||||
<string>Enable sharing of book content via Facebook, etc. WARNING: Disables last read syncing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
|
|
|||
Loading…
Reference in a new issue