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