mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #2750 ("Unknown" stays listed in author field when creating LRF via ebook-convert) and other minor typos in metadata processing
This commit is contained in:
parent
f1936e18da
commit
f4841f4d9b
@ -229,6 +229,8 @@ def get_metadata(stream):
|
|||||||
tags = [x.strip() for x in mi.category.split(',') if x.strip()]
|
tags = [x.strip() for x in mi.category.split(',') if x.strip()]
|
||||||
if tags:
|
if tags:
|
||||||
mi.tags = tags
|
mi.tags = tags
|
||||||
|
if mi.category.strip() == ',':
|
||||||
|
mi.category = None
|
||||||
mi.publisher = lrf.publisher.strip()
|
mi.publisher = lrf.publisher.strip()
|
||||||
mi.cover_data = lrf.get_cover()
|
mi.cover_data = lrf.get_cover()
|
||||||
try:
|
try:
|
||||||
|
@ -22,9 +22,18 @@ class LRFOptions(object):
|
|||||||
m = oeb.metadata
|
m = oeb.metadata
|
||||||
self.title = None
|
self.title = None
|
||||||
self.author = self.publisher = _('Unknown')
|
self.author = self.publisher = _('Unknown')
|
||||||
|
self.title_sort = self.author_sort = ''
|
||||||
|
for x in m.creator:
|
||||||
|
if x.role == 'aut':
|
||||||
|
self.author = unicode(x)
|
||||||
|
fa = unicode(getattr(x, 'file_as', ''))
|
||||||
|
if fa:
|
||||||
|
self.author_sort = fa
|
||||||
|
for x in m.title:
|
||||||
|
if unicode(x.file_as):
|
||||||
|
self.title_sort = unicode(x.file_as)
|
||||||
self.freetext = f2s(m.description)
|
self.freetext = f2s(m.description)
|
||||||
self.category = f2s(m.tags)
|
self.category = f2s(m.tags)
|
||||||
self.title_sort = self.author_sort = ''
|
|
||||||
self.cover = None
|
self.cover = None
|
||||||
self.use_metadata_cover = True
|
self.use_metadata_cover = True
|
||||||
self.output = output
|
self.output = output
|
||||||
|
@ -317,7 +317,7 @@ class MetaInformation(object):
|
|||||||
if getattr(self, 'book_producer', False):
|
if getattr(self, 'book_producer', False):
|
||||||
fmt('Book Producer', self.book_producer)
|
fmt('Book Producer', self.book_producer)
|
||||||
if self.category:
|
if self.category:
|
||||||
ans += u'Category : ' + unicode(self.category) + u'\n'
|
fmt('Category', self.category)
|
||||||
if self.comments:
|
if self.comments:
|
||||||
fmt('Comments', self.comments)
|
fmt('Comments', self.comments)
|
||||||
if self.isbn:
|
if self.isbn:
|
||||||
|
@ -10,6 +10,7 @@ import os
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
def meta_info_to_oeb_metadata(mi, m, log):
|
def meta_info_to_oeb_metadata(mi, m, log):
|
||||||
|
from calibre.ebooks.oeb.base import OPF
|
||||||
if mi.title:
|
if mi.title:
|
||||||
m.clear('title')
|
m.clear('title')
|
||||||
m.add('title', mi.title)
|
m.add('title', mi.title)
|
||||||
@ -22,7 +23,7 @@ def meta_info_to_oeb_metadata(mi, m, log):
|
|||||||
for a in mi.authors:
|
for a in mi.authors:
|
||||||
attrib = {'role':'aut'}
|
attrib = {'role':'aut'}
|
||||||
if mi.author_sort:
|
if mi.author_sort:
|
||||||
attrib['file_as'] = mi.author_sort
|
attrib[OPF('file-as')] = mi.author_sort
|
||||||
m.add('creator', a, attrib=attrib)
|
m.add('creator', a, attrib=attrib)
|
||||||
if mi.book_producer:
|
if mi.book_producer:
|
||||||
m.filter('contributor', lambda x : x.role.lower() == 'bkp')
|
m.filter('contributor', lambda x : x.role.lower() == 'bkp')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user