diff --git a/src/music_kraken/download/page_attributes.py b/src/music_kraken/download/page_attributes.py index 861e7e6..cec3b5e 100644 --- a/src/music_kraken/download/page_attributes.py +++ b/src/music_kraken/download/page_attributes.py @@ -10,7 +10,7 @@ SOURCE_PAGE_MAP: Dict[SourcePages, Page] = dict() ALL_PAGES: Tuple[Page, ...] = ( EncyclopaediaMetallum(), - Musify() + Musify()) ) AUDIO_PAGES: Tuple[Page, ...] = ( @@ -27,7 +27,7 @@ for i, page in enumerate(ALL_PAGES): NAME_PAGE_MAP[type(page).__name__.lower()] = page NAME_PAGE_MAP[SHORTHANDS[i].lower()] = page - PAGE_NAME_MAP[page] = SHORTHANDS[i] + PAGE_NAME_MAP[type(page)] = SHORTHANDS[i] SOURCE_PAGE_MAP[page.SOURCE_TYPE] = page \ No newline at end of file diff --git a/src/music_kraken/download/search.py b/src/music_kraken/download/search.py index ba053c5..91e556c 100644 --- a/src/music_kraken/download/search.py +++ b/src/music_kraken/download/search.py @@ -203,7 +203,7 @@ class Search(Download): page = self._get_page_from_source(source=source) if page in self.audio_pages: - return page.download(music_object=self._current_option._derive_from, genre=genre, download_all=download_all, **kwargs) + return page.download(music_object=self._current_option._derive_from, genre=genre, download_all=download_all) return DownloadResult(error_message=f"Didn't find a source for {self._current_option._derive_from.option_string}.") diff --git a/src/music_kraken/pages/abstract.py b/src/music_kraken/pages/abstract.py index 31b7dd2..65df60f 100644 --- a/src/music_kraken/pages/abstract.py +++ b/src/music_kraken/pages/abstract.py @@ -3,6 +3,7 @@ import random from copy import copy from typing import Optional, Union, Type, Dict, Set, List import threading +from queue import Queue import requests from bs4 import BeautifulSoup @@ -108,11 +109,14 @@ class Page(threading.Thread): This is an abstract class, laying out the functionality for every other class fetching something """ - + SOURCE_TYPE: SourcePages LOGGER = logging.getLogger("this shouldn't be used") - def __init__(self): + def __init__(self, search_queue: Queue, search_result_queue: Queue): + self.search_queue = search_queue + self.search_result_queue = search_result_queue + threading.Thread.__init__(self) def run(self) -> None: diff --git a/src/music_kraken/pages/encyclopaedia_metallum.py b/src/music_kraken/pages/encyclopaedia_metallum.py index 42e0e5f..5810dab 100644 --- a/src/music_kraken/pages/encyclopaedia_metallum.py +++ b/src/music_kraken/pages/encyclopaedia_metallum.py @@ -110,13 +110,13 @@ class EncyclopaediaMetallum(Page): SOURCE_TYPE = SourcePages.ENCYCLOPAEDIA_METALLUM LOGGER = ENCYCLOPAEDIA_METALLUM_LOGGER - def __init__(self): + def __init__(self, **kwargs): self.connection: Connection = Connection( host="https://www.metal-archives.com/", logger=ENCYCLOPAEDIA_METALLUM_LOGGER ) - super().__init__() + super().__init__(**kwargs) def song_search(self, song: Song) -> List[Song]: endpoint = "https://www.metal-archives.com/search/ajax-advanced/searching/songs/?songTitle={song}&bandName={" \ diff --git a/src/music_kraken/pages/musify.py b/src/music_kraken/pages/musify.py index e4dea1a..34c9fe6 100644 --- a/src/music_kraken/pages/musify.py +++ b/src/music_kraken/pages/musify.py @@ -115,13 +115,13 @@ class Musify(Page): HOST = "https://musify.club" - def __init__(self): + def __init__(self, *args, **kwargs): self.connection: Connection = Connection( host="https://musify.club/", logger=self.LOGGER ) - super().__init__() + super().__init__(*args, **kwargs) def get_source_type(self, source: Source) -> Optional[Type[DatabaseObject]]: if source.url is None: diff --git a/src/music_kraken/pages/preset.py b/src/music_kraken/pages/preset.py index e688074..7fc8212 100644 --- a/src/music_kraken/pages/preset.py +++ b/src/music_kraken/pages/preset.py @@ -20,13 +20,13 @@ class Preset(Page): SOURCE_TYPE = SourcePages.PRESET LOGGER = logging.getLogger("preset") - def __init__(self): + def __init__(self, *args, **kwargs): self.connection: Connection = Connection( host="https://www.preset.cum/", logger=self.LOGGER ) - super().__init__() + super().__init__(*args, **kwargs) def get_source_type(self, source: Source) -> Optional[Type[DatabaseObject]]: return super().get_source_type(source)