From 78bd62b0090ff01a0302f1665ee61d15b463c076 Mon Sep 17 00:00:00 2001 From: grglcy Date: Sat, 18 Jan 2025 14:16:28 +0000 Subject: [PATCH] Support album art files --- src/transcode/track.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/transcode/track.py b/src/transcode/track.py index 42316cc..757f8dc 100644 --- a/src/transcode/track.py +++ b/src/transcode/track.py @@ -1,6 +1,9 @@ from pathlib import Path +audio_extensions = ['flac'] +art_extensions = ['.jpg', '.jpeg', '.png'] + class Track: def __init__(self, location: Path): self.path = location @@ -8,6 +11,14 @@ class Track: def __str__(self): return str(self.path) + @property + def is_audio(self): + return self.extension in audio_extensions + + @property + def is_art(self): + return self.extension in art_extensions + @property def filename(self) -> str: return self.path.name @@ -24,10 +35,16 @@ class Track: def artist(self) -> Path: return self.path.parent.parent + def artist_out(self, root: Path) -> Path: + return root / self.artist.parts[-1] + @property def album(self) -> Path: return self.path.parent + def album_out(self, root: Path) -> Path: + return root /self.artist_out(root) / self.album.parts[-1] + def artist_output(self, root: Path) -> Path: return root / self.artist.parts[-1]