Clean up loading cover images. Probably more to do.

This commit is contained in:
Mizaki 2022-10-29 16:41:34 +01:00
parent a06d88efc0
commit 26851475ea
3 changed files with 7 additions and 23 deletions

View File

@ -24,7 +24,6 @@ from typing import Callable
from PyQt5 import QtCore, QtGui, QtWidgets, uic
import comictalker.comictalkerapi as ct_api
from comicapi import utils
from comicapi.comicarchive import ComicArchive
from comictaggerlib.imagefetcher import ImageFetcher
@ -184,8 +183,7 @@ class CoverImageWidget(QtWidgets.QWidget):
self.update_content()
self.issue_id = issue_id
ct_api.url_fetch_complete = self.sig.emit_url
ct_api.url_fetch_complete(image_url, None)
self.sig.emit_url(image_url, None)
def set_image_data(self, image_data: bytes) -> None:
if self.mode == CoverImageWidget.DataMode:
@ -215,9 +213,11 @@ class CoverImageWidget(QtWidgets.QWidget):
# now we need to get the list of alt cover URLs
self.label.setText("Searching for alt. covers...")
# page URL should already be cached, so no need to defer
ct_api.alt_url_list_fetch_complete = self.sig.emit_list
self.talker_api.fetch_alternate_cover_urls(utils.xlate(self.issue_id))
url_list = self.talker_api.fetch_alternate_cover_urls(utils.xlate(self.issue_id))
if url_list:
self.url_list.extend(url_list)
self.imageCount = len(self.url_list)
self.update_controls()
def alt_cover_url_list_fetch_complete(self, url_list: list[str]) -> None:
if url_list:

View File

@ -18,24 +18,11 @@ from __future__ import annotations
import logging
import comictalker.talkers.comicvine
from comictalker.talkerbase import ComicTalker, TalkerError # renamed TalkerBase to ComicTalker
from comictalker.talkerbase import ComicTalker, TalkerError
logger = logging.getLogger(__name__)
# To signal image loaded etc. TODO Won't be needed hopefully with new async loading
def list_fetch_complete(url_list: list[str]) -> None:
...
def url_fetch_complete(image_url: str, thumb_url: str | None) -> None:
...
alt_url_list_fetch_complete = list_fetch_complete
url_fetch_complete = url_fetch_complete
def get_comic_talker(source_name: str) -> type[ComicTalker]:
# Retrieve the available sources modules
sources = get_talkers()

View File

@ -27,7 +27,6 @@ import requests
from bs4 import BeautifulSoup
from typing_extensions import Required, TypedDict
import comictalker.comictalkerapi as ct_api
from comicapi import utils
from comicapi.genericmetadata import GenericMetadata
from comicapi.issuestring import IssueString
@ -983,8 +982,6 @@ class ComicVineTalker(ComicTalker):
url_list = [x for x in formatted_volume_issues_result[0]["alt_images_url"].split(",") if x]
ct_api.alt_url_list_fetch_complete(url_list)
# CLI expects a list returned
return url_list
def repair_urls(self, issue_list: list[CVIssueDetailResults]) -> None: