[banshee] Services: improve recent DatabaseTrackInfo refactoring
- From: AndrÃs Aragoneses <aaragoneses src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [banshee] Services: improve recent DatabaseTrackInfo refactoring
- Date: Thu, 22 Dec 2011 13:41:26 +0000 (UTC)
commit 6e7c5b0a6ecdcf9dfc4fa96a3703d47acdc66c11
Author: Andres G. Aragoneses <knocte gmail com>
Date: Thu Dec 22 13:37:16 2011 +0000
Services: improve recent DatabaseTrackInfo refactoring
Finish DatabaseTrackInfo refactoring [0] to have
also a params keyword on the overload that accepts
a string type (instead of SafeUri class). This way
Alex's commit [1] can be 100% correct and I can
revert the reversion [2].
[0] http://git.gnome.org/browse/banshee/commit/?id=2625a34f50cdae2f6d61c2ab39d4985e5b1d5962
[1] http://git.gnome.org/browse/banshee/commit/?id=3db01454717669b1c7903a1ae07b8db9cef84f11
[2] http://git.gnome.org/browse/banshee/commit/?id=32acdba17a48f2019122293d388fe191bae3b5e0
.../DatabaseTrackInfo.cs | 25 +++++++++----------
.../Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs | 2 +-
2 files changed, 13 insertions(+), 14 deletions(-)
---
diff --git a/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs b/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
index 8502b5b..6b8fe23 100644
--- a/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
+++ b/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
@@ -770,11 +770,6 @@ namespace Banshee.Collection.Database
return copy_success;
}
- public static int GetTrackIdForUri (string uri)
- {
- return GetTrackIdForUri (new SafeUri (uri));
- }
-
private static string get_track_id_by_uri =
"SELECT TrackID FROM CoreTracks WHERE {0} {1} = ? LIMIT 1";
@@ -793,22 +788,26 @@ namespace Banshee.Collection.Database
"SELECT COUNT('x') FROM CoreTracks WHERE PrimarySourceId IN (?) AND MetadataHash = ?"
);
+ public static int GetTrackIdForUri (string uri)
+ {
+ return GetTrackIdForUri (new SafeUri (uri));
+ }
+
public static int GetTrackIdForUri (SafeUri uri, params int [] primary_sources)
{
+ return GetTrackIdForUri (uri.AbsoluteUri, primary_sources);
+ }
+
+ public static int GetTrackIdForUri (string absoluteUri, params int [] primary_sources)
+ {
if (primary_sources == null || primary_sources.Length == 0) {
- return ServiceManager.DbConnection.Query<int> (get_track_id_by_uri_plain, uri.AbsoluteUri);
+ return ServiceManager.DbConnection.Query<int> (get_track_id_by_uri_plain, absoluteUri);
}
return ServiceManager.DbConnection.Query<int> (
- get_track_id_by_uri_primarysources, primary_sources, uri.AbsoluteUri
+ get_track_id_by_uri_primarysources, primary_sources, absoluteUri
);
}
- public static int GetTrackIdForUri (string absoluteUri, int [] primary_sources)
- {
- return ServiceManager.DbConnection.Query<int> (get_track_id_by_uri,
- primary_sources, absoluteUri);
- }
-
private static IDataReader FindTrackByMetadataHash (string metadata_hash, int [] primary_sources)
{
var command = new HyenaSqliteCommand (String.Format (
diff --git a/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs b/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs
index 3430e30..c26025d 100644
--- a/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs
+++ b/src/Dap/Banshee.Dap.Mtp/Banshee.Dap.Mtp/MtpSource.cs
@@ -177,7 +177,7 @@ namespace Banshee.Dap.Mtp
foreach (Track mtp_track in files) {
int track_id;
- if ((track_id = DatabaseTrackInfo.GetTrackIdForUri (MtpTrackInfo.GetPathFromMtpTrack (mtp_track), new int [] { DbId } )) > 0) {
+ if ((track_id = DatabaseTrackInfo.GetTrackIdForUri (MtpTrackInfo.GetPathFromMtpTrack (mtp_track), DbId )) > 0) {
track_map[track_id] = mtp_track;
} else {
MtpTrackInfo track = new MtpTrackInfo (mtp_device, mtp_track);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]