Revision: 1553
          http://gtkpod.svn.sourceforge.net/gtkpod/?rev=1553&view=rev
Author:   jcsjcs
Date:     2007-06-17 08:51:24 -0700 (Sun, 17 Jun 2007)

Log Message:
-----------
        * src/mp4file.c
          src/mp3file.c: read/write tempo (BPM) value from/to tags.

          src/flacfile.c
          src/oggfile.c: read tempo (BPM) value from tags (not sure
          if this is correct)

          src/file.c (copy_new_info): copy BPM after having read it.

Modified Paths:
--------------
    gtkpod/trunk/ChangeLog_detailed
    gtkpod/trunk/src/file.c
    gtkpod/trunk/src/flacfile.c
    gtkpod/trunk/src/mp3file.c
    gtkpod/trunk/src/mp4file.c
    gtkpod/trunk/src/oggfile.c

Modified: gtkpod/trunk/ChangeLog_detailed
===================================================================
--- gtkpod/trunk/ChangeLog_detailed     2007-06-17 15:27:05 UTC (rev 1552)
+++ gtkpod/trunk/ChangeLog_detailed     2007-06-17 15:51:24 UTC (rev 1553)
@@ -1,5 +1,14 @@
 2007-06-17 Jorg Schuler <jcsjcs at users.sourceforge.net>
 
+       * src/mp4file.c
+         src/mp3file.c: read/write tempo (BPM) value from/to tags.
+
+         src/flacfile.c
+         src/oggfile.c: read tempo (BPM) value from tags (not sure
+         if this is correct)
+
+         src/file.c (copy_new_info): copy BPM after having read it.
+
        * README: some changes initiated by Daniele Forsi.
 
        * src/info.c (gtkpod_statusbar_message): fixed memory leak --

Modified: gtkpod/trunk/src/file.c
===================================================================
--- gtkpod/trunk/src/file.c     2007-06-17 15:27:05 UTC (rev 1552)
+++ gtkpod/trunk/src/file.c     2007-06-17 15:51:24 UTC (rev 1553)
@@ -873,6 +873,7 @@
     to->mediatype = from->mediatype;
     to->lyrics_flag = from->lyrics_flag;
     to->movie_flag = from->movie_flag;
+    to->BPM = from->BPM;
 }
 
 /* Updates mserv data (rating only) of @track using filename @name to

Modified: gtkpod/trunk/src/flacfile.c
===================================================================
--- gtkpod/trunk/src/flacfile.c 2007-06-17 15:27:05 UTC (rev 1552)
+++ gtkpod/trunk/src/flacfile.c 2007-06-17 15:51:24 UTC (rev 1553)
@@ -93,13 +93,16 @@
                     }
                     if (g_ascii_strncasecmp("CDS=", tag, 4) == 0) {
                         track->cds = atoi (tag  + 4);
+                   }
+                   /* I'm not sure if "BPM=" is correct */ 
+                    if (g_ascii_strncasecmp("BPM=", tag, 4) == 0) {
+                        track->BPM = atoi (tag  + 4);
                     }
                 }
             }
 
             FLAC__metadata_object_delete (tags);
        }
-        /* TODO: immediate conversion if thread ? */
     }
 
     return track;

Modified: gtkpod/trunk/src/mp3file.c
===================================================================
--- gtkpod/trunk/src/mp3file.c  2007-06-17 15:27:05 UTC (rev 1552)
+++ gtkpod/trunk/src/mp3file.c  2007-06-17 15:51:24 UTC (rev 1553)
@@ -1,4 +1,4 @@
-/* Time-stamp: <2007-04-19 20:18:03 jcs>
+/* Time-stamp: <2007-06-18 00:48:53 jcs>
 |
 |  Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
 |  Part of the gtkpod project.
@@ -66,7 +66,6 @@
     gchar *comment;        /* Comment */
     gchar *composer;      /* Composer */
     guint32 songlen;       /* Length of file in ms */
-    /* CD/disc number handling */
     gchar *cdnostring;    /* Position of disc in the album */
     gchar *cdno_total;    /* The number of discs in the album (ex: 1/2) */
     gchar *compilation;   /* The track is a member of a compilation */
@@ -75,6 +74,7 @@
     gchar *podcastrss;
     gchar *time_released;
     gchar *subtitle;
