Hello I send a patch to correctly print years (and not dates) of audio files in TST. Problem: some audio files do not have a correct year. They miss often a year. My code is pretty trivial so I think there is a bad conversion in trackerd directly. But, can I commit anyway? Laurent.
Index: ChangeLog
===================================================================
--- ChangeLog (révision 730)
+++ ChangeLog (copie de travail)
@@ -1,9 +1,14 @@
+2007-07-26 Laurent Aguerreche <laurent aguerreche free fr>
+ * Fixed printing of date for audio files in TST
+
+
2007-07-25 Patch from Jerry Tan <Jerry Tan Sun COM>
* updated applet to 0.6.0 settings
* fixed crasher and made read tags case insensitive for html extractor
+
2007-07-25 Jamie McCracken <jamiemcc at gnome org>
* Based on patch by Marcus Fritzsch <fritschy googlemail com>
@@ -11,12 +16,12 @@
* Removed forced indexing of home dir when no watch dirs specified (home is default in cfg file)
-
2007-07-24 Michael Biebl <mbiebl at gmail com>
* Include the deskbar-applet plugin on make dist
* Show if deskbar-applet support is enabled in the ./configure summary
+
2007-07-18 Patch from Jerry Tan <Jerry Tan Sun COM>
* Fixed command line tracker-tag
Index: src/libtracker-gtk/tracker-metadata-tile.c
===================================================================
--- src/libtracker-gtk/tracker-metadata-tile.c (révision 730)
+++ src/libtracker-gtk/tracker-metadata-tile.c (copie de travail)
@@ -221,6 +221,7 @@
static void tracker_metadata_tile_show (TrackerMetadataTile *tile);
static void _property_to_label (GtkWidget *label, const char *prop, const char *string);
static void _date_to_label (GtkWidget *label, const char *prop, const char *string);
+static void _year_to_label (GtkWidget *label, const char *prop, const char *string);
static void _size_to_label (GtkWidget *label, const char *prop, const char *string);
static void _dimensions_to_label (GtkWidget *label, const char *width, const char *height, const char *string);
static void _seconds_to_label (GtkWidget *label, const char *prop, const char *string);
@@ -636,7 +637,7 @@
_seconds_to_label ( priv->info1, array[AUDIO_DURATION] , _("Duration : <b>%s</b>"));
_property_to_label ( priv->info2, array[AUDIO_GENRE] , _("Genre : <b>%s</b>"));
_bitrate_to_label ( priv->info3, array[AUDIO_BITRATE] , _("Bitrate : <b>%s Kbs</b>"));
- _date_to_label ( priv->info4, array[AUDIO_RELEASEDATE] , _("Year : <b>%s</b>"));
+ _year_to_label ( priv->info4, array[AUDIO_RELEASEDATE] , _("Year : <b>%s</b>"));
_size_to_label ( priv->info5, array[AUDIO_SIZE] , _("Size : <b>%s</b>"));
_property_to_label ( priv->info6, array[AUDIO_CODEC] , _("Codec : <b>%s</b>"));
@@ -899,7 +900,7 @@
char *format;
size = atol (prop);
- format = g_strdup_printf ("%d", size);
+ format = g_strdup_printf ("%ld", size);
if (size) {
temp = g_strdup_printf (string, format);
@@ -940,25 +941,55 @@
/* Converts ISO date to something human readable */
+static gboolean
+get_time_from_iso (const char *iso, GDate *val)
+{
+ g_return_val_if_fail (val, FALSE);
+
+ time_t my_time = atoi (iso);
+
+ if (my_time != 0) {
+ g_date_set_time_t (val, my_time);
+ return TRUE;
+ } else {
+ return FALSE;
+ }
+}
+
static void
_date_to_label (GtkWidget *label, const char *iso, const char *string)
{
GDate val;
- char *temp = NULL, *date;
- time_t my_time;
+ char *temp = NULL;
if (string) {
- my_time = atoi (iso);
-
- if (my_time != 0) {
-
- g_date_set_time_t (&val, my_time);
+ if (get_time_from_iso (iso, &val)) {
gchar buf[256];
- g_date_strftime(buf,256,"%a %d %b %Y", &val);
+ g_date_strftime (buf, 256, "%a %d %b %Y", &val);
temp = g_strdup_printf (string, buf);
+ }
+ }
- }
+ if (!temp) {
+ temp = g_strdup_printf (string, _("Unknown"));
+ }
+ gtk_label_set_markup (GTK_LABEL (label), temp);
+ g_free (temp);
+}
+
+static void
+_year_to_label (GtkWidget *label, const char *iso, const char *string)
+{
+ GDate val;
+ char *temp = NULL;
+
+ if (string) {
+ if (get_time_from_iso (iso, &val)) {
+ gchar buf[32];
+ g_date_strftime (buf, 32, "%Y", &val);
+ temp = g_strdup_printf (string, buf);
+ }
}
if (!temp) {
Attachment:
signature.asc
Description: Ceci est une partie de message =?ISO-8859-1?Q?num=E9riquement?= =?ISO-8859-1?Q?_sign=E9e?=