From: Oleg Broytman Date: Thu, 11 Feb 2016 22:00:29 +0000 (+0300) Subject: Prevent duplicate authors X-Git-Tag: 0.0.4~52 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=cb9a07d5730a506f803526a5bb968f18268e4ccc;p=m_librarian.git Prevent duplicate authors Some INP contain duplicate author names like this: Author,Name:Author,Name --- diff --git a/m_librarian/inp.py b/m_librarian/inp.py index 56f85e4..09cd42b 100644 --- a/m_librarian/inp.py +++ b/m_librarian/inp.py @@ -45,8 +45,13 @@ def import_inp_line(archive, parts): lib_id=lib_id, deleted=deleted, extension=extension_row, date=date, language=language_row) - for author in authors.split(':'): + authors = authors.split(':') + seen_authors = set() + for author in authors: if author: + if author in seen_authors: + continue + seen_authors.add(author) alist = author.split(',', 2) surname = alist[0] if len(alist) > 1: