banshee r3697 - in trunk/banshee: . libbanshee src/Backends/Banshee.GStreamer src/Backends/Banshee.GStreamer/Banshee.GStreamer src/Core/Banshee.Widgets src/Extensions/Banshee.AudioCd/Banshee.AudioCd src/Extensions/Banshee.Daap src/Libraries/MusicBrainz



Author: abock
Date: Mon Apr  7 01:27:20 2008
New Revision: 3697
URL: http://svn.gnome.org/viewvc/banshee?rev=3697&view=rev

Log:
2008-04-06  Aaron Bockover  <abock gnome org>

    * libbanshee/banshee-gst.c: Added banshee_is_debugging and
    banshee_get_version_number functions; gstreamer_initialize now takes a
    debugging argument that banshee_is_debugging will return

    * libbanshee/banshee-ripper.c: Save the GstTagList that is passed to
    the rip function to the encoder element; fixed bug with setting the
    encoder version tag

    * libbanshee/banshee-tagger.c: Added bt_tag_list_add_date and
    bt_tag_list_dump, which will dump the entire contents of a GstTagList
    for debugging purposes

    * src/Backends/Banshee.GStreamer/Banshee.GStreamer/AudioCdRipper.cs:
    Delete a ripped file if the file was not finished

    * src/Backends/Banshee.GStreamer/Banshee.GStreamer/Service.cs:
    Pass the debug mode to libbanshee

    * src/Backends/Banshee.GStreamer/Banshee.GStreamer/TagList.cs:
    Added AddDate and AddYear functions, binding bt_tag_list_add_date

    * src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDiscModel.cs:
    Read the disc number and release date from musicbrainz and set it on
    the disc tracks so this information will be written to the output files



Added:
   trunk/banshee/libbanshee/banshee-gst.c
   trunk/banshee/libbanshee/banshee-gst.h
   trunk/banshee/libbanshee/banshee-tagger.h
Removed:
   trunk/banshee/libbanshee/gst-misc-0.10.c
Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/libbanshee/Makefile.am
   trunk/banshee/libbanshee/banshee-ripper.c
   trunk/banshee/libbanshee/banshee-tagger.c
   trunk/banshee/libbanshee/libbanshee.mdp
   trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer.mdp
   trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/AudioCdRipper.cs
   trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/Service.cs
   trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/TagList.cs
   trunk/banshee/src/Core/Banshee.Widgets/Banshee.Widgets.mdp
   trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDiscModel.cs
   trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap.mdp
   trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz.mdp

Modified: trunk/banshee/libbanshee/Makefile.am
==============================================================================
--- trunk/banshee/libbanshee/Makefile.am	(original)
+++ trunk/banshee/libbanshee/Makefile.am	Mon Apr  7 01:27:20 2008
@@ -13,6 +13,7 @@
 
 libbanshee_la_LDFLAGS = -avoid-version -module
 libbanshee_la_SOURCES =  \
+	banshee-gst.c \
 	banshee-player.c \
 	banshee-player-cdda.c \
 	banshee-player-equalizer.c \
@@ -21,15 +22,16 @@
 	banshee-player-video.c \
 	banshee-ripper.c \
 	banshee-tagger.c \
-	gst-misc-0.10.c \
 	gst-transcode-0.10.c
 
 noinst_HEADERS =  \
+	banshee-gst.h \
 	banshee-player-cdda.h \
 	banshee-player-missing-elements.h \
 	banshee-player-pipeline.h \
 	banshee-player-private.h \
-	banshee-player-video.h
+	banshee-player-video.h \
+	banshee-tagger.h
 
 libbanshee_la_LIBADD = \
 	$(LIBBANSHEE_LIBS) \

Added: trunk/banshee/libbanshee/banshee-gst.c
==============================================================================
--- (empty file)
+++ trunk/banshee/libbanshee/banshee-gst.c	Mon Apr  7 01:27:20 2008
@@ -0,0 +1,108 @@
+//
+// banshee-gst.c
+//
+// Author:
+//   Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2005-2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+
+#include <gst/gst.h>
+
+#include "banshee-gst.h"
+
+#ifdef HAVE_GST_PBUTILS
+#  include <gst/pbutils/pbutils.h>
+#endif
+
+static gboolean gstreamer_initialized = FALSE;
+static gboolean banshee_debugging;
+static gint banshee_version = -1;
+
+void gstreamer_initialize (gboolean debugging)
+{
+    if (gstreamer_initialized) {
+        return;
+    }
+    
+    banshee_debugging = debugging;
+
+    gst_init (NULL, NULL);
+    
+    #ifdef HAVE_GST_PBUTILS
+    gst_pb_utils_init ();
+    #endif
+    
+    gstreamer_initialized = TRUE;
+}
+
+gboolean 
+gstreamer_test_pipeline (gchar *pipeline)
+{
+    GstElement *element = NULL;
+    GError *error = NULL;
+    
+    element = gst_parse_launch (pipeline, &error);
+
+    if (element != NULL) {
+        gst_object_unref (GST_OBJECT (element));
+    }
+    
+    return error == NULL;
+}
+
+gboolean
+banshee_is_debugging ()
+{
+    return banshee_debugging;
+}
+
+guint
+banshee_get_version_number ()
+{
+    guint16 major = 0, minor = 0, micro = 0;
+    
+    if (banshee_version >= 0) {
+        return (guint)banshee_version;
+    }
+    
+    if (sscanf (VERSION, "%" G_GUINT16_FORMAT ".%" G_GUINT16_FORMAT ".%" G_GUINT16_FORMAT, 
+        &major, &minor, &micro) == 3) {
+        banshee_version = ((guint8)major << 16) | ((guint8)minor << 8) | ((guint8)micro);
+        // major = (banshee_version >> 16)
+        // minor = (banshee_version >> 8) & 0x00FF
+        // micro = banshee_version & 0x0000FF
+    } else {
+         banshee_version = 0;
+    }   
+    
+    return (guint)banshee_version;
+}

Added: trunk/banshee/libbanshee/banshee-gst.h
==============================================================================
--- (empty file)
+++ trunk/banshee/libbanshee/banshee-gst.h	Mon Apr  7 01:27:20 2008
@@ -0,0 +1,37 @@
+//
+// banshee-gst.h
+//
+// Author:
+//   Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#ifndef _BANSHEE_GST_H
+#define _BANSHEE_GST_H
+
+#include <glib.h>
+
+gboolean  banshee_is_debugging ();
+guint     banshee_get_version_number ();
+
+#endif /* _BANSHEE_GST_H */

Modified: trunk/banshee/libbanshee/banshee-ripper.c
==============================================================================
--- trunk/banshee/libbanshee/banshee-ripper.c	(original)
+++ trunk/banshee/libbanshee/banshee-ripper.c	Mon Apr  7 01:27:20 2008
@@ -31,13 +31,10 @@
 #endif
 
 #include <string.h>
-
-#include <glib.h>
 #include <glib/gi18n.h>
-#include <glib/gstdio.h>
 
-#include <gst/gst.h>
-#include <gst/tag/tag.h>
+#include "banshee-gst.h"
+#include "banshee-tagger.h"
 
 typedef struct BansheeRipper BansheeRipper;
 
@@ -283,8 +280,6 @@
         gst_object_unref (GST_OBJECT (ripper->pipeline));
         ripper->pipeline = NULL;
     }
-    
-    g_remove (ripper->output_uri);
 }
 
 void
