Support album art files
This commit is contained in:
parent
47e8b0d11a
commit
78bd62b009
|
@ -1,6 +1,9 @@
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
|
||||||
|
audio_extensions = ['flac']
|
||||||
|
art_extensions = ['.jpg', '.jpeg', '.png']
|
||||||
|
|
||||||
class Track:
|
class Track:
|
||||||
def __init__(self, location: Path):
|
def __init__(self, location: Path):
|
||||||
self.path = location
|
self.path = location
|
||||||
|
@ -8,6 +11,14 @@ class Track:
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.path)
|
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
|
@property
|
||||||
def filename(self) -> str:
|
def filename(self) -> str:
|
||||||
return self.path.name
|
return self.path.name
|
||||||
|
@ -24,10 +35,16 @@ class Track:
|
||||||
def artist(self) -> Path:
|
def artist(self) -> Path:
|
||||||
return self.path.parent.parent
|
return self.path.parent.parent
|
||||||
|
|
||||||
|
def artist_out(self, root: Path) -> Path:
|
||||||
|
return root / self.artist.parts[-1]
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def album(self) -> Path:
|
def album(self) -> Path:
|
||||||
return self.path.parent
|
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:
|
def artist_output(self, root: Path) -> Path:
|
||||||
return root / self.artist.parts[-1]
|
return root / self.artist.parts[-1]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user