Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7501f6a

Browse files
committed
Improve handing of empty author fields
1 parent a3cf799 commit 7501f6a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

‎pdf-title-rename.py‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,16 @@ def _get_xmp_metadata(self):
101101
except KeyError:
102102
pass
103103
else:
104-
if type(a) is list and len(a) == 1:
105-
a = a[0]
106-
if type(a) is list:
104+
if type(a) is str:
105+
a = [a]
106+
a = filter(bool, a) # remove None, empty strings, ...
107+
if len(a) > 1:
107108
a = '%s %s' % (self._au_last_name(a[0]),
108109
self._au_last_name(a[-1]))
109-
elif type(a) is str:
110-
a = self._au_last_name(a)
110+
elif len(a) == 1:
111+
a = self._au_last_name(a[0])
112+
else:
113+
a = None
111114
return t, a
112115

113116
def _au_last_name(self, name):

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /