Support album art files

This commit is contained in:
George Lacey 2025-01-18 14:16:28 +00:00
parent 47e8b0d11a
commit 78bd62b009

View File

@ -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]