[Banshee-List] iPod SkipWhenShuffle and RememberPosition patch



I've got 3/4 of a patch to let Banshee read/set the SkipWhenShuffle and RememberPosition bits for iPods. However, I'm obviously missing some sort of bindery-magic somewhere, as the bits aren't getting saved to the database nor to the iPod.

Can someone point me in the right direction to go next? (Even a reference to a similar patch would be nice.)

Thanks!

(This version of the patch doesn't have Banshee actually pay attention to those bits, it just sees and sets them. Presumably, I'd need to add the extra magic to have Banshee actually pay attention to them. If I can grok enough of the plugin architecture, I'd also like to have a plugin that auto-sets those bits when importing tracks more than some set length, such as 30 minutes, or for podcasts.)

-R
Index: src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodTrackInfo.cs
===================================================================
--- src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodTrackInfo.cs    (revision 4908)
+++ src/Dap/Banshee.Dap.Ipod/Banshee.Dap.Ipod/IpodTrackInfo.cs    (working copy)
@@ -89,6 +89,8 @@
                 TrackTitle = track.TrackTitle;
                 Year = track.Year;
                 MediaAttributes = track.MediaAttributes;
+                SkipWhenShuffle = track.SkipWhenShuffle;
+                RememberPosition = track.RememberPosition;
             }
             
             CanSaveToDatabase = true;
@@ -127,6 +129,8 @@
             TrackTitle = String.IsNullOrEmpty (track.Title) ? null : track.Title;
             //ReleaseDate = track.DateReleased;
             Year = track.Year;
+            SkipWhenShuffle = track.SkipWhenShuffle;
+            RememberPosition = track.RememberPosition;
             
             switch (track.Rating) {
                 case IPod.TrackRating.One:   rating = 1; break;
@@ -204,6 +208,8 @@
             track.TrackNumber = TrackNumber;
             track.Year = Year;
             //track.DateReleased = ReleaseDate;
+            track.SkipWhenShuffle = SkipWhenShuffle;
+            track.RememberPosition = RememberPosition;
             
             track.Album = AlbumTitle;
             track.Artist = ArtistName;
Index: src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/ExtraTrackDetailsPage.cs
===================================================================
--- src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/ExtraTrackDetailsPage.cs    (revision 4908)
+++ src/Core/Banshee.ThickClient/Banshee.Gui.TrackEditor/ExtraTrackDetailsPage.cs    (working copy)
@@ -97,6 +97,26 @@
                 delegate (EditorTrackInfo track, Widget widget) { ((TextViewEntry)widget).Text = track.Comment; },
                 delegate (EditorTrackInfo track, Widget widget) { track.Comment = ((TextViewEntry)widget).Text; }
             );
+
+            HBox box2 = new HBox ();
+            box2.Spacing = 12;
+            box2.Show();
+            PackStart(box2, false, false, 0);
+            
+            AddField (box2, new CheckButton("Skip when shuffling"),
+                Catalog.GetString ("Set all shuffle-skips to this value"),
+                null,
+                delegate (EditorTrackInfo track, Widget widget) { ((CheckButton)widget).Active = track.SkipWhenShuffle; },
+                delegate (EditorTrackInfo track, Widget widget) { track.SkipWhenShuffle = ((CheckButton)widget).Active; }
+            );
+            
+            AddField (box2, new CheckButton("Remember position"),
+                Catalog.GetString ("Set all position memory to this value"),
+                null,
+                delegate (EditorTrackInfo track, Widget widget) { ((CheckButton)widget).Active = track.RememberPosition; },
+                delegate (EditorTrackInfo track, Widget widget) { track.RememberPosition = ((CheckButton)widget).Active; }
+            );
+            
         }
     }
 }
Index: src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
===================================================================
--- src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs    (revision 4908)
+++ src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs    (working copy)
@@ -579,6 +579,18 @@
                 playback_error = value; 
             }
         }
+        
+        [DatabaseColumn ("SkipWhenShuffle")]
+        public override bool SkipWhenShuffle {
+            get { return base.SkipWhenShuffle; }
+            set { base.SkipWhenShuffle = value; }
+        }
+        
+        [DatabaseColumn ("RememberPosition")]
+        public override bool RememberPosition {
+            get { return base.RememberPosition; }
+            set { base.RememberPosition = value; }
+        }
 
         private void UpdateUri ()
         {
Index: src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs
===================================================================
--- src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs    (revision 4908)
+++ src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs    (working copy)
@@ -98,6 +98,9 @@
         private int skip_count;
         private DateTime last_played;
         private DateTime last_skipped;
+        
+        private bool skip_when_shuffle;
+        private bool remember_position;
         
         private StreamPlaybackError playback_error = StreamPlaybackError.None;
 
@@ -420,6 +423,18 @@
             get { return last_skipped; }
             set { last_skipped = value; }
         }
+        
+        [Exportable]
+        public virtual bool SkipWhenShuffle {
+            get { return skip_when_shuffle; }
+            set { skip_when_shuffle = value; }
+        }
+        
+        [Exportable]
+        public virtual bool RememberPosition {
+            get { return remember_position; }
+            set { remember_position = value; }
+        }
         
         public virtual StreamPlaybackError PlaybackError {
             get { return playback_error; }

Index: src/Track.cs
===================================================================
--- src/Track.cs    (revision 122996)
+++ src/Track.cs    (working copy)
@@ -417,5 +417,16 @@
 
             return new Uri (builder.ToString (), true);
         }
+
+        public bool SkipWhenShuffle {
+            get { return record.SkipWhenShuffle; }
+            set { record.SkipWhenShuffle = value; }
+        }
+
+        public bool RememberPosition {
+            get { return record.RememberPosition; }
+            set { record.RememberPosition = value; }
+        }
+
     }
 }


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