Skip to content

Commit

Permalink
Some stuff by Nick, modified
Browse files Browse the repository at this point in the history
  • Loading branch information
manolomartinez committed Feb 9, 2016
1 parent 4ac6aaf commit 73152e1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion greg/greg.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,17 @@ def how_many(self):
Ascertain where to start downloading, and how many entries.
"""
if self.linkdates != []:
currentdate = max(self.linkdates)
# What follows is a quick sanity check: if the entry date is in the
# future, this is probably a mistake, and we just count the entry
# date as right now.
if max(self.linkdates) <= list(time.localtime()):
currentdate = max(self.linkdates)
else:
currentdate = list(time.localtime())
print(("This entry has its date set in the future. "
"I will use your current local time as its date "
"instead."),
file=sys.stderr, flush=True)
stop = sys.maxsize
else:
currentdate = [1, 1, 1, 0, 0]
Expand Down Expand Up @@ -579,6 +589,8 @@ def parse_feed_info(infofile):
# This is the list of already downloaded entry links
linkdates.append(eval(line.split(sep=' ', maxsplit=1)[1]))
# This is the list of already downloaded entry dates
# Note that entrydates are lists, converted from a
# time.struct_time() object
except FileNotFoundError:
pass
return entrylinks, linkdates
Expand Down

0 comments on commit 73152e1

Please sign in to comment.