diff --git a/update_db.py b/update_db.py index 3d551a0..439d3f3 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 @@ -158,7 +159,7 @@ def update_tables ( for vt in video_tags: tag = tag_dao.find (vt.tag_id) 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)) and (tag.id_ is not None)): tag_ids.append (tag.id_) video_tag_dao.untag_all (video.id_, tag_ids, now) @@ -1067,5 +1068,11 @@ class UserDto: id_: int | None = None +def normalise ( + s: str +) -> str: + return unicodedata.normalize ('NFKC', s).lower () + + if __name__ == '__main__': main ()