Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use current date to fill missing day/month #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import Queue
import json

import datetime
from dateutil import parser

#from mutagen import File
#from mutagen.mp4 import MP4
#from mutagen.id3 import ID3
Expand Down Expand Up @@ -137,7 +140,9 @@ def Log(self, message, *args):

def getDateFromString(self, string):
try:
return Datetime.ParseDate(string).date()
if not len(string): return None
DEFAULT_DATE = datetime.datetime(datetime.MINYEAR, 1, 1)
return parser.parse(string, default=DEFAULT_DATE).date()
except:
return None

Expand Down Expand Up @@ -237,7 +242,9 @@ def Log(self, message, *args):

def getDateFromString(self, string):
try:
return Datetime.ParseDate(string).date()
if not len(string): return None
DEFAULT_DATE = datetime.datetime(datetime.MINYEAR, 1, 1)
return parser.parse(string, default=DEFAULT_DATE).date()
except:
return None

Expand Down