Revision: 2113
          http://gtkpod.svn.sourceforge.net/gtkpod/?rev=2113&view=rev
Author:   jcsjcs
Date:     2008-08-31 02:02:16 +0000 (Sun, 31 Aug 2008)

Log Message:
-----------
        * src/mp3file.c: Handle Artist and AlbumArtist fields differently:
          For Artist: try the Artist tag and fall back to the Album Artist
          tag if the former does not exist.
          For Album Artist: set to the contents of the Album Artist tag,
          but only if the Artist tag does exist.
          Thanks to Dudy Kohen for the patch.

        * src/mp4file.c: do the same for mp4 files (the Album Artist tag
          was not supported before).

Modified Paths:
--------------
    gtkpod/trunk/ChangeLog
    gtkpod/trunk/src/mp3file.c
    gtkpod/trunk/src/mp4file.c

Modified: gtkpod/trunk/ChangeLog
===================================================================
--- gtkpod/trunk/ChangeLog      2008-08-23 18:04:30 UTC (rev 2112)
+++ gtkpod/trunk/ChangeLog      2008-08-31 02:02:16 UTC (rev 2113)
@@ -1,3 +1,15 @@
+2008-08-31 Jorg Schuler <jcsjcs at users.sourceforge.net>
+
+       * src/mp3file.c: Handle Artist and AlbumArtist fields differently:
+         For Artist: try the Artist tag and fall back to the Album Artist
+         tag if the former does not exist.
+         For Album Artist: set to the contents of the Album Artist tag,
+         but only if the Artist tag does exist.
+         Thanks to Dudy Kohen for the patch.
+
+       * src/mp4file.c: do the same for mp4 files (the Album Artist tag
+         was not supported before).
+
 2008-08-04 Jorg Schuler <jcsjcs at users.sourceforge.net>
 
        * src/file_itunesdb.c (read_extended_info): fixed valgrind

Modified: gtkpod/trunk/src/mp3file.c
===================================================================
--- gtkpod/trunk/src/mp3file.c  2008-08-23 18:04:30 UTC (rev 2112)
+++ gtkpod/trunk/src/mp3file.c  2008-08-31 02:02:16 UTC (rev 2113)
@@ -88,6 +88,7 @@
     gchar *lyrics;        /* does not appear to be the full lyrics --
                             only used to set the flag 'lyrics_flag'
                             of the Track structure */
+    gchar *albumartist;         /* Album artist  */
 };
 
 
@@ -1459,11 +1460,13 @@
     if ((id3tag = id3_file_tag(id3file)))
     {
        tag->title = id3_get_string (id3tag, ID3_FRAME_TITLE);
-       tag->artist = id3_get_string (id3tag, ID3_FRAME_GROUP);
+       tag->artist = id3_get_string (id3tag, ID3_FRAME_ARTIST);
        if (!tag->artist || !*tag->artist)
        {
            g_free (tag->artist);
-           tag->artist = id3_get_string (id3tag, ID3_FRAME_ARTIST);
+           tag->artist = id3_get_string (id3tag, ID3_FRAME_GROUP);
+       } else {
+           tag->albumartist = id3_get_string (id3tag, ID3_FRAME_GROUP);
        }
        tag->album = id3_get_string (id3tag, ID3_FRAME_ALBUM);
        tag->year = id3_get_string (id3tag, ID3_FRAME_YEAR);
@@ -2565,6 +2568,11 @@
            track->artist = filetag.artist;
        }
 
+       if (filetag.albumartist)
+       {
+           track->albumartist = filetag.albumartist;
+       }
+
        if (filetag.title)
        {
            track->title = filetag.title;

Modified: gtkpod/trunk/src/mp4file.c
===================================================================
--- gtkpod/trunk/src/mp4file.c  2008-08-23 18:04:30 UTC (rev 2112)
+++ gtkpod/trunk/src/mp4file.c  2008-08-31 02:02:16 UTC (rev 2113)
@@ -1,4 +1,4 @@
-/* Time-stamp: <2007-06-23 02:49:08 jcs>
+/* Time-stamp: <2008-08-31 11:00:33 jcs>
 |
 |  Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
 |  Part of the gtkpod project.
@@ -375,6 +375,22 @@
                        track->artist = charset_to_utf8 (value);
                        g_free(value);
                    }
+                   if (!track->artist || !*track->artist)
+                   {
+                       g_free (track->artist);
+                       track->artist = NULL;
+                       if (MP4GetMetadataAlbumArtist(mp4File, &value) && value 
!= NULL)
+                       {
+                           track->artist = charset_to_utf8 (value);
+                       }
+                   }
+                   else
+                   {
+                       if (MP4GetMetadataAlbumArtist(mp4File, &value) && value 
!= NULL)
+                       {
+                           track->albumartist = charset_to_utf8 (value);
+                       }
+                   }
                    if (MP4GetMetadataWriter(mp4File, &value) && value != NULL)
                    {
                        track->composer = charset_to_utf8 (value);
@@ -488,7 +504,7 @@
             * you have to delete all meta data before modifying
             * it. Therefore we have to read it first to avoid data
             * loss. (Bug present in mpeg4ip-1.0RC1.) */
-/*         gchar *m_name = NULL, *m_artist = NULL;
+/*         gchar *m_name = NULL, *m_artist = NULL, *m_albumartist = NULL;
            gchar *m_writer = NULL, *m_comment = NULL;
            gchar *m_year = NULL;
            gchar *m_album = NULL, *m_genre = NULL;*/
@@ -507,6 +523,7 @@
                                                                  &m_cpl);
 /*         MP4GetMetadataName (mp4File, &m_name);
            MP4GetMetadataArtist (mp4File, &m_artist);
+           MP4GetMetadataAlbumArtist (mp4File, &m_albumartist);
            MP4GetMetadataWriter (mp4File, &m_writer);
            MP4GetMetadataComment (mp4File, &m_comment);
            MP4GetMetadataYear (mp4File, &m_year);
@@ -524,6 +541,10 @@
            MP4SetMetadataArtist (mp4File, value);
            g_free (value);
 
+           value = charset_from_utf8 (track->albumartist);
+           MP4SetMetadataAlbumArtist (mp4File, value);
+           g_free (value);
+
            value = charset_from_utf8 (track->composer);
            MP4SetMetadataWriter (mp4File, value);
            g_free (value);
@@ -561,6 +582,7 @@
            if (m_covert)   MP4SetMetadataCoverArt (mp4File, m_covert, m_size);
 /*         g_free (m_name);
            g_free (m_artist);
+           g_free (m_albumartist);
            g_free (m_writer);
            g_free (m_comment);
            g_free (m_year);


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to