mirror of
https://github.com/janeczku/calibre-web
synced 2024-12-25 09:30:31 +00:00
Bugfix write metadata
Bugfix change of custom column now sets updates the book timestamp
This commit is contained in:
commit
7ade4615a4
@ -1123,9 +1123,10 @@ def edit_cc_data(book_id, book, to_save, cc):
|
|||||||
cc_db_value = None
|
cc_db_value = None
|
||||||
if to_save[cc_string].strip():
|
if to_save[cc_string].strip():
|
||||||
if c.datatype in ['int', 'bool', 'float', "datetime", "comments"]:
|
if c.datatype in ['int', 'bool', 'float', "datetime", "comments"]:
|
||||||
changed, to_save = edit_cc_data_value(book_id, book, c, to_save, cc_db_value, cc_string)
|
change, to_save = edit_cc_data_value(book_id, book, c, to_save, cc_db_value, cc_string)
|
||||||
else:
|
else:
|
||||||
changed, to_save = edit_cc_data_string(book, c, to_save, cc_db_value, cc_string)
|
change, to_save = edit_cc_data_string(book, c, to_save, cc_db_value, cc_string)
|
||||||
|
changed |= change
|
||||||
else:
|
else:
|
||||||
if cc_db_value is not None:
|
if cc_db_value is not None:
|
||||||
# remove old cc_val
|
# remove old cc_val
|
||||||
|
@ -173,10 +173,13 @@ class TaskBackupMetadata(CalibreTask):
|
|||||||
|
|
||||||
date = etree.SubElement(metadata, PURL + "date", nsmap=NSMAP)
|
date = etree.SubElement(metadata, PURL + "date", nsmap=NSMAP)
|
||||||
date.text = '{d.year:04}-{d.month:02}-{d.day:02}T{d.hour:02}:{d.minute:02}:{d.second:02}'.format(d=book.pubdate)
|
date.text = '{d.year:04}-{d.month:02}-{d.day:02}T{d.hour:02}:{d.minute:02}:{d.second:02}'.format(d=book.pubdate)
|
||||||
if book.comments:
|
if book.comments and book.comments[0].text:
|
||||||
for b in book.comments:
|
for b in book.comments:
|
||||||
description = etree.SubElement(metadata, PURL + "description", nsmap=NSMAP)
|
description = etree.SubElement(metadata, PURL + "description", nsmap=NSMAP)
|
||||||
description.text = b.text
|
description.text = b.text
|
||||||
|
for b in book.publishers:
|
||||||
|
publisher = etree.SubElement(metadata, PURL + "publisher", nsmap=NSMAP)
|
||||||
|
publisher.text = str(b.name)
|
||||||
if not book.languages:
|
if not book.languages:
|
||||||
language = etree.SubElement(metadata, PURL + "language", nsmap=NSMAP)
|
language = etree.SubElement(metadata, PURL + "language", nsmap=NSMAP)
|
||||||
language.text = self.export_language
|
language.text = self.export_language
|
||||||
@ -198,6 +201,10 @@ class TaskBackupMetadata(CalibreTask):
|
|||||||
etree.SubElement(metadata, "meta", name="calibre:series_index",
|
etree.SubElement(metadata, "meta", name="calibre:series_index",
|
||||||
content=str(book.series_index),
|
content=str(book.series_index),
|
||||||
nsmap=NSMAP)
|
nsmap=NSMAP)
|
||||||
|
if len(book.ratings) and book.ratings[0].rating > 0:
|
||||||
|
etree.SubElement(metadata, "meta", name="calibre:rating",
|
||||||
|
content=str(book.ratings[0].rating),
|
||||||
|
nsmap=NSMAP)
|
||||||
etree.SubElement(metadata, "meta", name="calibre:timestamp",
|
etree.SubElement(metadata, "meta", name="calibre:timestamp",
|
||||||
content='{d.year:04}-{d.month:02}-{d.day:02}T{d.hour:02}:{d.minute:02}:{d.second:02}'.format(
|
content='{d.year:04}-{d.month:02}-{d.day:02}T{d.hour:02}:{d.minute:02}:{d.second:02}'.format(
|
||||||
d=book.timestamp),
|
d=book.timestamp),
|
||||||
@ -211,8 +218,8 @@ class TaskBackupMetadata(CalibreTask):
|
|||||||
extra = None
|
extra = None
|
||||||
cc_entry = getattr(book, "custom_column_" + str(cc.id))
|
cc_entry = getattr(book, "custom_column_" + str(cc.id))
|
||||||
if cc_entry.__len__():
|
if cc_entry.__len__():
|
||||||
value = cc_entry[0].get("value")
|
value = cc_entry[0].value
|
||||||
extra = cc_entry[0].get("extra")
|
extra = cc_entry[0].extra if hasattr(cc_entry[0], "extra") else None
|
||||||
etree.SubElement(metadata, "meta", name="calibre:user_metadata:#{}".format(cc.label),
|
etree.SubElement(metadata, "meta", name="calibre:user_metadata:#{}".format(cc.label),
|
||||||
content=cc.to_json(value, extra, sequence),
|
content=cc.to_json(value, extra, sequence),
|
||||||
nsmap=NSMAP)
|
nsmap=NSMAP)
|
||||||
|
@ -47,9 +47,9 @@ install_requires =
|
|||||||
backports_abc>=0.4
|
backports_abc>=0.4
|
||||||
Flask>=1.0.2,<2.3.0
|
Flask>=1.0.2,<2.3.0
|
||||||
iso-639>=0.4.5,<0.5.0
|
iso-639>=0.4.5,<0.5.0
|
||||||
PyPDF==3.4.0
|
PyPDF>=3.0.0,<3.6.0
|
||||||
pytz>=2016.10
|
pytz>=2016.10
|
||||||
requests>=2.11.1,<2.28.0
|
requests>=2.11.1,<2.29.0
|
||||||
SQLAlchemy>=1.3.0,<2.0.0
|
SQLAlchemy>=1.3.0,<2.0.0
|
||||||
tornado>=4.1,<6.3
|
tornado>=4.1,<6.3
|
||||||
Wand>=0.4.4,<0.7.0
|
Wand>=0.4.4,<0.7.0
|
||||||
@ -58,7 +58,7 @@ install_requires =
|
|||||||
flask-wtf>=0.14.2,<1.2.0
|
flask-wtf>=0.14.2,<1.2.0
|
||||||
chardet>=3.0.0,<4.1.0
|
chardet>=3.0.0,<4.1.0
|
||||||
advocate>=1.0.0,<1.1.0
|
advocate>=1.0.0,<1.1.0
|
||||||
Flask-Limiter>=2.3.0,<3.3.0
|
Flask-Limiter>=2.3.0,<3.4.0
|
||||||
|
|
||||||
|
|
||||||
[options.extras_require]
|
[options.extras_require]
|
||||||
@ -95,7 +95,7 @@ metadata =
|
|||||||
beautifulsoup4>=4.0.1,<4.12.0
|
beautifulsoup4>=4.0.1,<4.12.0
|
||||||
cchardet>=2.0.0,<2.2.0
|
cchardet>=2.0.0,<2.2.0
|
||||||
comics =
|
comics =
|
||||||
natsort>=2.2.0,<8.3.0
|
natsort>=2.2.0,<8.4.0
|
||||||
comicapi>=2.2.0,<2.3.0
|
comicapi>=2.2.0,<2.3.0
|
||||||
kobo =
|
kobo =
|
||||||
jsonschema>=3.2.0,<4.18.0
|
jsonschema>=3.2.0,<4.18.0
|
||||||
|
Loading…
Reference in New Issue
Block a user