mirror of
https://zotify.xyz/zotify/zotify.git
synced 2024-11-10 01:02:06 +01:00
platform agnostic special char stripping
This commit is contained in:
parent
21ef30844b
commit
08d844fe3e
1 changed files with 2 additions and 7 deletions
|
@ -12,7 +12,7 @@ import music_tag
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from zotify.const import ARTIST, GENRE, TRACKTITLE, ALBUM, YEAR, DISCNUMBER, TRACKNUMBER, ARTWORK, \
|
from zotify.const import ARTIST, GENRE, TRACKTITLE, ALBUM, YEAR, DISCNUMBER, TRACKNUMBER, ARTWORK, \
|
||||||
WINDOWS_SYSTEM, LINUX_SYSTEM, ALBUMARTIST
|
WINDOWS_SYSTEM, ALBUMARTIST
|
||||||
from zotify.zotify import Zotify
|
from zotify.zotify import Zotify
|
||||||
|
|
||||||
|
|
||||||
|
@ -258,12 +258,7 @@ def fix_filename(name):
|
||||||
>>> all('_' == fix_filename(chr(i)) for i in list(range(32)))
|
>>> all('_' == fix_filename(chr(i)) for i in list(range(32)))
|
||||||
True
|
True
|
||||||
"""
|
"""
|
||||||
if platform.system() == WINDOWS_SYSTEM:
|
|
||||||
return re.sub(r'[/\\:|<>"?*\0-\x1f]|^(AUX|COM[1-9]|CON|LPT[1-9]|NUL|PRN)(?![^.])|^\s|[\s.]$', "_", str(name), flags=re.IGNORECASE)
|
return re.sub(r'[/\\:|<>"?*\0-\x1f]|^(AUX|COM[1-9]|CON|LPT[1-9]|NUL|PRN)(?![^.])|^\s|[\s.]$', "_", str(name), flags=re.IGNORECASE)
|
||||||
elif platform.system() == LINUX_SYSTEM:
|
|
||||||
return re.sub(r'[/\0]', "_", str(name))
|
|
||||||
else: # MacOS
|
|
||||||
return re.sub(r'[/:\0]', "_", str(name))
|
|
||||||
|
|
||||||
|
|
||||||
def fmt_seconds(secs: float) -> str:
|
def fmt_seconds(secs: float) -> str:
|
||||||
|
|
Loading…
Reference in a new issue