Improve date detection

This commit is contained in:
Salt 2020-03-13 18:10:07 -05:00
parent cb28ce9bb0
commit 37c2081627

View File

@ -335,8 +335,10 @@ class BadWitch:
album = entries[i]['album']
# Sometimes this just comes back None
if 'release_date' in entries[i] and entries[i]['release_date'] is not None and 'release_date' not in metadata:
print('Detected release date ' + entries[i]['release_date'])
metadata['release_date'] = entries[i]['release_date']
metadata['release_date'] = str(entries[i]['release_date'])
# Format up into a more proper date
metadata['release_date'] = metadata['release_date'][:4] + '-' + metadata['release_date'][4:6] + '-' + metadata['release_date'][6:]
print('Detected release date ' + metadata['release_date'])
# If YouTube's song tags didn't work, just grab metadata from the playlist
if album == '':
album = result['title']