sane-tag-music: special-case some romanizations
This commit is contained in:
@@ -82,8 +82,13 @@ def clean_for_fs(a: str, single_field: bool=False) -> str:
|
|||||||
preserve = 'abcdefghijklmnopqrstuvwxyz0123456789._-'
|
preserve = 'abcdefghijklmnopqrstuvwxyz0123456789._-'
|
||||||
# ampersand, like: PLS&TY; &I
|
# ampersand, like: PLS&TY; &I
|
||||||
a = a.replace("&", "And")
|
a = a.replace("&", "And")
|
||||||
a = a.replace("é", "e")
|
a = a.replace("かめりあ", "Camellia") # else `unidecode` sets it to kameria
|
||||||
a = unidecode(a)
|
a = unidecode(a)
|
||||||
|
# these diacritic replacements might be unnecessary now that i'm using unidecode?
|
||||||
|
a = a.replace("é", "e")
|
||||||
|
a = a.replace("ä", "a")
|
||||||
|
a = a.replace("ö", "o")
|
||||||
|
a = a.replace("ü", "u")
|
||||||
a = a.strip()
|
a = a.strip()
|
||||||
a = a.replace(" ", ".")
|
a = a.replace(" ", ".")
|
||||||
if single_field:
|
if single_field:
|
||||||
@@ -425,16 +430,13 @@ class ImageFile(MediaFile):
|
|||||||
return ImageFile._exiftool
|
return ImageFile._exiftool
|
||||||
|
|
||||||
def tags_on_disk(self) -> Tags:
|
def tags_on_disk(self) -> Tags:
|
||||||
# print(self.exif)
|
def get_tag_(name: str) -> list:
|
||||||
def get_tag(name: str) -> list:
|
if self.exif.get(name) is not None:
|
||||||
if name in self.exif:
|
return [ str(self.exif[name]) ]
|
||||||
return [ self.exif[name] ]
|
|
||||||
elif f"EXIF:{name}" in self.exif:
|
|
||||||
return [ self.exif[f"EXIF:{name}"] ]
|
|
||||||
elif f"XMP:{name}" in self.exif:
|
|
||||||
return [ self.exif[f"XMP:{name}"] ]
|
|
||||||
else:
|
else:
|
||||||
return []
|
return []
|
||||||
|
def get_tag(name: str) -> list:
|
||||||
|
return get_tag_(name) + get_tag_(f"EXIF:{name}") + get_tag_(f"XMP:{name}")
|
||||||
|
|
||||||
return Tags(
|
return Tags(
|
||||||
artist=get_tag("Photographer"),
|
artist=get_tag("Photographer"),
|
||||||
|
Reference in New Issue
Block a user