archive tag naming correction
This commit is contained in:
@@ -880,16 +880,19 @@ def extract_archive_name(filename: str) -> str:
|
|||||||
|
|
||||||
def compute_archive_tag_name(artist: str, archive_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:
|
Examples:
|
||||||
- artist="InCaseArt", filename="43387617_attachment_83109081_October 2020 Rewards.rar"
|
- 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.
|
If a tag with the same name already exists, appends a numeric suffix.
|
||||||
"""
|
"""
|
||||||
archive_name = extract_archive_name(archive_filename)
|
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
|
# Check if tag already exists
|
||||||
existing = Tag.query.filter_by(name=base_tag, kind='archive').first()
|
existing = Tag.query.filter_by(name=base_tag, kind='archive').first()
|
||||||
|
|||||||
Reference in New Issue
Block a user