[Banshee-List] Banshee API Question



I'm writing an extension, trying to find and remove duplicates from the music library.

this is my remove Code:
{
            MusicLibrarySource Library = ServiceManager.SourceManager.MusicLibrary;
            if (Library.CanRemoveTracks && Library.CanDeleteTracks) {
                Hyena.Collections.Selection DeleteSelection = new Hyena.Collections.Selection ();
                Hyena.Collections.Selection RemoveSelection = new Hyena.Collections.Selection ();
                Gtk.TreeIter Iter = new Gtk.TreeIter ();
                MusicListStore.GetIterFirst (out Iter);
                do {
                    if ((bool)MusicListStore.GetValue (Iter, 1)) {
                        DeleteSelection.Select (Library.GetTrackIdForUri ((string)MusicListStore.GetValue (Iter, 6)));
                    } else if ((bool)MusicListStore.GetValue (Iter, 0)) {
                        RemoveSelection.Select (Library.GetTrackIdForUri ((string)MusicListStore.GetValue (Iter, 6)));
                    }
                } while (MusicListStore.IterNext (ref Iter));

                if (DeleteSelection.Count > 0) {
                    Log.DebugFormat ("Deleting {0} tracks from the drive", DeleteSelection.Count);
                    Library.DeleteTracks (DeleteSelection);
                    Library.NotifyTracksChanged ();
                }
                if (RemoveSelection.Count > 0) {
                    Log.DebugFormat ("Removing {0} tracks from the library", RemoveSelection.Count);
                    Library.RemoveTracks (RemoveSelection);
                    Library.NotifyTracksChanged ();
                }
            } else {
                Log.Warning ("Can not remove or delete any tracks");
            }
        }

However, when i execute it, it doesn't actually remove any Tracks from the Library.  I'm sure i'm doing something wrong, but i can't figure out what, and the banshee Documentation is a little thin on the subject.  
The class is an ISourceContent, the function is executed on click a Gtk.Button.

Thanks for any help

--
Thanks
Kevin Anthony
www.NoSideRacing.com


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