diff --git a/kontor-scripts/find_links.py b/kontor-scripts/find_links.py index 64919d1..eb52b1d 100644 --- a/kontor-scripts/find_links.py +++ b/kontor-scripts/find_links.py @@ -77,6 +77,8 @@ def get_actor_links(log: logging.Logger, media_file_url: str) -> list: link_url = anchor.get('href') if link_url.endswith('all/countries'): continue + if link_url in actor_links: + continue actor_links.append(link_url) log.debug(f"links({len(actor_links)}): {actor_links}") return actor_links @@ -123,8 +125,12 @@ if __name__ == '__main__': actor_list.append(actors[actor_link]) actor_response = requests.put(f"http://127.0.0.1:8800/api/media/files/{item['id']}/actors", json=actor_list) actor_data = actor_response.json() - log.warning(f"{len(actor_data)} links persisted, but {len(actor_list)} links are available") - log.debug(f"found {len(actor_data)} actors") + persisted_actor_links: int = len(actor_data) + found_actor_links: int = len(actor_links) + if persisted_actor_links != found_actor_links: + log.warning(f"{persisted_actor_links} links persisted, but {found_actor_links} links are available") + log.info(f"found actors: {actor_links}") + log.debug(f"found {persisted_actor_links} actors") log.debug(f"found actors: {actor_data}") item['review'] = False update = requests.put(f"http://127.0.0.1:8800/api/media/files/{item['id']}", json=item)