Skip to content

Commit

Permalink
Fix: Remove tag name from items if all items tagged
Browse files Browse the repository at this point in the history
  • Loading branch information
Drazzilb08 committed Feb 24, 2024
1 parent 8fa31eb commit 4eaca85
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions modules/renameinatorr.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,19 @@ def process_instance(app, rename_folders, server_name, instance_type, count, tag
if count and tag_name:
tag_id = app.get_tag_id_from_name(tag_name)
if tag_id:
media_tmp = [item for item in media_dict if tag_id not in item['tags']][:count]

# If all media is tagged, remove tags and fetch new data
if not media_tmp:
media_ids = [item['media_id'] for item in media_dict]
logger.info("All media is tagged. Removing tags...")
app.remove_tags(media_ids, tag_id)
media_dict = handle_starr_data(app, server_name, instance_type)
media_dict = [item for item in media_dict if tag_id not in item['tags']][:count]
else:
media_dict = media_tmp

logger.debug(f"media dict:\n{json.dumps(media_dict, indent=4)}")

# Process each item in the fetched data
rename_response = []
Expand Down

0 comments on commit 4eaca85

Please sign in to comment.