mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
title and author sort for PDF metadata
This commit is contained in:
parent
196e3286d8
commit
60b80868e4
@ -212,6 +212,12 @@ def metadata_from_xmp_packet(raw_bytes):
|
|||||||
series, series_index = read_series(root)
|
series, series_index = read_series(root)
|
||||||
if series:
|
if series:
|
||||||
mi.series, mi.series_index = series, series_index
|
mi.series, mi.series_index = series, series_index
|
||||||
|
for x in ('title_sort', 'author_sort'):
|
||||||
|
for elem in XPath('//calibre:' + x)(root):
|
||||||
|
val = read_simple_property(elem)
|
||||||
|
if val:
|
||||||
|
setattr(mi, x, val)
|
||||||
|
break
|
||||||
|
|
||||||
identifiers = {}
|
identifiers = {}
|
||||||
for xmpid in XPath('//xmp:Identifier')(root):
|
for xmpid in XPath('//xmp:Identifier')(root):
|
||||||
@ -369,6 +375,9 @@ def metadata_to_xmp_packet(mi):
|
|||||||
create_simple_property(calibre, 'calibre:rating', '%g' % r)
|
create_simple_property(calibre, 'calibre:rating', '%g' % r)
|
||||||
if not mi.is_null('series'):
|
if not mi.is_null('series'):
|
||||||
create_series(calibre, mi.series, mi.series_index)
|
create_series(calibre, mi.series, mi.series_index)
|
||||||
|
for x in ('title_sort', 'author_sort'):
|
||||||
|
if not mi.is_null(x):
|
||||||
|
create_simple_property(calibre, 'calibre:'+x, getattr(mi, x))
|
||||||
return serialize_xmp_packet(root)
|
return serialize_xmp_packet(root)
|
||||||
|
|
||||||
def find_used_namespaces(elem):
|
def find_used_namespaces(elem):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user