Merge fetch_issue_data and fetch_volume_data to fetch_comic_data.
This commit is contained in:
parent
3ea44b7ca7
commit
9aa29f1445
@ -43,7 +43,7 @@ def actual_issue_data_fetch(
|
||||
) -> GenericMetadata:
|
||||
# now get the particular issue data
|
||||
try:
|
||||
ct_md = talker_api.fetch_issue_data(match["volume_id"], match["issue_number"])
|
||||
ct_md = talker_api.fetch_comic_data(match["volume_id"], match["issue_number"])
|
||||
except TalkerError as e:
|
||||
logger.exception(f"Error retrieving issue details. Save aborted.\n{e}")
|
||||
return GenericMetadata()
|
||||
|
@ -1070,11 +1070,7 @@ Have fun!
|
||||
self.form_to_metadata()
|
||||
|
||||
try:
|
||||
# Does the source support issue level data?
|
||||
if self.talker_api.static_options.has_issues:
|
||||
new_metadata = self.talker_api.fetch_issue_data(selector.volume_id, selector.issue_number)
|
||||
else:
|
||||
new_metadata = self.talker_api.fetch_volume_data(selector.volume_id)
|
||||
new_metadata = self.talker_api.fetch_comic_data(selector.volume_id, selector.issue_number)
|
||||
except TalkerError as e:
|
||||
QtWidgets.QApplication.restoreOverrideCursor()
|
||||
QtWidgets.QMessageBox.critical(
|
||||
@ -1674,10 +1670,7 @@ Have fun!
|
||||
QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.CursorShape.WaitCursor))
|
||||
|
||||
try:
|
||||
if self.talker_api.static_options.has_issues:
|
||||
ct_md = self.talker_api.fetch_issue_data(match["volume_id"], match["issue_number"])
|
||||
else:
|
||||
ct_md = self.talker_api.fetch_volume_data(match["volume_id"])
|
||||
ct_md = self.talker_api.fetch_comic_data(match["volume_id"], match["issue_number"])
|
||||
except TalkerError as e:
|
||||
logger.exception(f"Save aborted.\n{e}")
|
||||
|
||||
|
@ -92,17 +92,17 @@ class ComicTalker:
|
||||
"The source has not implemented: 'search_for_series'",
|
||||
)
|
||||
|
||||
# Master function to fetch series data (i.e for sources without issue level details)
|
||||
def fetch_volume_data(self, series_id: int) -> GenericMetadata:
|
||||
# Get issue or volume information
|
||||
def fetch_comic_data(self, series_id: int, issue_number: str = "") -> GenericMetadata:
|
||||
try:
|
||||
series_result = self.talker.fetch_volume_data(series_id)
|
||||
return series_result
|
||||
comic_data = self.talker.fetch_comic_data(series_id, issue_number)
|
||||
return comic_data
|
||||
except NotImplementedError:
|
||||
logger.warning(f"{self.talker.source_details.name} has not implemented: 'fetch_volume_data'")
|
||||
logger.warning(f"{self.talker.source_details.name} has not implemented: 'fetch_comic_data'")
|
||||
raise TalkerError(
|
||||
self.talker.source_details.name,
|
||||
4,
|
||||
"The source has not implemented: 'fetch_volume_data'",
|
||||
"The source has not implemented: 'fetch_comic_data'",
|
||||
)
|
||||
|
||||
# Master function to get issues in a series/volume
|
||||
@ -118,19 +118,6 @@ class ComicTalker:
|
||||
"The source has not implemented: 'fetch_issues_by_volume'",
|
||||
)
|
||||
|
||||
# Master function to get issue information
|
||||
def fetch_issue_data(self, series_id: int, issue_number: str) -> GenericMetadata:
|
||||
try:
|
||||
issue_result = self.talker.fetch_issue_data(series_id, issue_number)
|
||||
return issue_result
|
||||
except NotImplementedError:
|
||||
logger.warning(f"{self.talker.source_details.name} has not implemented: 'fetch_issue_data'")
|
||||
raise TalkerError(
|
||||
self.talker.source_details.name,
|
||||
4,
|
||||
"The source has not implemented: 'fetch_issue_data'",
|
||||
)
|
||||
|
||||
# For CLI
|
||||
def fetch_issue_data_by_issue_id(self, issue_id: int) -> GenericMetadata:
|
||||
try:
|
||||
|
@ -187,16 +187,12 @@ class TalkerBase:
|
||||
) -> list[ComicVolume]:
|
||||
raise NotImplementedError
|
||||
|
||||
# Get volume/series information
|
||||
def fetch_volume_data(self, series_id: int) -> GenericMetadata:
|
||||
raise NotImplementedError
|
||||
|
||||
# Get issues in a series/volume
|
||||
def fetch_issues_by_volume(self, series_id: int) -> list[ComicIssue]:
|
||||
raise NotImplementedError
|
||||
|
||||
# Get issue information
|
||||
def fetch_issue_data(self, series_id: int, issue_number: str) -> GenericMetadata:
|
||||
# Get issue or volume information
|
||||
def fetch_comic_data(self, series_id: int, issue_number: str = "") -> GenericMetadata:
|
||||
raise NotImplementedError
|
||||
|
||||
# For CLI
|
||||
|
@ -553,6 +553,17 @@ class ComicVineTalker(TalkerBase):
|
||||
|
||||
return self.map_cv_volume_data_to_metadata(volume_results)
|
||||
|
||||
# Get issue or volume information
|
||||
def fetch_comic_data(self, series_id: int, issue_number: str = "") -> GenericMetadata:
|
||||
comic_data = GenericMetadata()
|
||||
if self.source_details.static_options.has_issues and issue_number:
|
||||
comic_data = self.fetch_issue_data(series_id, issue_number)
|
||||
else:
|
||||
# Only retrieve the volume data
|
||||
comic_data = self.fetch_volume_data(series_id)
|
||||
|
||||
return comic_data
|
||||
|
||||
def fetch_partial_volume_data(self, series_id: int) -> ComicVolume:
|
||||
|
||||
# before we search online, look in our cache, since we might already have this info
|
||||
|
Loading…
x
Reference in New Issue
Block a user