From 1b2a1c8fe71e27c53c284535997cb07ac8e49536 Mon Sep 17 00:00:00 2001 From: Dan Everton Date: Mon, 5 Mar 2007 09:04:03 +0000 Subject: Try and parse Ogg 'date' tags. Will only work if your date tags start with the year (e.g. yyyy-MM-dd). Which should be most people. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12622 a1c6a512-1295-4272-9138-f99709370657 --- apps/metadata.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'apps/metadata.c') diff --git a/apps/metadata.c b/apps/metadata.c index 8fdd776323..869e4b9b81 100644 --- a/apps/metadata.c +++ b/apps/metadata.c @@ -219,14 +219,16 @@ static long parse_tag(const char* name, char* value, struct mp3entry* id3, else if (((strcasecmp(name, "year") == 0) && (type == TAGTYPE_APE)) || ((strcasecmp(name, "date") == 0) && (type == TAGTYPE_VORBIS))) { - /* Date can be in more any format in a Vorbis tag, so don't try to - * parse it. + /* Date's can be in any format in Vorbis. However most of them + * are in ISO8601 format so if we try and parse the first part + * of the tag as a number, we should get the year. If we get crap, + * then act like we never parsed it. */ - if (type != TAGTYPE_VORBIS) - { - id3->year = atoi(value); + id3->year = atoi(value); + if (id3->year < 1900) + { /* yeah, not likely */ + id3->year = 0; } - p = &(id3->year_string); } else if (strcasecmp(name, "title") == 0) -- cgit v1.2.3