changed default instalation path

This commit is contained in:
Hellow2 2023-04-04 10:43:52 +02:00
parent a48ee21a9c
commit f6803e4c73
2 changed files with 10 additions and 3 deletions

View File

@ -34,6 +34,7 @@ class DefaultTarget:
label: str = DEFAULT_VALUES["label"] label: str = DEFAULT_VALUES["label"]
artist: str = DEFAULT_VALUES["artist"] artist: str = DEFAULT_VALUES["artist"]
album: str = DEFAULT_VALUES["album"] album: str = DEFAULT_VALUES["album"]
album_type: str = DEFAULT_VALUES["album_type"]
song: str = DEFAULT_VALUES["song"] song: str = DEFAULT_VALUES["song"]
def __setattr__(self, __name: str, __value: str) -> None: def __setattr__(self, __name: str, __value: str) -> None:
@ -49,9 +50,9 @@ class DefaultTarget:
return Target( return Target(
relative_to_music_dir=True, relative_to_music_dir=True,
path=DOWNLOAD_PATH.format(genre=self.genre, label=self.label, artist=self.artist, album=self.album, path=DOWNLOAD_PATH.format(genre=self.genre, label=self.label, artist=self.artist, album=self.album,
song=self.song), song=self.song, album_type=self.album_type),
file=DOWNLOAD_FILE.format(genre=self.genre, label=self.label, artist=self.artist, album=self.album, file=DOWNLOAD_FILE.format(genre=self.genre, label=self.label, artist=self.artist, album=self.album,
song=self.song) song=self.song, album_type=self.album_type)
) )
@ -376,6 +377,7 @@ class Page:
album: Album album: Album
for album in label.album_collection: for album in label.album_collection:
if album.album_type in exclude_album_type: if album.album_type in exclude_album_type:
cls.LOGGER.info(f"skipping {album.option_string} die to the filter")
continue continue
cls.download_album(album, override_existing=override_existing, default_target=default_target) cls.download_album(album, override_existing=override_existing, default_target=default_target)
@ -395,6 +397,7 @@ class Page:
album: Album album: Album
for album in artist.main_album_collection: for album in artist.main_album_collection:
if album.album_type in exclude_album_type: if album.album_type in exclude_album_type:
cls.LOGGER.info(f"skipping {album.option_string} die to the filter")
continue continue
cls.download_album(album, override_existing=override_existing, default_target=default_target) cls.download_album(album, override_existing=override_existing, default_target=default_target)
@ -410,6 +413,7 @@ class Page:
else: else:
default_target = copy(default_target) default_target = copy(default_target)
default_target.album = album.title default_target.album = album.title
default_target.album_type = album.album_type.value
if not album.artist_collection.empty: if not album.artist_collection.empty:
default_target.artist = album.artist_collection[0].name default_target.artist = album.artist_collection[0].name
if not album.label_collection.empty: if not album.label_collection.empty:
@ -431,6 +435,7 @@ class Page:
default_target.song = song.title default_target.song = song.title
if not song.album_collection.empty: if not song.album_collection.empty:
default_target.album = song.album_collection[0].title default_target.album = song.album_collection[0].title
default_target.album_type = song.album.album_type.value
if not song.main_artist_collection.empty: if not song.main_artist_collection.empty:
artist: Artist = song.main_artist_collection[0] artist: Artist = song.main_artist_collection[0]
default_target.artist = artist.name default_target.artist = artist.name

View File

@ -73,8 +73,9 @@ available variables:
- artist - artist
- album - album
- song - song
- album_type
""" """
DOWNLOAD_PATH = "{genre}/{artist}/{album}" DOWNLOAD_PATH = "{genre}/{artist}/{album_type}/{album}"
DOWNLOAD_FILE = "{song}.mp3" DOWNLOAD_FILE = "{song}.mp3"
DEFAULT_VALUES = { DEFAULT_VALUES = {
"genre": "Various Genre", "genre": "Various Genre",
@ -82,4 +83,5 @@ DEFAULT_VALUES = {
"artist": "Various Artists", "artist": "Various Artists",
"album": "Various Album", "album": "Various Album",
"song": "Various Song", "song": "Various Song",
"album_type": "Other"
} }