From 82bd567c32e5f793fdad36bb94e82d73ecf4c00d Mon Sep 17 00:00:00 2001 From: evilhero Date: Mon, 14 Jan 2019 10:54:54 -0500 Subject: [PATCH] FIX: When Rechecking series that are One-Shots, and the filename did not contain an issue number would cause an error and not scan in, FIX: if a Special did not contain an issue number (ie. One-Shot), would fail during parsing --- mylar/filechecker.py | 4 +++- mylar/updater.py | 40 +++++++++++++++++++++++++++------------- 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/mylar/filechecker.py b/mylar/filechecker.py index 5bf665b0..eb373d06 100755 --- a/mylar/filechecker.py +++ b/mylar/filechecker.py @@ -1149,7 +1149,9 @@ class FileChecker(object): if mylar.CONFIG.ANNUALS_ON and 'special' not in nspace_watchcomic.lower(): if 'special' in series_name.lower(): - justthedigits = 'Special ' + series_info['issue_number'] + justthedigits = 'Special' + if series_info['issue_number'] is not None: + justthedigits += ' %s' % series_info['issue_number'] nspace_seriesname = re.sub('special', '', nspace_seriesname.lower()).strip() nspace_seriesname_decoded = re.sub('special', '', nspace_seriesname_decoded.lower()).strip() if alt_series is not None and 'special' in alt_series.lower(): diff --git a/mylar/updater.py b/mylar/updater.py index fe44bcec..7a4c5adb 100755 --- a/mylar/updater.py +++ b/mylar/updater.py @@ -933,7 +933,10 @@ def forceRescan(ComicID, archive=None, module=None, recheck=False): altnames = '' if (all([rescan['Type'] != 'Print', rescan['Type'] != 'Digital', rescan['Type'] != 'None', rescan['Type'] is not None]) and rescan['Corrected_Type'] != 'Print') or rescan['Corrected_Type'] == 'TPB': - booktype = 'TPB' + if rescan['Type'] == 'One-Shot' and rescan['Corrected_Type'] is None: + booktype = 'One-Shot' + else: + booktype = 'TPB' else: booktype = None @@ -990,15 +993,23 @@ def forceRescan(ComicID, archive=None, module=None, recheck=False): cla = ca['comiclist'][i] except (IndexError, KeyError) as e: break - if booktype == 'TPB' and iscnt > 1: - just_the_digits = re.sub('[^0-9]', '', cla['SeriesVolume']).strip() + + try: + if all([booktype == 'TPB', iscnt > 1]) or all([booktype == 'One-Shot', iscnt == 1]): + if cla['SeriesVolume'] is not None: + just_the_digits = re.sub('[^0-9]', '', cla['SeriesVolume']).strip() + else: + just_the_digits = re.sub('[^0-9]', '', cla['JusttheDigits']).strip() + else: + just_the_digits = cla['JusttheDigits'] + except Exception as e: + logger.warn('[Exception: %s] Unable to properly match up/retrieve issue number (or volume) for this [CS: %s]' % (e,cla)) else: - just_the_digits = cla['JusttheDigits'] - fcb.append({"ComicFilename": cla['ComicFilename'], - "ComicLocation": cla['ComicLocation'], - "ComicSize": cla['ComicSize'], - "JusttheDigits": just_the_digits, - "AnnualComicID": cla['AnnualComicID']}) + fcb.append({"ComicFilename": cla['ComicFilename'], + "ComicLocation": cla['ComicLocation'], + "ComicSize": cla['ComicSize'], + "JusttheDigits": just_the_digits, + "AnnualComicID": cla['AnnualComicID']}) i+=1 fc['comiclist'] = fcb @@ -1082,10 +1093,13 @@ def forceRescan(ComicID, archive=None, module=None, recheck=False): return else: break - temploc = tmpfc['JusttheDigits'].replace('_', ' ') - - temploc = re.sub('[\#\']', '', temploc) - logger.fdebug(module + ' temploc: ' + temploc) + if tmpfc['JusttheDigits'] is not None: + temploc= tmpfc['JusttheDigits'].replace('_', ' ') + temploc = re.sub('[\#\']', '', temploc) + logger.fdebug('temploc: %s' % temploc) + else: + temploc = None + if all(['annual' not in temploc.lower(), 'special' not in temploc.lower()]): #remove the extension here extensions = ('.cbr', '.cbz', '.cb7')