From ad16eabdf7ba1c0b68d6721756f4ac316f4e95ec Mon Sep 17 00:00:00 2001 From: Lars Noack Date: Wed, 16 Nov 2022 10:37:41 +0100 Subject: [PATCH] optimized imports in __init__.py for the cli --- src/music_kraken/__init__.py | 30 ++++++++++++++----- .../metadata/{fetch.py => metadata_fetch.py} | 0 .../{search.py => metadata_search.py} | 0 3 files changed, 22 insertions(+), 8 deletions(-) rename src/music_kraken/metadata/{fetch.py => metadata_fetch.py} (100%) rename src/music_kraken/metadata/{search.py => metadata_search.py} (100%) diff --git a/src/music_kraken/__init__.py b/src/music_kraken/__init__.py index 9e81ec3..3587685 100644 --- a/src/music_kraken/__init__.py +++ b/src/music_kraken/__init__.py @@ -1,13 +1,27 @@ from .utils.shared import * -from .metadata.fetch import MetadataDownloader -from .metadata import fetch -from .metadata import search as s -from .audio_source import fetch_source, fetch_audio +from .metadata import ( + metadata_search, + metadata_fetch +) + from .target import set_target +from .audio_source import ( + fetch_source, + fetch_audio +) + +from .lyrics import lyrics + +# from .metadata.fetch import MetadataDownloader +# from .metadata import fetch +# from .metadata import search as s +# from .audio_source import fetch_source, fetch_audio +# from .target import set_target + # NEEDS REFACTORING -from .lyrics.lyrics import fetch_lyrics +# from .lyrics.lyrics import fetch_lyrics import logging import os @@ -33,7 +47,7 @@ def get_existing_genre(): def search_for_metadata(): - search = s.Search() + search = metadata_search.Search() while True: input_ = input( @@ -85,7 +99,7 @@ def cli(start_at: int = 0, only_lyrics: bool = False): search = search_for_metadata() # search = metadata.search.Option("release", "f8d4b24d-2c46-4e9c-8078-0c0f337c84dd", "Beautyfall") logging.info("Starting Downloading of metadata") - metadata_downloader = MetadataDownloader() + metadata_downloader = metadata_fetch.MetadataDownloader() metadata_downloader.download({'type': search.type, 'id': search.id}) if start_at <= 1 and not only_lyrics: @@ -102,4 +116,4 @@ def cli(start_at: int = 0, only_lyrics: bool = False): if start_at <= 4: logging.info("starting to fetch the lyrics") - fetch_lyrics() + lyrics.fetch_lyrics() diff --git a/src/music_kraken/metadata/fetch.py b/src/music_kraken/metadata/metadata_fetch.py similarity index 100% rename from src/music_kraken/metadata/fetch.py rename to src/music_kraken/metadata/metadata_fetch.py diff --git a/src/music_kraken/metadata/search.py b/src/music_kraken/metadata/metadata_search.py similarity index 100% rename from src/music_kraken/metadata/search.py rename to src/music_kraken/metadata/metadata_search.py