[tracker] tracker-extract-mp3: Generate full date/time value for recording year
- From: Jürg Billeter <juergbi src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [tracker] tracker-extract-mp3: Generate full date/time value for recording year
- Date: Fri, 30 Oct 2009 13:24:19 +0000 (UTC)
commit ddac17ed5d5fdee8f35ce361e79df99c9f666faa
Author: Jürg Billeter <j bitron ch>
Date: Fri Oct 30 14:01:42 2009 +0100
tracker-extract-mp3: Generate full date/time value for recording year
Fixes NB#120255.
src/libtracker-common/tracker-type-utils.c | 3 +-
src/tracker-extract/tracker-extract-mp3.c | 31 ++++++++++++++++++++-------
2 files changed, 25 insertions(+), 9 deletions(-)
---
diff --git a/src/libtracker-common/tracker-type-utils.c b/src/libtracker-common/tracker-type-utils.c
index 7f63a81..8681327 100644
--- a/src/libtracker-common/tracker-type-utils.c
+++ b/src/libtracker-common/tracker-type-utils.c
@@ -125,7 +125,8 @@ tracker_date_format (const gchar *date_string)
buf[16] = ':';
buf[17] = '0';
buf[18] = '0';
- buf[19] = '\0';
+ buf[19] = 'Z';
+ buf[20] = '\0';
return g_strdup (buf);
} else {
diff --git a/src/tracker-extract/tracker-extract-mp3.c b/src/tracker-extract/tracker-extract-mp3.c
index 5603482..1bfb1ec 100644
--- a/src/tracker-extract/tracker-extract-mp3.c
+++ b/src/tracker-extract/tracker-extract-mp3.c
@@ -48,6 +48,7 @@
#include <libtracker-common/tracker-statement-list.h>
#include <libtracker-common/tracker-ontology.h>
#include <libtracker-common/tracker-utils.h>
+#include <libtracker-common/tracker-type-utils.h>
#include "tracker-albumart.h"
#include "tracker-main.h"
@@ -88,7 +89,7 @@ typedef struct {
gchar *title;
gchar *artist;
gchar *album;
- gchar *year;
+ gchar *recording_time;
gchar *comment;
gchar *genre;
gchar *encoding;
@@ -683,7 +684,7 @@ get_id3 (const gchar *data,
GString *s;
gboolean encoding_was_found;
#endif /* HAVE_ENCA */
- gchar *encoding;
+ gchar *encoding, *year;
const gchar *pos;
if (!data) {
@@ -732,7 +733,11 @@ get_id3 (const gchar *data,
id3->album = g_convert (pos, 30, "UTF-8", encoding, NULL, NULL, NULL);
pos += 30;
- id3->year = g_convert (pos, 4, "UTF-8", encoding, NULL, NULL, NULL);
+ year = g_convert (pos, 4, "UTF-8", encoding, NULL, NULL, NULL);
+ if (atoi (year) > 0) {
+ id3->recording_time = tracker_date_format (year);
+ }
+ g_free (year);
pos += 4;
@@ -1219,7 +1224,8 @@ get_id3v24_tags (const gchar *data,
tag->copyright = word;
break;
case ID3V24_TDRC:
- tag->recording_time = word;
+ tag->recording_time = tracker_date_format (word);
+ g_free (word);
break;
case ID3V24_TDRL:
tag->release_time = word;
@@ -1263,7 +1269,10 @@ get_id3v24_tags (const gchar *data,
break;
}
case ID3V24_TYER:
- tag->recording_time = word;
+ if (atoi (word) > 0) {
+ tag->recording_time = tracker_date_format (word);
+ }
+ g_free (word);
break;
default:
g_free (word);
@@ -1459,7 +1468,10 @@ get_id3v23_tags (const gchar *data,
break;
}
case ID3V24_TYER:
- tag->recording_time = word;
+ if (atoi (word) > 0) {
+ tag->recording_time = tracker_date_format (word);
+ }
+ g_free (word);
break;
default:
g_free (word);
@@ -1594,7 +1606,10 @@ get_id3v20_tags (const gchar *data,
tag->text = word;
break;
case ID3V2_TYE:
- tag->recording_time = word;
+ if (atoi (word) > 0) {
+ tag->recording_time = tracker_date_format (word);
+ }
+ g_free (word);
break;
default:
g_free (word);
@@ -1947,7 +1962,7 @@ extract_mp3 (const gchar *uri,
filedata.id3v23_info.release_time,
filedata.id3v22_info.recording_time,
filedata.id3v22_info.release_time,
- filedata.id3v1_info.year);
+ filedata.id3v1_info.recording_time);
filedata.publisher = tracker_coalesce (3, filedata.id3v24_info.publisher,
filedata.id3v23_info.publisher,
filedata.id3v22_info.publisher);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]