+    gchar *BPM;           /* beats per minute */
     gchar *lyrics;        /* does not appear to be the full lyrics --
                             only used to set the flag 'lyrics_flag'
                             of the Track structure */
@@ -1423,6 +1423,7 @@
        tag->podcastrss = id3_get_string (id3tag, "YWFD");
        tag->description = id3_get_string (id3tag, "YTDS");
        tag->time_released = id3_get_string (id3tag, "YTDR");
+       tag->BPM = id3_get_string (id3tag, "TBPM");
 
        string = id3_get_string (id3tag, "TLEN");
        if (string)
@@ -1592,6 +1593,10 @@
        id3_set_string(id3tag, ID3_FRAME_YEAR, string1, encoding);
        g_free(string1);
 
+       string1 = g_strdup_printf("%d", track->BPM);
+       id3_set_string(id3tag, "TBPM", string1, encoding);
+       g_free(string1);
+
        if (track->tracks)
            string1 = g_strdup_printf ("%d/%d",
                                       track->track_nr, track->tracks);
@@ -2305,6 +2310,16 @@
            g_free (filetag.compilation);
        }
 
+       if (filetag.BPM == NULL)
+       {
+           track->BPM = 0;
+       }
+       else
+       {
+           track->BPM = atoi(filetag.BPM);
+           g_free (filetag.BPM);
+       }
+
        if (filetag.lyrics)
        {
            track->lyrics_flag = 0x01;

Modified: gtkpod/trunk/src/mp4file.c
===================================================================
--- gtkpod/trunk/src/mp4file.c  2007-06-17 15:27:05 UTC (rev 1552)
+++ gtkpod/trunk/src/mp4file.c  2007-06-17 15:51:24 UTC (rev 1553)
@@ -1,4 +1,4 @@
-/* Time-stamp: <2006-10-15 23:48:05 jcs>
+/* Time-stamp: <2007-06-18 00:48:52 jcs>
 |
 |  Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
 |  Part of the gtkpod project.
@@ -75,6 +75,8 @@
    guint16 samplerate;        /+ e.g.: CD is 44100     +/
    guint32 peak_signal;              /+ LAME Peak Signal * 0x800000         +/
    gboolean compilation;      /+ Track is part of a compilation CD   +/
+   gboolean lyrics_flag;
+   gint16 bpm;
 
    If prefs_get_int("readtags") returns FALSE you only should fill in
    tracklen, bitrate, samplerate, soundcheck and filetype
@@ -347,6 +349,10 @@
                        track->genre = charset_to_utf8 (value);
                        g_free(value);
                    }
+                   if (MP4GetMetadataTempo (mp4File, &numvalue))
+                   {
+                       track->BPM = numvalue;
+                   }
                }
                mp4_scan_soundcheck (mp4File, track);
                audio_or_video_found = TRUE;
@@ -452,6 +458,8 @@
 
            MP4SetMetadataDisk (mp4File, track->cd_nr, track->cds);
 
+           MP4SetMetadataTempo (mp4File, track->BPM);
+
            value = charset_from_utf8 (track->genre);
            MP4SetMetadataGenre (mp4File, value);
            g_free (value);

Modified: gtkpod/trunk/src/oggfile.c
===================================================================
--- gtkpod/trunk/src/oggfile.c  2007-06-17 15:27:05 UTC (rev 1552)
+++ gtkpod/trunk/src/oggfile.c  2007-06-17 15:51:24 UTC (rev 1553)
@@ -1,4 +1,4 @@
-/* Time-stamp: <2007-01-19 00:56:31 jcs>
+/* Time-stamp: <2007-06-18 00:48:50 jcs>
 |
 |  Copyright (C) 2007 Marc d[r]eadlock <m.dreadlock at gmail com>
 |  Part of the gtkpod project.
@@ -122,6 +122,10 @@
                     if ((str=vorbis_comment_query(vc,"cds",0))!=NULL){
                        track->cds = atoi(str);
                     }
+                   /* I'm not sure if "bpm" is correct */ 
+                    if ((str=vorbis_comment_query(vc,"bpm",0))!=NULL){
+                       track->BPM = atoi(str);
+                    }
                 }
                     
             }


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 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/
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to