refactored some more

This commit is contained in:
Lars Noack
2022-11-24 14:56:51 +01:00
parent 0d7fd4496c
commit 068918feda
2 changed files with 11 additions and 10 deletions

View File

@@ -5,7 +5,8 @@ import os
from . import (
database,
audio_source
audio_source,
target
)
from .utils.shared import (
@@ -16,11 +17,7 @@ from .metadata import (
metadata_search,
metadata_fetch
)
from .target import set_target
from .audio_source import (
fetch_source,
fetch_audio
)
from .lyrics import lyrics
logging.getLogger("musicbrainzngs").setLevel(logging.WARNING)
@@ -31,6 +28,9 @@ Song = database.song.Song
cache = database.cache
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)
@@ -38,6 +38,7 @@ 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):
@@ -138,7 +139,7 @@ def cli(start_at: int = 0, only_lyrics: bool = False):
if start_at <= 1 and not only_lyrics:
logging.info("creating Paths")
set_target.UrlPath(genre=genre)
set_targets(genre=genre)
if start_at <= 2 and not only_lyrics:
logging.info("Fetching Download Links")