diff --git a/update_db.py b/update_db.py index d48af1d..fd4bdb1 100644 --- a/update_db.py +++ b/update_db.py @@ -9,6 +9,7 @@ import os import random import string import time +import unicodedata from dataclasses import dataclass from datetime import date, datetime, timedelta from typing import Any, Type, TypedDict, cast @@ -60,7 +61,7 @@ def update_tables ( for video_tag in video_tags: tag = video_tag.tag if (tag is not None - and (tag.name.upper () not in map (str.upper, tag_names))): + and (normalise (tag.name) not in map (normalise, tag_names))): video_tag.untagged_at = now video_tag.save () for tag_name in tag_names: @@ -402,5 +403,11 @@ class VideoTagRow (TypedDict): untagged_at: date | None +def normalise ( + s: str +) -> str: + return unicodedata.normalize ('NFKC', s).lower () + + if __name__ == '__main__': main ()