From 870dc5e9b6449544b2495512bfec13e404ab6663 Mon Sep 17 00:00:00 2001 From: Mizaki Date: Sun, 30 Oct 2022 17:52:55 +0000 Subject: [PATCH] Move issue_id to first position of fetch_comic_data as most used. --- comictaggerlib/cli.py | 4 ++-- comictaggerlib/taggerwindow.py | 10 ++++++---- comictalker/talkerbase.py | 2 +- comictalker/talkers/comicvine.py | 2 +- tests/comicvinetalker_test.py | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/comictaggerlib/cli.py b/comictaggerlib/cli.py index 5adb0ed..3d86109 100644 --- a/comictaggerlib/cli.py +++ b/comictaggerlib/cli.py @@ -43,7 +43,7 @@ def actual_issue_data_fetch( ) -> GenericMetadata: # now get the particular issue data try: - ct_md = talker_api.fetch_comic_data(issue_id=issue_id) + ct_md = talker_api.fetch_comic_data(issue_id) except TalkerError as e: logger.exception(f"Error retrieving issue details. Save aborted.\n{e}") return GenericMetadata() @@ -382,7 +382,7 @@ def process_file_cli( if opts.issue_id is not None: # we were given the actual issue ID to search with try: - ct_md = talker_api.fetch_comic_data(issue_id=opts.issue_id) + ct_md = talker_api.fetch_comic_data(opts.issue_id) except TalkerError as e: logger.exception(f"Error retrieving issue details. Save aborted.\n{e}") match_results.fetch_data_failures.append(str(ca.path.absolute())) diff --git a/comictaggerlib/taggerwindow.py b/comictaggerlib/taggerwindow.py index 646756e..dcd9d22 100644 --- a/comictaggerlib/taggerwindow.py +++ b/comictaggerlib/taggerwindow.py @@ -1076,13 +1076,15 @@ Have fun! try: if selector.issue_id: - new_metadata = self.talker_api.fetch_comic_data(issue_id=selector.issue_id) + new_metadata = self.talker_api.fetch_comic_data(selector.issue_id) elif selector.volume_id and selector.issue_number: # Would this ever be needed? - new_metadata = self.talker_api.fetch_comic_data(selector.volume_id, selector.issue_number) + new_metadata = self.talker_api.fetch_comic_data( + series_id=selector.volume_id, issue_number=selector.issue_number + ) else: # Only left with series? Isn't series only handled elsewhere? - new_metadata = self.talker_api.fetch_comic_data(selector.volume_id) + new_metadata = self.talker_api.fetch_comic_data(series_id=selector.volume_id) except TalkerError as e: QtWidgets.QApplication.restoreOverrideCursor() QtWidgets.QMessageBox.critical( @@ -1682,7 +1684,7 @@ Have fun! QtWidgets.QApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.CursorShape.WaitCursor)) try: - ct_md = self.talker_api.fetch_comic_data(issue_id=match["issue_id"]) + ct_md = self.talker_api.fetch_comic_data(match["issue_id"]) except TalkerError as e: logger.exception(f"Save aborted.\n{e}") diff --git a/comictalker/talkerbase.py b/comictalker/talkerbase.py index 15ec05e..85f0a4e 100644 --- a/comictalker/talkerbase.py +++ b/comictalker/talkerbase.py @@ -179,7 +179,7 @@ class ComicTalker: raise NotImplementedError # Get issue or volume information - def fetch_comic_data(self, series_id: int = 0, issue_number: str = "", issue_id: int = 0) -> GenericMetadata: + def fetch_comic_data(self, issue_id: int = 0, series_id: int = 0, issue_number: str = "") -> GenericMetadata: """This function is expected to handle a few possibilities: 1. Only series_id. Retrieve the SERIES/VOLUME information only. 2. series_id and issue_number. Retrieve the ISSUE information. diff --git a/comictalker/talkers/comicvine.py b/comictalker/talkers/comicvine.py index 157116e..ae14242 100644 --- a/comictalker/talkers/comicvine.py +++ b/comictalker/talkers/comicvine.py @@ -574,7 +574,7 @@ class ComicVineTalker(ComicTalker): return self.map_cv_volume_data_to_metadata(volume_results) # Get issue or volume information - def fetch_comic_data(self, series_id: int = 0, issue_number: str = "", issue_id: int = 0) -> GenericMetadata: + def fetch_comic_data(self, issue_id: int = 0, series_id: int = 0, issue_number: str = "") -> GenericMetadata: comic_data = GenericMetadata() # TODO remove has_issues check? Enables testing. Possibly add source option to only get volume info? if self.static_options.has_issues and issue_number and series_id: diff --git a/tests/comicvinetalker_test.py b/tests/comicvinetalker_test.py index 30eb1a9..f972740 100644 --- a/tests/comicvinetalker_test.py +++ b/tests/comicvinetalker_test.py @@ -47,7 +47,7 @@ def test_fetch_issues_by_volume(comicvine_api, comic_cache): def test_fetch_issue_data_by_issue_id(comicvine_api, settings, mock_now, mock_version): ct = comictalker.talkers.comicvine.ComicVineTalker() - result = ct.fetch_comic_data(issue_id=140529) + result = ct.fetch_comic_data(140529) assert result == testing.comicvine.cv_md