sane-tag-music: handle titles with "/"

This commit is contained in:
2024-07-09 21:34:49 +00:00
parent 96bf9d594f
commit ddce650bc5

View File

@@ -108,7 +108,7 @@ def clean_for_loose_compare(a: str) -> str:
# goal is to help merge path-extracted tags with embedded tags.
# it's common for a tag to have some rich characters which can't be represented in a file.
# so just remove rich characters, but in a way which doesn't become useless when faced with primarily non-latin names
omitable = '.- &()[];:'
omitable = '.- &()[];:/'
unomitable = 'abcdefghijklmnopqrstuvwxyz0123456789'
a = "".join(c for c in a if c not in omitable)
@@ -133,6 +133,7 @@ def clean_for_fs(a: str, single_field: bool=False) -> str:
a = romanize(a)
a = a.strip()
a = a.replace(" ", ".")
a = a.replace("/", ".")
if single_field:
a = a.replace("-", ".")
@@ -140,6 +141,9 @@ def clean_for_fs(a: str, single_field: bool=False) -> str:
while ".." in a:
a = a.replace("..", ".")
while a.startswith("."):
# files which start with `.` are hidden on the fs, so don't do that
a = a[1:]
return a
def clean_fields_for_fs(a: list[str], single_fields: bool=True) -> str: