Re: [Easytag-mailing] flac comment problem



The previous patch was incomplete... This one would be ok

Jerome



Jérôme COUDERC wrote, the 14.06.2007 23:35 :
Here a patch that should fix the problem

Regards,
Jerome


EasyTAG wrote, the 09.06.2007 23:32 :
Hi,

Indeed, the program try to read the DESCRIPTION tag field to fill the comment entry. I think that we can fix easily the problem by reading the COMMENT or the DESCRIPTION tag field as it is already done for Ogg Vorbis files.

Regards,
Jerome


2007/6/8, Doruk Fisek <dfisek fisek com tr <mailto:dfisek fisek com tr>>:

    Fri, 08 Jun 2007 13:21:43 +0100, Oliver Lupton
    <oliverlupton gmail com <mailto:oliverlupton gmail com>> :

> I don't actually use EasyTag anymore, so I can't check this. However
    > just try and save a comment via EasyTag and then do metaflac
    --list on
    > the file.
> I've seen some programs which save comments as the 'COMMENT' tag and
    > some which save it as 'DESCRIPTION' -- that might be what's
    happening
    > here :)
    Seems so, I added a comment with Easytag, here's the new output :

    METADATA block #2
      type: 4 (VORBIS_COMMENT)
      is last: false
      length: 232
      vendor string: reference libFLAC 1.1.4 20070213
      comments: 9
        comment[0]: TITLE=Sunrise
        comment[1]: ARTIST=Jon Lord
        comment[2]: ALBUM=Pictured Within
        comment[3]: DATE=1998
        comment[4]: TRACKNUMBER=01
        comment[5]: TRACKTOTAL=12
        comment[6]: DESCRIPTION=testing 1-2
        comment[7]: DISCID=B111830C
        comment[8]: COMMENT=EAC v0.95b3 Flac 1.1.4 -8

                       Doruk

    --
    FISEK INSTITUTE - http://www.fisek.org.tr

-------------------------------------------------------------------------

    This SF.net email is sponsored by DB2 Express
    Download DB2 Express C - the FREE version of DB2 express and take
    control of your XML. No limits. Just data. Click to get it now.
    http://sourceforge.net/powerbar/db2/
    _______________________________________________
    Easytag-mailing mailing list
    Easytag-mailing lists sourceforge net
    <mailto:Easytag-mailing lists sourceforge net>
    https://lists.sourceforge.net/lists/listinfo/easytag-mailing



------------------------------------------------------------------------

diff -ruN easytag-2.1.orig/src/flac_tag.c easytag-2.1/src/flac_tag.c
--- easytag-2.1.orig/src/flac_tag.c	2007-04-30 00:42:40.000000000 +0200
+++ easytag-2.1/src/flac_tag.c	2007-06-14 23:31:28.000000000 +0200
@@ -399,8 +399,26 @@
      * Comment *
      ***********/
     field_num = 0;
-    while ( (field_num = FLAC__metadata_object_vorbiscomment_find_entry_from(vc_block,field_num,"DESCRIPTION")) >= 0 )
+    while ( 1 )
     {
+        gint field_num1, field_num2;
+
+        // The comment field can take two forms...
+        field_num1 = FLAC__metadata_object_vorbiscomment_find_entry_from(vc_block,field_num,"DESCRIPTION");
+        field_num2 = FLAC__metadata_object_vorbiscomment_find_entry_from(vc_block,field_num,"COMMENT");
+
+        if (field_num1 >= 0 && field_num2 >= 0)
+            if (field_num1 < field_num2)
+                field_num = field_num1;
+            else
+                field_num = field_num2;
+        else if (field_num1 >= 0)
+            field_num = field_num1;
+        else if (field_num2 >= 0)
+            field_num = field_num2;
+        else
+            break;
+
         /* Extract field value */
         field = &vc->comments[field_num++];
         field_value = memchr(field->entry, '=', field->length);

--
EasyTAG - Tag editor for MP3 and Ogg Vorbis files
http://easytag.sourceforge.net
--
Jerome COUDERC <easytag gmail com>

diff -ruN easytag-2.1.orig/src/flac_tag.c easytag-2.1/src/flac_tag.c
--- easytag-2.1.orig/src/flac_tag.c	2007-04-30 00:42:40.000000000 +0200
+++ easytag-2.1/src/flac_tag.c	2007-06-15 07:41:04.000000000 +0200
@@ -399,8 +399,28 @@
      * Comment *
      ***********/
     field_num = 0;
-    while ( (field_num = FLAC__metadata_object_vorbiscomment_find_entry_from(vc_block,field_num,"DESCRIPTION")) >= 0 )
+    while ( 1 )
     {
+        gint field_num1, field_num2;
+
+        // The comment field can take two forms...
+        field_num1 = FLAC__metadata_object_vorbiscomment_find_entry_from(vc_block,field_num,"DESCRIPTION");
+        field_num2 = FLAC__metadata_object_vorbiscomment_find_entry_from(vc_block,field_num,"COMMENT");
+
+        if (field_num1 >= 0 && field_num2 >= 0)
+            // Note : We set field_num to the last "comment" field to avoid to concatenate 
+            // the DESCRIPTION and COMMENT field if there are both present (EasyTAG writes the both...)
+            if (field_num1 < field_num2)
+                field_num = field_num2;
+            else
+                field_num = field_num1;
+        else if (field_num1 >= 0)
+            field_num = field_num1;
+        else if (field_num2 >= 0)
+            field_num = field_num2;
+        else
+            break;
+
         /* Extract field value */
         field = &vc->comments[field_num++];
         field_value = memchr(field->entry, '=', field->length);
@@ -588,6 +608,7 @@
           && strncasecmp((gchar *)field->entry,"TRACKTOTAL=",  MIN(11, field->length)) != 0
           && strncasecmp((gchar *)field->entry,"GENRE=",       MIN(6,  field->length)) != 0
           && strncasecmp((gchar *)field->entry,"DESCRIPTION=", MIN(12, field->length)) != 0
+          && strncasecmp((gchar *)field->entry,"COMMENT=",     MIN(8,  field->length)) != 0
           && strncasecmp((gchar *)field->entry,"COMPOSER=",    MIN(9,  field->length)) != 0
           && strncasecmp((gchar *)field->entry,"PERFORMER=",   MIN(10, field->length)) != 0
           && strncasecmp((gchar *)field->entry,"COPYRIGHT=",   MIN(10, field->length)) != 0
@@ -849,6 +870,12 @@
         field.length = strlen(string);
         FLAC__metadata_object_vorbiscomment_insert_comment(vc_block,vc_block->data.vorbis_comment.num_comments,field,true);
         g_free(string);
+
+        string = g_strconcat("COMMENT=",FileTag->comment,NULL);
+        field.entry = (FLAC__byte *)string;
+        field.length = strlen(string);
+        FLAC__metadata_object_vorbiscomment_insert_comment(vc_block,vc_block->data.vorbis_comment.num_comments,field,true);
+        g_free(string);
     }
 
     /************


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