From 5f433ae3e17810939d8e27fba786931a8b9457af Mon Sep 17 00:00:00 2001 From: Hellow Date: Thu, 24 Nov 2022 18:25:49 +0100 Subject: [PATCH] ready for test build --- pyproject.toml | 2 +- src/music_kraken/__init__.py | 25 ++++++++++++++----------- src/music_kraken/database/__init__.py | 11 ++++++++++- src/music_kraken/metadata/__init__.py | 7 +++++++ src/music_kraken/target/__init__.py | 5 +++++ 5 files changed, 37 insertions(+), 13 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4073734..e4ee60b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "music_kraken" -version = "1.2.1" +version = "1.2.2" authors = [ { name="Hellow2", email="Hellow2@outlook.de" }, ] diff --git a/src/music_kraken/__init__.py b/src/music_kraken/__init__.py index eaa1824..acd624d 100644 --- a/src/music_kraken/__init__.py +++ b/src/music_kraken/__init__.py @@ -21,31 +21,35 @@ logging.getLogger("musicbrainzngs").setLevel(logging.WARNING) musicbrainzngs.set_useragent("metadata receiver", "0.1", "https://github.com/HeIIow2/music-downloader") # define the most important values and function for import in the __init__ file -Song = database.song.Song -MetadataSearch = metadata.metadata_search.Search -MetadataDownload = metadata.metadata_fetch.MetadataDownloader() +Song = database.Song +MetadataSearch = metadata.MetadataSearch +MetadataDownload = metadata.MetadataDownload cache = database.cache -def fetch_metadata(type: str, id_: str): - metadata_downloader = MetadataDownload() - metadata_downloader.download({'type': type, 'id': id_}) -def fetch_metadata_from_search(search_instace: MetadataSearch): - current_option = search_instace.current_option - fetch_metadata(type=current_option.type, id_= current_option.id) +def fetch_metadata(type_: str, id_: str): + metadata_downloader = MetadataDownload() + metadata_downloader.download({'type': type_, 'id': id_}) + + +def fetch_metadata_from_search(search_instance: MetadataSearch): + current_option = search_instance.current_option + fetch_metadata(type_=current_option.type, id_=current_option.id) + def set_targets(genre: str): target.set_target.UrlPath(genre=genre) + def fetch_sources(songs: List[Song], skip_existing_files: bool = True): audio_source.fetch_sources(songs=songs, skip_existing_files=skip_existing_files) + def fetch_audios(songs: List[Song], override_existing: bool = False): audio_source.fetch_audios(songs=songs, override_existing=override_existing) - def get_existing_genre(): valid_directories = [] for elem in os.listdir(MUSIC_DIR): @@ -144,7 +148,6 @@ def cli(start_at: int = 0, only_lyrics: bool = False): logging.info("Starting Downloading of metadata") fetch_metadata_from_search(search) - if start_at <= 1 and not only_lyrics: logging.info("creating Paths") set_targets(genre=genre) diff --git a/src/music_kraken/database/__init__.py b/src/music_kraken/database/__init__.py index 6c57ede..6c77dea 100644 --- a/src/music_kraken/database/__init__.py +++ b/src/music_kraken/database/__init__.py @@ -1,3 +1,12 @@ -from . import temp_database +from . import ( + temp_database, + song +) + +Song = song.Song +Artist = song.Artist +Source = song.Source +Target = song.Target +Metadata = song.Metadata cache = temp_database.TempDatabase() diff --git a/src/music_kraken/metadata/__init__.py b/src/music_kraken/metadata/__init__.py index e69de29..ec153f9 100644 --- a/src/music_kraken/metadata/__init__.py +++ b/src/music_kraken/metadata/__init__.py @@ -0,0 +1,7 @@ +from . import ( + metadata_search, + metadata_fetch +) + +MetadataSearch = metadata_search.Search +MetadataDownload = metadata_fetch.MetadataDownloader diff --git a/src/music_kraken/target/__init__.py b/src/music_kraken/target/__init__.py index e69de29..dd69eda 100644 --- a/src/music_kraken/target/__init__.py +++ b/src/music_kraken/target/__init__.py @@ -0,0 +1,5 @@ +from . import ( + set_target +) + +set_target = set_target