[Nautilus-list] Re: Fix for track info in Nautilus music view.



> Turns out that reading track numbers was implemented wrong for the
> id3v1.1 tag format, and not at all for id3v2.
> 
> I've fixed it for id3v1.1 in the patch below. The fix for v2 is
> obvious, but I haven't done it, since I don't have any test files.

Darin points out that snprintf is nonportable.

The easy fix is to use g_snprintf instead, as show below.

Regards

Jon Kåre

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/nautilus/ChangeLog,v
retrieving revision 1.4619
diff -u -r1.4619 ChangeLog
--- ChangeLog   2001/05/17 18:24:14     1.4619
+++ ChangeLog   2001/05/17 21:25:21
@@ -1,3 +1,14 @@
+2001-05-17  Jon K Hellan  <hellan acm org>
+
+       * components/music/mpg123.h (struct id3v1tag_t): Fix track info.
+       (struct id3tag_t): Fix track info. Not tested for v2, but big
+       enough for what can be represented in v1.1.
+
+       * components/music/mpg123.c (mpg123_id3v1_to_id3v2): Fix track
+       info. Track in id3v1.1 is an 8 bit integer, not a string.
+       Track is still unimplemented for id3v2. I did not fix it, as I
+       don't have examples to test with.
+
 2001-05-17  Darin Adler  <darin eazel com>

        * configure.in:
Index: components/music/mpg123.c
===================================================================
RCS file: /cvs/gnome/nautilus/components/music/mpg123.c,v
retrieving revision 1.6
diff -u -r1.6 mpg123.c
--- components/music/mpg123.c   2001/04/23 13:55:23     1.6
+++ components/music/mpg123.c   2001/05/17 21:25:22
@@ -368,7 +368,7 @@
        strncpy(v2->album, v1->album, 30);
        strncpy(v2->year, v1->year, 4);
        strncpy(v2->comment, v1->comment, 28);
-       strncpy(v2->track, v1->track, 2);
+       g_snprintf(v2->track, sizeof v2->track, "%d", v1->track);
        strncpy(v2->genre, get_id3_genre(v1->genre), sizeof (v2->genre));
        mpg123_strip_spaces(v2->title, 30);
        mpg123_strip_spaces(v2->artist, 30);
Index: components/music/mpg123.h
===================================================================
RCS file: /cvs/gnome/nautilus/components/music/mpg123.h,v
retrieving revision 1.5
diff -u -r1.5 mpg123.h
--- components/music/mpg123.h   2001/02/23 16:06:09     1.5
+++ components/music/mpg123.h   2001/05/17 21:25:22
@@ -46,7 +46,8 @@
        char album[30];
        char year[4];
        char comment[28];
-       char track[2];
+       char fill;
+       char track;
        unsigned char genre;
 };

@@ -57,7 +58,7 @@
        char year[5];
        char comment[256];
        char genre[256];
-       char track[2];
+       char track[4];
 };

 typedef struct

     _________________________________________________________________
   
     * Previous message: [Nautilus-list] Scripts/Themes web page.
     * Next message: [Nautilus-list] Updated THANKS file (added 23
       translators that weren't in).
     * Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]