28 lines
705 B
Python
28 lines
705 B
Python
#!/usr/bin/env python3
|
|
import re
|
|
|
|
import mutagen
|
|
from mutagen.flac import FLAC
|
|
from mutagen.mp3 import MP3
|
|
# noinspection PyProtectedMember
|
|
from mutagen.id3 import ID3Tags
|
|
# noinspection PyProtectedMember
|
|
from mutagen.mp4 import Tags
|
|
from mutagen.oggvorbis import OggVorbis
|
|
|
|
from typing import Dict, List, Union
|
|
|
|
format_lookup: Dict[str, str] = {
|
|
"mp3": "id3",
|
|
"m4a": "m4a",
|
|
"ogg": "vorbis",
|
|
"flac": "vorbis",
|
|
"wav": "id3",
|
|
"aiff": "id3"
|
|
}
|
|
fully_supported: List[str] = ["ogg", "flac", "mp3", "m4a", "wav", "aiff"]
|
|
MutagenFile = Union[MP3, FLAC, OggVorbis, mutagen.FileType]
|
|
MutagenTags = Union[ID3Tags, Tags, mutagen.oggvorbis.OggVCommentDict]
|
|
sanitisation_regex = re.compile(r"[?\\/:|*\"<>]")
|
|
|