mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Content server: Update metadata when sending MOBI files
This commit is contained in:
parent
31534f3dd2
commit
91b166b744
@ -202,7 +202,7 @@ class ContentServer(object):
|
|||||||
mode='rb')
|
mode='rb')
|
||||||
if fmt is None:
|
if fmt is None:
|
||||||
raise cherrypy.HTTPError(404, 'book: %d does not have format: %s'%(id, format))
|
raise cherrypy.HTTPError(404, 'book: %d does not have format: %s'%(id, format))
|
||||||
mi = self.db.get_metadata(id, index_is_id=True)
|
mi = newmi = self.db.get_metadata(id, index_is_id=True)
|
||||||
if format == 'EPUB':
|
if format == 'EPUB':
|
||||||
# Get the original metadata
|
# Get the original metadata
|
||||||
|
|
||||||
@ -214,9 +214,8 @@ class ContentServer(object):
|
|||||||
# Transform the metadata via the plugboard
|
# Transform the metadata via the plugboard
|
||||||
newmi = mi.deepcopy_metadata()
|
newmi = mi.deepcopy_metadata()
|
||||||
newmi.template_to_attribute(mi, cpb)
|
newmi.template_to_attribute(mi, cpb)
|
||||||
else:
|
|
||||||
newmi = mi
|
|
||||||
|
|
||||||
|
if format in ('MOBI', 'EPUB'):
|
||||||
# Write the updated file
|
# Write the updated file
|
||||||
from calibre.ebooks.metadata.meta import set_metadata
|
from calibre.ebooks.metadata.meta import set_metadata
|
||||||
set_metadata(fmt, newmi, 'epub')
|
set_metadata(fmt, newmi, 'epub')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user