From abd8019bf9447f929ec4d4382bfcc4387cea0bd4 Mon Sep 17 00:00:00 2001 From: lordwelch Date: Thu, 5 Sep 2019 15:19:44 -0700 Subject: [PATCH] Add seriesYear attribute Attribute is only serialized in ComicRack style metadata --- comicapi/comicbookinfo.py | 2 ++ comicapi/comicinfoxml.py | 2 ++ comicapi/genericmetadata.py | 3 +++ comictaggerlib/comicvinetalker.py | 7 ++++--- comictaggerlib/taggerwindow.py | 5 +++++ comictaggerlib/ui/taggerwindow.ui | 10 ++++++++++ 6 files changed, 26 insertions(+), 3 deletions(-) diff --git a/comicapi/comicbookinfo.py b/comicapi/comicbookinfo.py index e55fac9..28fb1f4 100644 --- a/comicapi/comicbookinfo.py +++ b/comicapi/comicbookinfo.py @@ -40,6 +40,7 @@ class ComicBookInfo: metadata.publisher = utils.xlate(cbi['publisher']) metadata.month = utils.xlate(cbi['publicationMonth'], True) metadata.year = utils.xlate(cbi['publicationYear'], True) + metadata.seriesYear = utils.xlate('seriesPublicationYear', True) metadata.issueCount = utils.xlate(cbi['numberOfIssues'], True) metadata.comments = utils.xlate(cbi['comments']) metadata.genre = utils.xlate(cbi['genre']) @@ -106,6 +107,7 @@ class ComicBookInfo: assign('publisher', utils.xlate(metadata.publisher)) assign('publicationMonth', utils.xlate(metadata.month, True)) assign('publicationYear', utils.xlate(metadata.year, True)) + assign('seriesPublicationYear', utils.xlate(metadata.seriesYear, True)) assign('numberOfIssues', utils.xlate(metadata.issueCount, True)) assign('comments', utils.xlate(metadata.comments)) assign('genre', utils.xlate(metadata.genre)) diff --git a/comicapi/comicinfoxml.py b/comicapi/comicinfoxml.py index 5c38902..646d032 100644 --- a/comicapi/comicinfoxml.py +++ b/comicapi/comicinfoxml.py @@ -104,6 +104,7 @@ class ComicInfoXml: assign('Year', md.year) assign('Month', md.month) assign('Day', md.day) + assign('SeriesYear', md.seriesYear) # need to specially process the credits, since they are structured # differently than CIX @@ -228,6 +229,7 @@ class ComicInfoXml: md.year = utils.xlate(get('Year'), True) md.month = utils.xlate(get('Month'), True) md.day = utils.xlate(get('Day'), True) + md.seriesYear = utils.xlate('SeriesYear', True) md.publisher = utils.xlate(get('Publisher')) md.imprint = utils.xlate(get('Imprint')) md.genre = utils.xlate(get('Genre')) diff --git a/comicapi/genericmetadata.py b/comicapi/genericmetadata.py index 4195c43..7f30335 100644 --- a/comicapi/genericmetadata.py +++ b/comicapi/genericmetadata.py @@ -65,6 +65,7 @@ class GenericMetadata: self.issue = None self.title = None self.publisher = None + self.seriesYear = None self.month = None self.year = None self.day = None @@ -132,6 +133,7 @@ class GenericMetadata: assign("issueCount", new_md.issueCount) assign("title", new_md.title) assign("publisher", new_md.publisher) + assign("seriesYear", new_md.seriesYear) assign("day", new_md.day) assign("month", new_md.month) assign("year", new_md.year) @@ -263,6 +265,7 @@ class GenericMetadata: add_attr_string("issueCount") add_attr_string("title") add_attr_string("publisher") + add_attr_string("seriesYear") add_attr_string("year") add_attr_string("month") add_attr_string("day") diff --git a/comictaggerlib/comicvinetalker.py b/comictaggerlib/comicvinetalker.py index 0acd808..e5f3f9c 100644 --- a/comictaggerlib/comicvinetalker.py +++ b/comictaggerlib/comicvinetalker.py @@ -222,7 +222,7 @@ class ComicVineTalker(QObject): 'format': 'json', 'resources': 'volume', 'query': series_name, - 'field_list': 'name,id,start_year,publisher,image,description,count_of_issues', + 'field_list': 'volume,name,id,start_year,publisher,image,description,count_of_issues', 'page': 1 } @@ -500,11 +500,12 @@ class ComicVineTalker(QObject): metadata.publisher = utils.xlate(volume_results['publisher']['name']) metadata.day, metadata.month, metadata.year = self.parseDateStr(issue_results['cover_date']) - #metadata.issueCount = volume_results['count_of_issues'] + metadata.seriesYear = utils.xlate(volume_results['start_year']) + metadata.issueCount = utils.xlate(volume_results['count_of_issues']) metadata.comments = self.cleanup_html( issue_results['description'], settings.remove_html_tables) if settings.use_series_start_as_volume: - metadata.volume = volume_results['start_year'] + metadata.volume = utils.xlate(volume_results['start_year']) metadata.notes = "Tagged with ComicTagger {0} using info from Comic Vine on {1}. [Issue ID {2}]".format( ctversion.version, diff --git a/comictaggerlib/taggerwindow.py b/comictaggerlib/taggerwindow.py index 5af523a..c9c3d05 100644 --- a/comictaggerlib/taggerwindow.py +++ b/comictaggerlib/taggerwindow.py @@ -188,6 +188,8 @@ class TaggerWindow(QtWidgets.QMainWindow): validator = QtGui.QIntValidator(1900, datetime.date.today().year + 15, self) self.lePubYear.setValidator(validator) + self.leSeriesPubYear.setValidator(validator) + validator = QtGui.QIntValidator(1, 12, self) self.lePubMonth.setValidator(validator) @@ -810,6 +812,7 @@ class TaggerWindow(QtWidgets.QMainWindow): assignText(self.lePubMonth, md.month) assignText(self.lePubYear, md.year) assignText(self.lePubDay, md.day) + assignText(self.leSeriesPubYear, str(md.seriesYear or "").lstrip("0")) assignText(self.leGenre, md.genre) assignText(self.leImprint, md.imprint) assignText(self.teComments, md.comments) @@ -935,6 +938,7 @@ class TaggerWindow(QtWidgets.QMainWindow): md.month = utils.xlate(self.lePubMonth.text(), True) md.year = utils.xlate(self.lePubYear.text(), True) md.day = utils.xlate(self.lePubDay.text(), True) + md.seriesYear = utils.xlate(self.leSeriesPubYear.text(), "int") md.criticalRating = utils.xlate(self.leCriticalRating.text(), True) md.alternateCount = utils.xlate(self.leAltIssueCount.text(), True) @@ -988,6 +992,7 @@ class TaggerWindow(QtWidgets.QMainWindow): row += 1 md.pages = self.pageListEditor.getPageList() + self.metadata = md def useFilename(self): diff --git a/comictaggerlib/ui/taggerwindow.ui b/comictaggerlib/ui/taggerwindow.ui index d4b9e79..56d2484 100644 --- a/comictaggerlib/ui/taggerwindow.ui +++ b/comictaggerlib/ui/taggerwindow.ui @@ -511,8 +511,18 @@ false + + + + + + Series Year + + + + <html><head/><body><p>Checks the publisher against a list of imprints.</p></body></html>