From f2d4926947cec8046e1457b5092c2bebc0a491ed Mon Sep 17 00:00:00 2001 From: evilhero Date: Sun, 18 Feb 2018 11:14:59 -0500 Subject: [PATCH] FIX: if refresh series would fail, creates None values for latest date that causes problems thereafter --- mylar/helpers.py | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/mylar/helpers.py b/mylar/helpers.py index 03f6787b..7a19a1af 100755 --- a/mylar/helpers.py +++ b/mylar/helpers.py @@ -1187,22 +1187,26 @@ def latestdate_fix(): "comicname_filesafe": filesafe(cl['ComicName'])}) latestdate = cl['LatestDate'] #logger.fdebug("latestdate: " + str(latestdate)) - if latestdate[8:] == '': - #logger.fdebug("invalid date " + str(latestdate) + " appending 01 for day to avoid errors") - if len(latestdate) <= 7: - finddash = latestdate.find('-') - #logger.info('dash found at position ' + str(finddash)) - if finddash != 4: #format of mm-yyyy - lat_month = latestdate[:finddash] - lat_year = latestdate[finddash +1:] - else: #format of yyyy-mm - lat_month = latestdate[finddash +1:] - lat_year = latestdate[:finddash] + try: + if latestdate[8:] == '': + #logger.fdebug("invalid date " + str(latestdate) + " appending 01 for day to avoid errors") + if len(latestdate) <= 7: + finddash = latestdate.find('-') + #logger.info('dash found at position ' + str(finddash)) + if finddash != 4: #format of mm-yyyy + lat_month = latestdate[:finddash] + lat_year = latestdate[finddash +1:] + else: #format of yyyy-mm + lat_month = latestdate[finddash +1:] + lat_year = latestdate[:finddash] - latestdate = (lat_year) + '-' + str(lat_month) + '-01' - datefix.append({"comicid": cl['ComicID'], - "latestdate": latestdate}) - #logger.info('latest date: ' + str(latestdate)) + latestdate = (lat_year) + '-' + str(lat_month) + '-01' + datefix.append({"comicid": cl['ComicID'], + "latestdate": latestdate}) + #logger.info('latest date: ' + str(latestdate)) + except: + datefix.append({"comicid": cl['ComicID'], + "latestdate" '0000-00-00'}) #now we fix. if len(datefix) > 0: