From 558ccee1f3678acc0b0f233f1708764e09a75db0 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Thu, 10 Mar 2016 12:15:07 +0000 Subject: [PATCH] Parse /2016-03-10/ and /2016/ patterns --- source/net/filebot/web/ID3Lookup.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/source/net/filebot/web/ID3Lookup.java b/source/net/filebot/web/ID3Lookup.java index 60fd842e..79de99f3 100644 --- a/source/net/filebot/web/ID3Lookup.java +++ b/source/net/filebot/web/ID3Lookup.java @@ -49,16 +49,22 @@ public class ID3Lookup implements MusicIdentificationService { String album = getString(mediaInfo, "Album"); String albumArtist = getString(mediaInfo, "Album/Performer"); String trackTitle = getString(mediaInfo, "Track"); - SimpleDate albumReleaseDate = null; Integer mediumIndex = null; Integer mediumCount = null; Integer trackIndex = getInteger(mediaInfo, "Track/Position"); Integer trackCount = getInteger(mediaInfo, "Track/Position_Total"); String mbid = null; - Integer year = getInteger(mediaInfo, "Recorded_Date"); - if (year != null) { - albumReleaseDate = new SimpleDate(year, 1, 1); + // try to parse 2016-03-10 + String dateString = getString(mediaInfo, "Recorded_Date"); + SimpleDate albumReleaseDate = SimpleDate.parse(dateString); + + // try to parse 2016 + if (albumReleaseDate == null) { + Integer year = matchInteger(dateString); + if (year != null) { + albumReleaseDate = new SimpleDate(year, 1, 1); + } } info.put(f, new AudioTrack(artist, title, album, albumArtist, trackTitle, albumReleaseDate, mediumIndex, mediumCount, trackIndex, trackCount, mbid));