Bugfix in date code for TVRage.

This commit is contained in:
echel0n 2014-03-10 18:02:32 -07:00
parent 33cf136487
commit 1cb293f3d6

View file

@ -576,13 +576,18 @@ class TVRage:
tag = curInfo.tag.lower() tag = curInfo.tag.lower()
if curInfo.tag.lower() in ('started', 'ended') and curInfo.text is not None: if curInfo.tag.lower() in ('started', 'ended') and curInfo.text is not None:
try:
fixDate = dt.datetime.strptime(curInfo.text,"%b/%d/%Y")
value = fixDate.strftime("%Y-%m-%d")
except:
try: try:
fixDate = dt.datetime.strptime(curInfo.text,"%b/%Y") fixDate = dt.datetime.strptime(curInfo.text,"%b/%Y")
newDate = fixDate.replace(day=01) newDate = fixDate.replace(day=01)
value = newDate.strftime("%Y-%m-%d") value = newDate.strftime("%Y-%m-%d")
except Exception: except:
fixDate = dt.datetime.strptime(curInfo.text,"%b/%d/%Y") fixDate = dt.datetime.strptime(curInfo.text,"%Y")
value = fixDate.strftime("%Y-%m-%d") newDate = fixDate.replace(month=01, day=01)
value = newDate.strftime("%Y-%m-%d")
else: else:
value = curInfo.text value = curInfo.text