banshee r3065 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.Services/Banshee.Library src/Core/Banshee.Services/Banshee.Playlist src/Core/Banshee.Services/Banshee.Sources
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3065 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.Services/Banshee.Library src/Core/Banshee.Services/Banshee.Playlist src/Core/Banshee.Services/Banshee.Sources
- Date: Mon, 28 Jan 2008 20:53:31 +0000 (GMT)
Author: gburt
Date: Mon Jan 28 20:53:30 2008
New Revision: 3065
URL: http://svn.gnome.org/viewvc/banshee?rev=3065&view=rev
Log:
2008-01-28 Gabriel Burt <gabriel burt gmail com>
* src/Core/Banshee.Services/Banshee.Library/LibrarySource.cs:
* src/Core/Banshee.Services/Banshee.Playlist/PlaylistSource.cs:
* src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs: Add
RemoveTrack methods (taking either an int or a LibraryTrackInfo).
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/TrackListDatabaseModel.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibrarySource.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/PlaylistSource.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/TrackListDatabaseModel.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/TrackListDatabaseModel.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/TrackListDatabaseModel.cs Mon Jan 28 20:53:30 2008
@@ -269,7 +269,7 @@
public override TrackInfo this[int index] {
get { return cache.GetValue (index); }
}
-
+
public override int Count {
get { return count; }
}
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibrarySource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibrarySource.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibrarySource.cs Mon Jan 28 20:53:30 2008
@@ -88,6 +88,14 @@
}
}
+ public override void RemoveTrack (LibraryTrackInfo track)
+ {
+ remove_track_command.ApplyValues (track.DbId);
+ ServiceManager.DbConnection.Execute (remove_track_command);
+ Reload ();
+ ReloadChildren ();
+ }
+
/*public override void RemoveTracks (IEnumerable<TrackInfo> tracks)
{
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/PlaylistSource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/PlaylistSource.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Playlist/PlaylistSource.cs Mon Jan 28 20:53:30 2008
@@ -49,8 +49,10 @@
{
public class PlaylistSource : AbstractPlaylistSource
{
- private static HyenaSqliteCommand add_tracks_command;
- private static HyenaSqliteCommand remove_tracks_command;
+ private static HyenaSqliteCommand add_track_command;
+ private static HyenaSqliteCommand remove_track_command;
+ private static HyenaSqliteCommand add_track_range_command;
+ private static HyenaSqliteCommand remove_track_range_command;
private static HyenaSqliteCommand delete_command;
private static string generic_name = Catalog.GetString ("Playlist");
@@ -69,14 +71,22 @@
static PlaylistSource ()
{
- add_tracks_command = new HyenaSqliteCommand (@"
+ add_track_command = new HyenaSqliteCommand (
+ "INSERT INTO CorePlaylistEntries (PlaylistID, TrackID) VALUES (?, ?)", 2
+ );
+
+ remove_track_command = new HyenaSqliteCommand (
+ "DELETE FROM CorePlaylistEntries WHERE PlaylistID = ? AND TrackID = ?", 2
+ );
+
+ add_track_range_command = new HyenaSqliteCommand (@"
INSERT INTO CorePlaylistEntries
SELECT null, ?, ItemID, 0
FROM CoreCache WHERE ModelID = ?
LIMIT ?, ?", 4
);
- remove_tracks_command = new HyenaSqliteCommand (@"
+ remove_track_range_command = new HyenaSqliteCommand (@"
DELETE FROM CorePlaylistEntries WHERE PlaylistID = ? AND
TrackID IN (SELECT ItemID FROM CoreCache
WHERE ModelID = ? LIMIT ?, ?)", 4
@@ -179,6 +189,13 @@
#endregion
+ /*public override void AddTrack (LibraryTrackInfo track)
+ {
+ add_track_command.ApplyValues (DbId, track.DbId);
+ ServiceManager.DbConnection.Execute (add_track_command);
+ Reload ();
+ }*/
+
public virtual void AddSelectedTracks (TrackListDatabaseModel from)
{
if (from == track_model)
@@ -189,14 +206,21 @@
protected virtual void AddTrackRange (TrackListDatabaseModel from, RangeCollection.Range range)
{
- add_tracks_command.ApplyValues (DbId, from.CacheId, range.Start, range.End - range.Start + 1);
- ServiceManager.DbConnection.Execute (add_tracks_command);
+ add_track_range_command.ApplyValues (DbId, from.CacheId, range.Start, range.End - range.Start + 1);
+ ServiceManager.DbConnection.Execute (add_track_range_command);
+ }
+
+ public override void RemoveTrack (LibraryTrackInfo track)
+ {
+ remove_track_command.ApplyValues (DbId, track.DbId);
+ ServiceManager.DbConnection.Execute (remove_track_command);
+ Reload ();
}
protected override void RemoveTrackRange (TrackListDatabaseModel from, RangeCollection.Range range)
{
- remove_tracks_command.ApplyValues (DbId, from.CacheId, range.Start, range.End - range.Start + 1);
- ServiceManager.DbConnection.Execute (remove_tracks_command);
+ remove_track_range_command.ApplyValues (DbId, from.CacheId, range.Start, range.End - range.Start + 1);
+ ServiceManager.DbConnection.Execute (remove_track_range_command);
}
public static IEnumerable<PlaylistSource> LoadAll ()
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/DatabaseSource.cs Mon Jan 28 20:53:30 2008
@@ -121,6 +121,16 @@
OnUpdated ();
}
+ public virtual void RemoveTrack (int index)
+ {
+ RemoveTrack (track_model [index] as LibraryTrackInfo);
+ }
+
+ public virtual void RemoveTrack (LibraryTrackInfo track)
+ {
+ throw new NotImplementedException();
+ }
+
// Methods for removing tracks from this source
/*public virtual void RemoveTracks (IEnumerable<TrackInfo> tracks)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]