WIP: feature/cleanup_programming_interface #40

Draft
Hazel wants to merge 35 commits from feature/cleanup_programming_interface into experimental
Showing only changes of commit 5cdd4fb6a9 - Show all commits

View File

@ -70,7 +70,7 @@ class CliDownloader:
genre: str = None,
process_metadata_anyway: bool = False,
) -> None:
self.pages: Downloader = Downloader(exclude_pages=exclude_pages, exclude_shady=exclude_shady)
self.downloader: Downloader = Downloader(exclude_pages=exclude_pages, exclude_shady=exclude_shady)
self.page_dict: Dict[str, Type[Page]] = dict()
@ -159,7 +159,7 @@ class CliDownloader:
def search(self, query: str):
if re.match(URL_PATTERN, query) is not None:
try:
page, data_object = self.pages.fetch_url(query)
data_object = self.downloader.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"
@ -213,13 +213,13 @@ class CliDownloader:
parsed_query: Query = self._process_parsed(key_text, query)
self.set_current_options(self.pages.search(parsed_query))
self.set_current_options(self.downloader.search(parsed_query))
self.print_current_options()
def goto(self, data_object: DatabaseObject):
page: Type[Page]
self.pages.fetch_details(data_object, stop_at_level=1)
self.downloader.fetch_details(data_object, stop_at_level=1)
self.set_current_options(GoToResults(data_object.options, max_items_per_page=self.max_displayed_options))
@ -233,7 +233,7 @@ class CliDownloader:
_result_map: Dict[DatabaseObject, DownloadResult] = dict()
for database_object in data_objects:
r = self.pages.download(
r = self.downloader.download(
data_object=database_object,
genre=self.genre,
**kwargs
@ -320,7 +320,7 @@ class CliDownloader:
if do_fetch:
for data_object in selected_objects:
self.pages.fetch_details(data_object)
self.downloader.fetch_details(data_object)
self.print_current_options()
return False