@@ -329,22 +324,39 @@
     bin_iterator = gst_bin_iterate_all_by_interface (GST_BIN (ripper->encoder), GST_TYPE_TAG_SETTER);
     while (!iterate_done) {
         switch (gst_iterator_next (bin_iterator, (gpointer)&bin_element)) {
-            case GST_ITERATOR_OK:
-                gst_tag_setter_add_tags (GST_TAG_SETTER (bin_element),
-                    GST_TAG_MERGE_APPEND,
-                    GST_TAG_ENCODER, _("Banshee"),
-                    GST_TAG_ENCODER_VERSION, VERSION,
+            case GST_ITERATOR_OK: {
+                GstTagSetter *tag_setter = GST_TAG_SETTER (bin_element);
+                if (tag_setter == NULL) {
+                    break;
+                }
+                
+                gst_tag_setter_add_tags (tag_setter, GST_TAG_MERGE_REPLACE_ALL,
+                    GST_TAG_ENCODER, "Banshee " VERSION,
+                    GST_TAG_ENCODER_VERSION, banshee_get_version_number (),
                     NULL);
                     
+                if (tags != NULL) {
+                    gst_tag_setter_merge_tags (tag_setter, tags, GST_TAG_MERGE_APPEND);
+                }
+                
+                if (banshee_is_debugging ()) {
+                    bt_tag_list_dump (gst_tag_setter_get_tag_list (tag_setter));
+                }
+                    
                 can_tag = TRUE;    
                 gst_object_unref (bin_element);
                 break;
-            case GST_ITERATOR_RESYNC:
+            }
+            
+            case GST_ITERATOR_RESYNC: {
                 gst_iterator_resync (bin_iterator);
                 break;
-            default:
+            }
+            
+            default: {
                 iterate_done = TRUE;
                 break;
+            }
         }
     }
     

Modified: trunk/banshee/libbanshee/banshee-tagger.c
==============================================================================
--- trunk/banshee/libbanshee/banshee-tagger.c	(original)
+++ trunk/banshee/libbanshee/banshee-tagger.c	Mon Apr  7 01:27:20 2008
@@ -30,8 +30,37 @@
 #  include "config.h"
 #endif
 
-#include <gst/gst.h>
-#include <gst/tag/tag.h>
+#include <glib/gstdio.h>
+
+#include "banshee-tagger.h"
+
+// ---------------------------------------------------------------------------
+// Private Functions
+// ---------------------------------------------------------------------------
+
+static void
+bt_tag_list_foreach (const GstTagList *list, const gchar *tag, gpointer userdata)
+{
+    gint i, tag_count;
+    
+    tag_count  = gst_tag_list_get_tag_size (list, tag);
+    g_printf ("Found %d '%s' tag%s:", tag_count, tag, tag_count == 1 ? "" : "s");
+    for (i = 0; i < tag_count; i++) {
+        const GValue *value;
+        gchar *value_str;
+        gchar *padding = tag_count == 1 ? " " : "    ";
+        
+        value = gst_tag_list_get_value_index (list, tag, i);
+        if (value == NULL) {
+            g_printf ("%s(null)\n", padding);
+            continue;
+        }
+        
+        value_str = g_strdup_value_contents (value);
+        g_printf ("%s%s\n", padding, value_str);
+        g_free (value_str);
+    }
+}
 
 // ---------------------------------------------------------------------------
 // Internal Functions
@@ -54,3 +83,25 @@
 {
     gst_tag_list_add_values (list, GST_TAG_MERGE_REPLACE_ALL, tag_name, value, NULL);
 }
+
+void
+bt_tag_list_add_date (GstTagList *list, gint year, gint month, gint day)
+{
+    GDate *date;
+    
+    if (!g_date_valid_dmy (day, month, year)) {
+        return;
+    }
+    
+    date = g_date_new ();
+    g_date_clear (date, 1);
+    g_date_set_dmy (date, day, month, year);
+    
+    gst_tag_list_add (list, GST_TAG_MERGE_REPLACE_ALL, GST_TAG_DATE, date, NULL);
+}
+
+void
+bt_tag_list_dump (const GstTagList *list)
+{
+    gst_tag_list_foreach (list, bt_tag_list_foreach, NULL);
+}

Added: trunk/banshee/libbanshee/banshee-tagger.h
==============================================================================
--- (empty file)
+++ trunk/banshee/libbanshee/banshee-tagger.h	Mon Apr  7 01:27:20 2008
@@ -0,0 +1,37 @@
+//
+// banshee-tagger.h
+//
+// Author:
+//   Aaron Bockover <abockover novell com>
+//
+// Copyright (C) 2008 Novell, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+#ifndef _BANSHEE_TAGGER_H
+#define _BANSHEE_TAGGER_H
+
+#include <gst/gst.h>
+#include <gst/tag/tag.h>
+
+void bt_tag_list_dump (const GstTagList *list);
+
+#endif /* _BANSHEE_TAGGER_H */

Modified: trunk/banshee/libbanshee/libbanshee.mdp
==============================================================================
--- trunk/banshee/libbanshee/libbanshee.mdp	(original)
+++ trunk/banshee/libbanshee/libbanshee.mdp	Mon Apr  7 01:27:20 2008
@@ -9,7 +9,7 @@
   </Configurations>
   <Contents>
     <File name="banshee-ripper.c" subtype="Code" buildaction="Compile" />
-    <File name="gst-misc-0.10.c" subtype="Code" buildaction="Compile" />
+    <File name="banshee-gst.c" subtype="Code" buildaction="Compile" />
     <File name="banshee-player.c" subtype="Code" buildaction="Compile" />
     <File name="gst-transcode-0.10.c" subtype="Code" buildaction="Compile" />
     <File name="banshee-player-private.h" subtype="Code" buildaction="Nothing" />
@@ -23,6 +23,8 @@
     <File name="banshee-player-pipeline.c" subtype="Code" buildaction="Compile" />
     <File name="banshee-player-pipeline.h" subtype="Code" buildaction="Nothing" />
     <File name="banshee-tagger.c" subtype="Code" buildaction="Compile" />
+    <File name="banshee-tagger.h" subtype="Code" buildaction="Nothing" />
+    <File name="banshee-gst.h" subtype="Code" buildaction="Nothing" />
   </Contents>
   <compiler ctype="GccCompiler" />
   <MonoDevelop.Autotools.MakefileInfo IntegrationEnabled="True" RelativeMakefileName="Makefile.am">

Modified: trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer.mdp
==============================================================================
--- trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer.mdp	(original)
+++ trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer.mdp	Mon Apr  7 01:27:20 2008
@@ -1,4 +1,4 @@
-<Project name="Banshee.GStreamer" fileversion="2.0" language="C#" clr-version="Net_2_0" UseParentDirectoryAsNamespace="True" ctype="DotNetProject">
+<Project name="Banshee.GStreamer" fileversion="2.0" UseParentDirectoryAsNamespace="True" language="C#" clr-version="Net_2_0" ctype="DotNetProject">
   <Configurations active="Debug">
     <Configuration name="Debug" ctype="DotNetProjectConfiguration">
       <Output directory="../../../bin" assemblyKeyFile="." assembly="Banshee.MediaEngine.GStreamer" />

Modified: trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/AudioCdRipper.cs
==============================================================================
--- trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/AudioCdRipper.cs	(original)
+++ trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/AudioCdRipper.cs	Mon Apr  7 01:27:20 2008
@@ -27,7 +27,6 @@
 //
 
 using System;
-using System.IO;
 using System.Threading;
 using System.Runtime.InteropServices;
 using Mono.Unix;
@@ -63,6 +62,7 @@
                 Profile profile = ServiceManager.MediaProfileManager.GetConfiguredActiveProfile ("cd-importing");
                 if (profile != null) {
                     encoder_pipeline = profile.Pipeline.GetProcessById ("gstreamer");
+                    output_extension = profile.OutputFileExtension;
                 }
                 
                 if (String.IsNullOrEmpty (encoder_pipeline)) {
@@ -93,6 +93,10 @@
         
         public void Finish ()
         {
+            if (output_path != null) {
+                System.IO.File.Delete (output_path);
+            }
+        
             TrackReset ();
             
             encoder_pipeline = null;
@@ -119,10 +123,10 @@
             current_track = track;
             
             using (TagList tags = new TagList (track)) {
-                output_path = Path.ChangeExtension (outputUri.LocalPath, output_extension); 
-                br_rip_track (handle, trackIndex + 1, output_path, tags.Handle, out taggingSupported);
-                
+                output_path = String.Format ("{0}.{1}", outputUri.LocalPath, output_extension);
                 Log.DebugFormat ("GStreamer ripping track {0} to {1}", trackIndex, output_path);
+                
+                br_rip_track (handle, trackIndex + 1, output_path, tags.Handle, out taggingSupported);
             }
         }
         
@@ -157,7 +161,12 @@
         
         private void OnNativeFinished (IntPtr ripper)
         {
-            OnTrackFinished (current_track, new SafeUri (output_path));
+            SafeUri uri = new SafeUri (output_path);
+            TrackInfo track = current_track;
+            
+            TrackReset ();
+            
+            OnTrackFinished (track, uri);
         }
         
         private void OnNativeError (IntPtr ripper, IntPtr error, IntPtr debug)

Modified: trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/Service.cs
==============================================================================
--- trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/Service.cs	(original)
+++ trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/Service.cs	Mon Apr  7 01:27:20 2008
@@ -44,11 +44,11 @@
         }
         
         [DllImport ("libbanshee")]
-        private static extern void gstreamer_initialize ();
+        private static extern void gstreamer_initialize (bool debugging);
         
         void IExtensionService.Initialize ()
         {
-            gstreamer_initialize ();
+            gstreamer_initialize (Banshee.Base.ApplicationContext.Debugging);
             
             MediaProfileManager profile_manager = ServiceManager.MediaProfileManager;
             if (profile_manager != null) {

Modified: trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/TagList.cs
==============================================================================
--- trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/TagList.cs	(original)
+++ trunk/banshee/src/Backends/Banshee.GStreamer/Banshee.GStreamer/TagList.cs	Mon Apr  7 01:27:20 2008
@@ -57,7 +57,8 @@
             
             AddTag (CommonTags.TrackNumber, (uint)track.TrackNumber);
             AddTag (CommonTags.TrackCount, (uint)track.TrackCount);
-            AddTag (CommonTags.Disc, (uint)track.Disc);
+            AddTag (CommonTags.AlbumVolumeNumber, (uint)track.Disc);
+            AddYear (track.Year);
             
             AddTag (CommonTags.Composer, track.Composer);
             AddTag (CommonTags.Copyright, track.Copyright);
@@ -78,6 +79,18 @@
             }
         }
         
+        public void AddDate (DateTime date)
+        {
+            bt_tag_list_add_date (Handle, date.Year, date.Month, date.Day);
+        }
+        
+        public void AddYear (int year)
+        {
+            if (year > 1) {
+                bt_tag_list_add_date (Handle, year, 1, 1);
+            }
+        }
+        
         public void AddTag (string tagName, object value)
         {
             GLib.Value g_value = new GLib.Value (value);
@@ -106,5 +119,8 @@
         
         [DllImport ("libbanshee")]
         private static extern void bt_tag_list_add_value (HandleRef tag_list, string tag_name, ref GLib.Value value);
+        
+        [DllImport ("libbanshee")]
+        private static extern void bt_tag_list_add_date (HandleRef tag_list, int year, int month, int day);
     }
 }

