fixed issue with reading the config file at the wrong point
This commit is contained in:
parent
f95083050e
commit
dc540e4829
@ -15,6 +15,10 @@ if __name__ == "__main__":
|
||||
fetch_musify_song = [
|
||||
"s: https://musify.club/track/blokkmonsta-schwartz-crystal-f-purer-hass-8369115"
|
||||
]
|
||||
|
||||
fetch_youtube_playlist = [
|
||||
"s: https://yt.artemislena.eu/playlist?list=OLAK5uy_kcUBiDv5ATbl-R20OjNaZ5G28XFanQOmM"
|
||||
]
|
||||
|
||||
youtube_search = [
|
||||
"s: #a Zombiez",
|
||||
@ -22,4 +26,4 @@ if __name__ == "__main__":
|
||||
"d: 5"
|
||||
]
|
||||
|
||||
music_kraken.cli(genre="test", command_list=fetch_musify_song)
|
||||
music_kraken.cli.download(genre="test", command_list=fetch_youtube_playlist)
|
||||
|
@ -1,13 +1,11 @@
|
||||
import logging
|
||||
import re
|
||||
from pathlib import Path
|
||||
from typing import List
|
||||
|
||||
import gc
|
||||
import musicbrainzngs
|
||||
|
||||
from .utils.config import read_config
|
||||
from .utils.shared import MODIFY_GC
|
||||
|
||||
from . import cli
|
||||
|
||||
if MODIFY_GC:
|
||||
"""
|
||||
|
@ -8,7 +8,8 @@ from ..utils.shared import MUSIC_DIR, NOT_A_GENRE_REGEX, ENABLE_RESULT_HISTORY,
|
||||
from ..utils.regex import URL_PATTERN
|
||||
from ..utils.string_processing import fit_to_file_system
|
||||
from ..utils.support_classes import Query, DownloadResult
|
||||
from ..download.results import Results, SearchResults, Option, PageResults
|
||||
from ..utils.exception.download import UrlNotFoundException
|
||||
from ..download.results import Results, Option, PageResults
|
||||
from ..download.page_attributes import Pages
|
||||
from ..pages import Page
|
||||
from ..objects import Song, Album, Artist, DatabaseObject
|
||||
@ -224,7 +225,14 @@ class Downloader:
|
||||
|
||||
def search(self, query: str):
|
||||
if re.match(URL_PATTERN, query) is not None:
|
||||
page, data_object = self.pages.fetch_url(query)
|
||||
try:
|
||||
page, data_object = self.pages.fetch_url(query)
|
||||
except UrlNotFoundException as e:
|
||||
print(f"{e.url} could not be attributed/parsed to any yet implemented site.\n"
|
||||
f"PR appreciated if the site isn't implemented.\n"
|
||||
f"Recommendations and suggestions on sites to implement appreciated.\n"
|
||||
f"But don't be a bitch if I don't end up implementing it.")
|
||||
return
|
||||
self.set_current_options(PageResults(page, data_object.options))
|
||||
self.print_current_options()
|
||||
return
|
||||
|
@ -54,7 +54,7 @@ class Source(DatabaseObject):
|
||||
if "musify" in parsed.netloc:
|
||||
return cls(SourcePages.MUSIFY, url, referer_page=referer_page)
|
||||
|
||||
if parsed.netloc in [url.netloc for url in ALL_YOUTUBE_URLS]:
|
||||
if parsed.netloc in [_url.netloc for _url in ALL_YOUTUBE_URLS]:
|
||||
return cls(SourcePages.YOUTUBE, url, referer_page=referer_page)
|
||||
|
||||
if url.startswith("https://www.deezer"):
|
||||
|
@ -21,3 +21,5 @@ def write_config():
|
||||
config.write_to_config_file(LOCATIONS.CONFIG_FILE)
|
||||
|
||||
set_name_to_value = config.set_name_to_value
|
||||
|
||||
read_config()
|
||||
|
Loading…
Reference in New Issue
Block a user