diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-23 21:08:36 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-23 21:08:36 -0800 |
commit | ad9cd8a98aa5dce24d49b5a9c460a653f5e840a3 (patch) | |
tree | 54ea1dde0f831265550dbe66a7ccc867a83b80ce /python/fatcat_tools/importers/matched.py | |
parent | 4fd244c2b1dd393d5b26607f99777a678a78c781 (diff) | |
download | fatcat-ad9cd8a98aa5dce24d49b5a9c460a653f5e840a3.tar.gz fatcat-ad9cd8a98aa5dce24d49b5a9c460a653f5e840a3.zip |
importer bugfixes
Diffstat (limited to 'python/fatcat_tools/importers/matched.py')
-rw-r--r-- | python/fatcat_tools/importers/matched.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/python/fatcat_tools/importers/matched.py b/python/fatcat_tools/importers/matched.py index 123e3530..2ec6c95d 100644 --- a/python/fatcat_tools/importers/matched.py +++ b/python/fatcat_tools/importers/matched.py @@ -120,6 +120,9 @@ class MatchedImporter(EntityImporter): if err.status != 404: raise err + if not existing: + return True + fe.release_ids = list(set(fe.release_ids + existing.release_ids)) if set(fe.release_ids) == set(existing.release_ids) and len(existing.urls) > 0: # no new release matches *and* there are already existing URLs @@ -127,13 +130,14 @@ class MatchedImporter(EntityImporter): return False # merge the existing into this one and update - existing.urls = list(set(fe.urls + existing.urls)) + existing.urls = list(set([(u.rel, u.url) for u in fe.urls + existing.urls])) + existing.urls = [fatcat_client.FileEntityUrls(rel=rel, url=url) for (rel, url) in existing.urls] existing.release_ids = list(set(fe.release_ids + existing.release_ids)) existing.mimetype = existing.mimetype or fe.mimetype existing.size = existing.size or fe.size existing.md5 = existing.md5 or fe.md5 existing.sha256 = existing.sha256 or fe.sha256 - self.api.update_file(existing.ident, existing) + self.api.update_file(existing.ident, existing, editgroup_id=self._get_editgroup()) self.counts['update'] += 1 return False |