Modified: trunk/banshee/src/Core/Banshee.Widgets/Banshee.Widgets.mdp
==============================================================================
--- trunk/banshee/src/Core/Banshee.Widgets/Banshee.Widgets.mdp	(original)
+++ trunk/banshee/src/Core/Banshee.Widgets/Banshee.Widgets.mdp	Mon Apr  7 01:27:20 2008
@@ -1,4 +1,4 @@
-<Project name="Banshee.Widgets" fileversion="2.0" language="C#" clr-version="Net_2_0" UseParentDirectoryAsNamespace="True" ctype="DotNetProject">
+<Project name="Banshee.Widgets" fileversion="2.0" UseParentDirectoryAsNamespace="True" language="C#" clr-version="Net_2_0" ctype="DotNetProject">
   <Configurations active="Debug">
     <Configuration name="Debug" ctype="DotNetProjectConfiguration">
       <Output directory="../../../bin" assembly="Banshee.Widgets" />

Modified: trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDiscModel.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDiscModel.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.AudioCd/Banshee.AudioCd/AudioCdDiscModel.cs	Mon Apr  7 01:27:20 2008
@@ -79,6 +79,7 @@
                 AudioCdTrackInfo track = new AudioCdTrackInfo (this, volume.DeviceNode, i);
                 track.TrackNumber = i + 1;
                 track.TrackCount = n;
