1
0
Fork 0
mirror of https://github.com/evilhero/mylar synced 2024-12-25 09:11:46 +00:00

FIX: Fix for search compares that are offset by enough timezone difference to place the search in the prior day, resulting in a non-match result

This commit is contained in:
evilhero 2017-01-02 20:12:18 -05:00
parent 2188061ba1
commit 49508e4944

View file

@ -843,6 +843,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, Publisher, IssueDa
else: else:
# convert it to a tuple # convert it to a tuple
dateconv = email.utils.parsedate_tz(pubdate) dateconv = email.utils.parsedate_tz(pubdate)
dateconv2 = datetime.datetime(*dateconv[:6])
try: try:
# convert it to a numeric time, then subtract the timezone difference (+/- GMT) # convert it to a numeric time, then subtract the timezone difference (+/- GMT)
if dateconv[-1] is not None: if dateconv[-1] is not None:
@ -864,6 +865,7 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, Publisher, IssueDa
issconv = issue_convert.strftime('%a, %d %b %Y %H:%M:%S') issconv = issue_convert.strftime('%a, %d %b %Y %H:%M:%S')
#convert it to a tuple #convert it to a tuple
econv = email.utils.parsedate_tz(issconv) econv = email.utils.parsedate_tz(issconv)
econv2 = datetime.datetime(*econv[:6])
#convert it to a numeric and drop the GMT/Timezone #convert it to a numeric and drop the GMT/Timezone
try: try:
issuedate_int = time.mktime(econv[:len(econv) -1]) issuedate_int = time.mktime(econv[:len(econv) -1])
@ -876,12 +878,20 @@ def NZB_SEARCH(ComicName, IssueNumber, ComicYear, SeriesYear, Publisher, IssueDa
issuedate_int = int(time.mktime(tm.timetuple())) issuedate_int = int(time.mktime(tm.timetuple()))
else: else:
continue continue
try:
#try new method to get around issues populating in a diff timezone thereby putting them in a different day.
if dateconv2.date() < econv2.date():
logger.fdebug(str(pubdate) + ' is before store date of ' + str(stdate) + '. Ignoring search result as this is not the right issue.')
continue
else:
logger.fdebug(str(pubdate) + ' is after store date of ' + str(stdate))
except:
#if the above fails, drop down to the integer compare method as a failsafe.
if postdate_int < issuedate_int: if postdate_int < issuedate_int:
logger.fdebug(str(pubdate) + ' is before store date of ' + str(stdate) + '. Ignoring search result as this is not the right issue.') logger.fdebug(str(pubdate) + ' is before store date of ' + str(stdate) + '. Ignoring search result as this is not the right issue.')
continue continue
else: else:
logger.fdebug(str(pubdate) + ' is after store date of ' + str(stdate)) logger.fdebug(str(pubdate) + ' is after store date of ' + str(stdate))
# -- end size constaints. # -- end size constaints.
if '(digital first)' in ComicTitle.lower(): #entry['title'].lower(): if '(digital first)' in ComicTitle.lower(): #entry['title'].lower():