refactored imports, so every important function can be imported directly from the 'root module' music_kraken
This commit is contained in:
parent
cd9d67102b
commit
5d61721b60
13
src/goof.py
13
src/goof.py
@ -1,14 +1,19 @@
|
|||||||
import music_kraken as mk
|
import music_kraken as mk
|
||||||
print(mk.__file__)
|
print(mk.__file__)
|
||||||
|
|
||||||
|
"""
|
||||||
from music_kraken.audio_source import (
|
from music_kraken.audio_source import (
|
||||||
fetch_sources,
|
fetch_sources,
|
||||||
fetch_audios
|
fetch_audios
|
||||||
)
|
)
|
||||||
print(fetch_sources)
|
print(fetch_sources)
|
||||||
|
|
||||||
cache = mk.database.temp_database.temp_database
|
from music_kraken.database import (
|
||||||
print(cache, len(cache.get_tracks_without_src()))
|
cache
|
||||||
|
)
|
||||||
|
"""
|
||||||
|
|
||||||
fetch_sources(cache.get_tracks_without_src(), skip_existing_files=False)
|
print(mk.cache, len(mk.cache.get_tracks_without_src()))
|
||||||
fetch_audios(cache.get_tracks_to_download(), override_existing=True)
|
|
||||||
|
mk.fetch_sources(mk.cache.get_tracks_without_src(), skip_existing_files=False)
|
||||||
|
mk.fetch_audios(mk.cache.get_tracks_to_download(), override_existing=True)
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
|
from typing import List
|
||||||
import musicbrainzngs
|
import musicbrainzngs
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
from . import (
|
||||||
|
database,
|
||||||
|
audio_source
|
||||||
|
)
|
||||||
|
|
||||||
from .utils.shared import (
|
from .utils.shared import (
|
||||||
MUSIC_DIR,
|
MUSIC_DIR,
|
||||||
NOT_A_GENRE
|
NOT_A_GENRE
|
||||||
@ -20,6 +26,17 @@ from .lyrics import lyrics
|
|||||||
logging.getLogger("musicbrainzngs").setLevel(logging.WARNING)
|
logging.getLogger("musicbrainzngs").setLevel(logging.WARNING)
|
||||||
musicbrainzngs.set_useragent("metadata receiver", "0.1", "https://github.com/HeIIow2/music-downloader")
|
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
|
||||||
|
|
||||||
|
cache = database.cache
|
||||||
|
|
||||||
|
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():
|
def get_existing_genre():
|
||||||
valid_directories = []
|
valid_directories = []
|
||||||
@ -125,11 +142,11 @@ def cli(start_at: int = 0, only_lyrics: bool = False):
|
|||||||
|
|
||||||
if start_at <= 2 and not only_lyrics:
|
if start_at <= 2 and not only_lyrics:
|
||||||
logging.info("Fetching Download Links")
|
logging.info("Fetching Download Links")
|
||||||
fetch_source.Download()
|
fetch_sources(cache.get_tracks_without_src())
|
||||||
|
|
||||||
if start_at <= 3 and not only_lyrics:
|
if start_at <= 3 and not only_lyrics:
|
||||||
logging.info("starting to download the mp3's")
|
logging.info("starting to download the mp3's")
|
||||||
fetch_audio.Download()
|
fetch_audios(cache.get_tracks_to_download())
|
||||||
|
|
||||||
if start_at <= 4:
|
if start_at <= 4:
|
||||||
logging.info("starting to fetch the lyrics")
|
logging.info("starting to fetch the lyrics")
|
||||||
|
Loading…
Reference in New Issue
Block a user