diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index a927dcb..e04aa25 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -104,7 +104,7 @@
-
+
1602927759343
@@ -176,7 +176,14 @@
1603723480563
-
+
+ 1603814270091
+
+
+
+ 1603814270092
+
+
@@ -205,7 +212,8 @@
-
+
+
diff --git a/bcao.py b/bcao.py
index cb9e471..e93c725 100755
--- a/bcao.py
+++ b/bcao.py
@@ -39,6 +39,15 @@ MutagenTags = Union[mutagen.id3.ID3Tags, mutagen.mp4.Tags, mutagen.oggvorbis.Ogg
args: argparse.Namespace
tmp_dir: tempfile.TemporaryDirectory # type: ignore
+format_lookup: Dict[str, str] = {
+ "mp3": "id3",
+ "m4a": "m4a",
+ "ogg": "vorbis",
+ "flac": "vorbis",
+ "wav": "id3",
+ "aiff": "id3"
+}
+
class SongInfo:
tag_lookup: Dict[str, Dict[str, str]] = {
"track": {"id3": "TRCK", "m4a": "trkn", "vorbis": "tracknumber"},
@@ -48,15 +57,6 @@ class SongInfo:
"album_artist": {"id3": "TPE2", "m4a": "aART", "vorbis": "albumartist"}
}
- format_lookup: Dict[str, str] = {
- "mp3": "id3",
- "m4a": "m4a",
- "ogg": "vorbis",
- "flac": "vorbis",
- "wav": "id3",
- "aiff": "id3"
- }
-
def __init__(self, file_name: Path):
self.m_file: MutagenFile = mutagen.File(file_name)
self.m_tags: MutagenTags = self.m_file.tags
@@ -65,6 +65,9 @@ class SongInfo:
self.format = path.splitext(file_name)[1][1:]
self.fallback = False
+ if self.format not in format_lookup:
+ raise ValueError(f"Unsupported file type: {self.format}")
+
fallbacks = re.match(
r"^(?P.+) - (?P.+) - (?P