archive tag naming correction

This commit is contained in:
Bryan Van Deusen
2026-02-02 19:24:44 -05:00
parent 09883960d4
commit 3b5cd83b01
+6 -3
View File
@@ -880,16 +880,19 @@ def extract_archive_name(filename: str) -> str:
def compute_archive_tag_name(artist: str, archive_filename: str) -> str:
"""
Generate an archive tag name in the format: '{artist}:{archive_name}'
Generate an archive tag name in the format: 'archive:{artist}:{archive_name}'
Similar to post tags (post:{platform}:{artist}:{id}), archive tags use
a consistent prefix and colon-separated components.
Examples:
- artist="InCaseArt", filename="43387617_attachment_83109081_October 2020 Rewards.rar"
-> "InCaseArt:October 2020 Rewards"
-> "archive:InCaseArt:October 2020 Rewards"
If a tag with the same name already exists, appends a numeric suffix.
"""
archive_name = extract_archive_name(archive_filename)
base_tag = f"{artist}:{archive_name}"
base_tag = f"archive:{artist}:{archive_name}"
# Check if tag already exists
existing = Tag.query.filter_by(name=base_tag, kind='archive').first()