[banshee] Make sure Music attribute unset for videos/podcasts



commit 5f157c4f53576cd89455508c34efd400e9e75694
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Wed Jun 2 11:39:17 2010 -0700

    Make sure Music attribute unset for videos/podcasts
    
    Fixes bgo#584992

 .../Banshee.Core/Banshee.Streaming/StreamTagger.cs |    5 ++++-
 .../Banshee.Database/BansheeDbFormatMigrator.cs    |   14 +++++++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs b/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs
index ea4dd40..23231e5 100644
--- a/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs
+++ b/src/Core/Banshee.Core/Banshee.Streaming/StreamTagger.cs
@@ -118,6 +118,9 @@ namespace Banshee.Streaming
             if (!track.HasAttribute (TrackMediaAttributes.VideoStream) &&
                 !track.HasAttribute (TrackMediaAttributes.Podcast)) {
                 track.MediaAttributes |= TrackMediaAttributes.Music;
+            } else {
+                // If it was already set, unset it
+                track.MediaAttributes &= ~TrackMediaAttributes.Music;
             }
         }
 
@@ -196,7 +199,7 @@ namespace Banshee.Streaming
             } else {
                 track.MediaAttributes = TrackMediaAttributes.AudioStream;
                 if (track.Uri != null && VideoExtensions.IsMatchingFile (track.Uri.AbsoluteUri)) {
-                    track.MediaAttributes = TrackMediaAttributes.VideoStream;
+                    track.MediaAttributes |= TrackMediaAttributes.VideoStream;
                 }
             }
 
diff --git a/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs b/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
index 96b61e5..fad72fe 100644
--- a/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
+++ b/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
@@ -56,7 +56,7 @@ namespace Banshee.Database
         // NOTE: Whenever there is a change in ANY of the database schema,
         //       this version MUST be incremented and a migration method
         //       MUST be supplied to match the new version number
-        protected const int CURRENT_VERSION = 41;
+        protected const int CURRENT_VERSION = 42;
         protected const int CURRENT_METADATA_VERSION = 7;
 
 #region Migration Driver
@@ -928,6 +928,18 @@ namespace Banshee.Database
             return true;
         }
 
+        [DatabaseVersion (42)]
+        private bool Migrate_42 ()
+        {
+            // Unset the Music attribute for any videos or podcasts
+            connection.Execute (
+                @"UPDATE CoreTracks SET Attributes = Attributes & ? WHERE (Attributes & ?) != 0",
+                (int)(~TrackMediaAttributes.Music),
+                (int)(TrackMediaAttributes.VideoStream | TrackMediaAttributes.Podcast)
+            );
+            return true;
+        }
+
 
 #pragma warning restore 0169
 



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