From cb9a07d5730a506f803526a5bb968f18268e4ccc Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Fri, 12 Feb 2016 01:00:29 +0300 Subject: [PATCH] Prevent duplicate authors Some INP contain duplicate author names like this: Author,Name:Author,Name --- m_librarian/inp.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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: -- 2.39.2