Skip to content

Commit

Permalink
author names
Browse files Browse the repository at this point in the history
  • Loading branch information
bdcaf committed Sep 24, 2020
1 parent a11c423 commit 0271e3e
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions plugin/doi_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from calibre.utils.localization import canonicalize_lang
from calibre_plugins.crossref_doi_download.config import prefs

NAME_FIELDS=frozenset(['author','editor','funder'])
COMMENT_FIELDS = { 'type':None
,'title':None
,'short-title':None
Expand Down Expand Up @@ -160,18 +161,26 @@ def quick_add(key, name=None, joiner=", "):
if result.has_key(key):
v = result[key]
if isinstance(v, list):
strval = joiner.join(v)
if (key in NAME_FIELDS):
strval = joiner.join(map(_author2string, v))
else:
strval = joiner.join(v)
elif isinstance(v, dict):
if v.has_key('date-parts'):
strval = self.read_partial_date(v)
else:
strval=v
self.log.warning("Unhandled dict:","%s: %s" % (key, v) )
else:
strval = v
extra_meta.append("%s: %s" % (key,strval))

for a,targ in COMMENT_FIELDS.items():
quick_add(a,targ)
try:
quick_add(a,targ)
except Exception as e:
self.log.warning("Encountered problem:",e )
self.log.warning("Unhandled input:","%s: %s" % (a, result[a]) )


if result.has_key('link'):
links = result['link']
Expand Down

0 comments on commit 0271e3e

Please sign in to comment.