+                track.Disc = 1;
                 track.Duration = TimeSpan.FromSeconds (mb_disc.TrackDurations[i]);
                 track.ArtistName = Catalog.GetString ("Unknown Artist");
                 track.AlbumTitle = Catalog.GetString ("Unknown Album");
@@ -107,13 +108,46 @@
             
             disc_title = release.Title;
             
+            int disc_number = 1;
             int i = 0;
             
+            foreach (Disc disc in release.Discs) {
+                i++;
+                if (disc.Id == mb_disc.Id) {
+                    disc_number = i;
+                }
+            }
+            
+            DateTime release_date = DateTime.MinValue;
+            int release_event_index = -1;
+            
+            for (i = 0; i < release.Events.Count; i++) {
+                // FIXME: This is sort of lame, but from what I've seen, 
+                // the US releases generally contain more info
+                if (release.Events[i].Country == "US") {
+                    release_event_index = i;
+                    break;
+                }
+            }
+            
+            if (release_event_index >= 0) {
+                release_date = DateTime.Parse (release.Events[release_event_index].Date, 
+                    ApplicationContext.InternalCultureInfo);
+            }
+            
+            i = 0;
+            
             foreach (Track track in release.Tracks) {
-                // FIXME: Gather more details from MB to save to the DB
                 this[i].TrackTitle = track.Title;
                 this[i].ArtistName = track.Artist.Name;
                 this[i].AlbumTitle = release.Title;
+                this[i].Disc = disc_number;
+                
+                if (!release_date.Equals (DateTime.MinValue)) {
+                    // FIXME: We need to change the Year column to a Release Date column
+                    this[i].Year = release_date.Year;
+                }
+                
                 i++;
             }
             

Modified: trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap.mdp
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap.mdp	(original)
+++ trunk/banshee/src/Extensions/Banshee.Daap/Banshee.Daap.mdp	Mon Apr  7 01:27:20 2008
@@ -1,4 +1,4 @@
-<Project name="Banshee.Daap" fileversion="2.0" language="C#" clr-version="Net_2_0" UseParentDirectoryAsNamespace="True" ctype="DotNetProject">
+<Project name="Banshee.Daap" fileversion="2.0" UseParentDirectoryAsNamespace="True" language="C#" clr-version="Net_2_0" ctype="DotNetProject">
   <Configurations active="Debug">
     <Configuration name="Debug" ctype="DotNetProjectConfiguration">
       <Output directory="../../../bin" assemblyKeyFile="." assembly="Banshee.Daap" />

Modified: trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz.mdp
==============================================================================
--- trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz.mdp	(original)
+++ trunk/banshee/src/Libraries/MusicBrainz/MusicBrainz.mdp	Mon Apr  7 01:27:20 2008
@@ -40,4 +40,4 @@
     <AsmRefVar />
     <ProjectRefVar />
   </MonoDevelop.Autotools.MakefileInfo>
-</Project>
+</Project>
\ No newline at end of file



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