banshee r3427 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.Services/Banshee.Database src/Core/Banshee.Services/Banshee.Library src/Core/Banshee.Services/Banshee.Sources src/Libraries/Hyena/Hyena.Data.Sqlite
- From: gburt svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3427 - in trunk/banshee: . src/Core/Banshee.Services/Banshee.Collection.Database src/Core/Banshee.Services/Banshee.Database src/Core/Banshee.Services/Banshee.Library src/Core/Banshee.Services/Banshee.Sources src/Libraries/Hyena/Hyena.Data.Sqlite
- Date: Wed, 12 Mar 2008 18:40:50 +0000 (GMT)
Author: gburt
Date: Wed Mar 12 18:40:49 2008
New Revision: 3427
URL: http://svn.gnome.org/viewvc/banshee?rev=3427&view=rev
Log:
2008-03-12 Gabriel Burt <gabriel burt gmail com>
* src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs:
* src/Core/Banshee.Services/Banshee.Collection.Database/LibraryAlbumInfo.cs:
* src/Core/Banshee.Services/Banshee.Collection.Database/LibraryArtistInfo.cs:
* src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs:
* src/Core/Banshee.Services/Banshee.Library/LibraryImportManager.cs:
* src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs:
* src/Libraries/Hyena/Hyena.Data.Sqlite/ICacheableItem.cs:
* src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs: Add a
CacheModelId property to Track/Artist/Album classes, and rename
SourceEntryId to CacheEntryId.
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/LibraryAlbumInfo.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/LibraryArtistInfo.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibraryImportManager.cs
trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/ICacheableItem.cs
trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/DatabaseTrackInfo.cs Wed Mar 12 18:40:49 2008
@@ -101,9 +101,9 @@
Provider.Save (this);
if (notify) {
if (is_new) {
- Source.NotifyTracksAdded ();
+ PrimarySource.NotifyTracksAdded ();
} else {
- Source.NotifyTracksChanged ();
+ PrimarySource.NotifyTracksChanged ();
}
}
}
@@ -114,21 +114,16 @@
get { return track_id; }
}
- private long entry_id;
- public long SourceEntryId {
- get { return entry_id; }
- set { entry_id = value; }
- }
- [DatabaseColumn ("SourceID", Index = "CoreTracksSourceIndex")]
- private int source_id;
- public int SourceId {
- get { return source_id; }
+ [DatabaseColumn ("PrimarySourceID", Index = "CoreTracksSourceIndex")]
+ private int primary_source_id;
+ public int PrimarySourceId {
+ get { return primary_source_id; }
}
- public PrimarySource Source {
- get { return PrimarySource.GetById (source_id); }
- set { source_id = value.SourceId; }
+ public PrimarySource PrimarySource {
+ get { return PrimarySource.GetById (primary_source_id); }
+ set { primary_source_id = value.DbId; }
}
[DatabaseColumn ("ArtistID", Index = "CoreTracksArtistIndex")]
@@ -339,6 +334,19 @@
set { date_updated = value; }
}
+ private long cache_entry_id;
+ public long CacheEntryId {
+ get { return cache_entry_id; }
+ set { cache_entry_id = value; }
+ }
+
+ private long cache_model_id;
+ public long CacheModelId {
+ get { return cache_model_id; }
+ set { cache_model_id = value; }
+ }
+
+
private static HyenaSqliteCommand check_command = new HyenaSqliteCommand (
"SELECT COUNT(*) FROM CoreTracks WHERE Uri = ? OR Uri = ?"
);
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/LibraryAlbumInfo.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/LibraryAlbumInfo.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/LibraryAlbumInfo.cs Wed Mar 12 18:40:49 2008
@@ -106,10 +106,16 @@
get { return dbid; }
}
- private long entry_id;
- public long SourceEntryId {
- get { return entry_id; }
- set { entry_id = value; }
+ private long cache_entry_id;
+ public long CacheEntryId {
+ get { return cache_entry_id; }
+ set { cache_entry_id = value; }
+ }
+
+ private long cache_model_id;
+ public long CacheModelId {
+ get { return cache_model_id; }
+ set { cache_model_id = value; }
}
[DatabaseColumn("ArtistID")]
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/LibraryArtistInfo.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/LibraryArtistInfo.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Collection.Database/LibraryArtistInfo.cs Wed Mar 12 18:40:49 2008
@@ -102,10 +102,16 @@
get { return dbid; }
}
- private long entry_id;
- public long SourceEntryId {
- get { return entry_id; }
- set { entry_id = value; }
+ private long cache_entry_id;
+ public long CacheEntryId {
+ get { return cache_entry_id; }
+ set { cache_entry_id = value; }
+ }
+
+ private long cache_model_id;
+ public long CacheModelId {
+ get { return cache_model_id; }
+ set { cache_model_id = value; }
}
[DatabaseColumn]
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Database/BansheeDbFormatMigrator.cs Wed Mar 12 18:40:49 2008
@@ -262,7 +262,7 @@
Execute(@"
CREATE TABLE CorePrimarySources (
- SourceID INTEGER PRIMARY KEY,
+ PrimarySourceID INTEGER PRIMARY KEY,
StringID TEXT UNIQUE
)
");
@@ -273,7 +273,7 @@
// AlbumArtist (TPE2) (in CoreAlbums?)
Execute(@"
CREATE TABLE CoreTracks (
- SourceID INTEGER NOT NULL,
+ PrimarySourceID INTEGER NOT NULL,
TrackID INTEGER PRIMARY KEY,
ArtistID INTEGER,
AlbumID INTEGER,
@@ -306,7 +306,7 @@
DateUpdatedStamp INTEGER
)
");
- Execute("CREATE INDEX CoreTracksSourceIndex ON CoreTracks(SourceID)");
+ Execute("CREATE INDEX CoreTracksPrimarySourceIndex ON CoreTracks(PrimarySourceID)");
Execute("CREATE INDEX CoreTracksAggregatesIndex ON CoreTracks(FileSize, Duration)");
Execute("CREATE INDEX CoreTracksArtistIndex ON CoreTracks(ArtistID)");
Execute("CREATE INDEX CoreTracksAlbumIndex ON CoreTracks(AlbumID)");
@@ -527,7 +527,7 @@
private void RefreshMetadataThread (object state)
{
- int total = ServiceManager.DbConnection.Query<int> ("SELECT count(*) FROM CoreTracks WHERE SourceID = 1");
+ int total = ServiceManager.DbConnection.Query<int> ("SELECT count(*) FROM CoreTracks WHERE PrimarySourceID = 1");
if (total <= 0) {
return;
@@ -540,7 +540,7 @@
HyenaSqliteCommand select_command = new HyenaSqliteCommand (
String.Format (
- "SELECT {0} FROM {1} WHERE {2} AND CoreTracks.SourceID = 1",
+ "SELECT {0} FROM {1} WHERE {2} AND CoreTracks.PrimarySourceID = 1",
DatabaseTrackInfo.Provider.Select,
DatabaseTrackInfo.Provider.From,
DatabaseTrackInfo.Provider.Where
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibraryImportManager.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibraryImportManager.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Library/LibraryImportManager.cs Wed Mar 12 18:40:49 2008
@@ -137,7 +137,7 @@
LibraryAlbumInfo album = LibraryAlbumInfo.FindOrCreate (artist, track.AlbumTitle);
track.DateAdded = DateTime.Now;
- track.Source = ServiceManager.SourceManager.Library;
+ track.PrimarySource = ServiceManager.SourceManager.Library;
track.ArtistId = artist.DbId;
track.AlbumId = album.DbId;
track.Save (false);
Modified: trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs (original)
+++ trunk/banshee/src/Core/Banshee.Services/Banshee.Sources/PrimarySource.cs Wed Mar 12 18:40:49 2008
@@ -81,9 +81,9 @@
DELETE FROM CoreAlbums WHERE AlbumID NOT IN (SELECT AlbumID FROM CoreTracks)
");
- protected int source_id;
- public int SourceId {
- get { return source_id; }
+ protected int dbid;
+ public int DbId {
+ get { return dbid; }
}
public ErrorSource ErrorSource {
@@ -104,16 +104,16 @@
protected PrimarySource (string generic_name, string name, string id, int order) : base (generic_name, name, id, order)
{
- source_id = ServiceManager.DbConnection.Query<int> ("SELECT SourceID FROM CorePrimarySources WHERE StringID = ?", id);
- if (source_id == 0) {
- source_id = ServiceManager.DbConnection.Execute ("INSERT INTO CorePrimarySources (StringID) VALUES (?)", id);
+ dbid = ServiceManager.DbConnection.Query<int> ("SELECT PrimarySourceID FROM CorePrimarySources WHERE StringID = ?", id);
+ if (dbid == 0) {
+ dbid = ServiceManager.DbConnection.Execute ("INSERT INTO CorePrimarySources (StringID) VALUES (?)", id);
}
- track_model.Condition = String.Format ("CoreTracks.SourceID = {0}", source_id);
+ track_model.Condition = String.Format ("CoreTracks.PrimarySourceID = {0}", dbid);
error_source.Updated += OnErrorSourceUpdated;
OnErrorSourceUpdated (null, null);
- primary_sources[source_id] = this;
+ primary_sources[dbid] = this;
}
internal void NotifyTracksAdded ()
Modified: trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/ICacheableItem.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/ICacheableItem.cs (original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/ICacheableItem.cs Wed Mar 12 18:40:49 2008
@@ -32,6 +32,7 @@
{
public interface ICacheableItem
{
- long SourceEntryId { get; set; }
+ long CacheEntryId { get; set; }
+ long CacheModelId { get; set; }
}
}
Modified: trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs (original)
+++ trunk/banshee/src/Libraries/Hyena/Hyena.Data.Sqlite/SqliteModelCache.cs Wed Mar 12 18:40:49 2008
@@ -317,7 +317,8 @@
while (reader.Read ()) {
if (!ContainsKey (offset)) {
item = provider.Load (reader, (int) offset);
- item.SourceEntryId = Convert.ToInt64 (reader[reader.FieldCount - 1]);
+ item.CacheEntryId = Convert.ToInt64 (reader[reader.FieldCount - 1]);
+ item.CacheModelId = uid;
Add (offset, item);
}
offset++;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]