[banshee/art-caching] Fix updating artwork for playing song when edited
- From: Gabriel Burt <gburt src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [banshee/art-caching] Fix updating artwork for playing song when edited
- Date: Fri, 4 Dec 2009 23:12:55 +0000 (UTC)
commit 6ffe841cd67398045161d070965d854e44ef6ed4
Author: Gabriel Burt <gabriel burt gmail com>
Date: Fri Dec 4 15:08:58 2009 -0800
Fix updating artwork for playing song when edited
.../Banshee.Core/Banshee.Collection/TrackInfo.cs | 4 +++
.../Banshee.MediaEngine/PlayerEngineService.cs | 2 +-
.../Banshee.Metadata/BaseMetadataProvider.cs | 2 +-
.../Banshee.Metadata/MetadataService.cs | 13 ++++++----
.../Banshee.Metadata/MetadataServiceJob.cs | 2 +
.../Banshee.Gui.Widgets/TrackInfoDisplay.cs | 8 +++---
.../Banshee.CoverArt/CoverArtJob.cs | 26 ++++++++++++-------
7 files changed, 36 insertions(+), 21 deletions(-)
---
diff --git a/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs b/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs
index 117496f..f9ae275 100644
--- a/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs
+++ b/src/Core/Banshee.Core/Banshee.Collection/TrackInfo.cs
@@ -143,6 +143,10 @@ namespace Banshee.Collection
public virtual bool TrackEqual (TrackInfo track)
{
+ if (track == this) {
+ return true;
+ }
+
if (track == null || track.Uri == null || Uri == null) {
return false;
}
diff --git a/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs b/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs
index 2ad3f74..88a97fd 100644
--- a/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs
+++ b/src/Core/Banshee.Services/Banshee.MediaEngine/PlayerEngineService.cs
@@ -184,7 +184,7 @@ namespace Banshee.MediaEngine
private void OnMetadataServiceHaveResult (object o, MetadataLookupResultArgs args)
{
- if (CurrentTrack != null && args.Track == CurrentTrack) {
+ if (CurrentTrack != null && CurrentTrack.TrackEqual (args.Track as TrackInfo)) {
foreach (StreamTag tag in args.ResultTags) {
StreamTagger.TrackInfoMerge (CurrentTrack, tag);
}
diff --git a/src/Core/Banshee.Services/Banshee.Metadata/BaseMetadataProvider.cs b/src/Core/Banshee.Services/Banshee.Metadata/BaseMetadataProvider.cs
index 2835328..747ba72 100644
--- a/src/Core/Banshee.Services/Banshee.Metadata/BaseMetadataProvider.cs
+++ b/src/Core/Banshee.Services/Banshee.Metadata/BaseMetadataProvider.cs
@@ -62,7 +62,7 @@ namespace Banshee.Metadata
protected virtual void OnHaveResult(IBasicTrackInfo track, IList<StreamTag> tags)
{
- if(tags == null) {
+ if(tags == null || tags.Count == 0) {
return;
}
diff --git a/src/Core/Banshee.Services/Banshee.Metadata/MetadataService.cs b/src/Core/Banshee.Services/Banshee.Metadata/MetadataService.cs
index 54f2258..0ddf6a4 100644
--- a/src/Core/Banshee.Services/Banshee.Metadata/MetadataService.cs
+++ b/src/Core/Banshee.Services/Banshee.Metadata/MetadataService.cs
@@ -134,6 +134,13 @@ namespace Banshee.Metadata
}
}
+ internal void OnHaveResult (MetadataServiceJob job)
+ {
+ Banshee.Base.ThreadAssist.ProxyToMain (delegate {
+ OnHaveResult (job.Track, job.ResultTags);
+ });
+ }
+
private void OnSchedulerJobFinished (IJob job)
{
if (!(job is IMetadataLookupJob)) {
@@ -141,11 +148,7 @@ namespace Banshee.Metadata
}
IMetadataLookupJob lookup_job = (IMetadataLookupJob)job;
- if (RemoveJob (lookup_job)) {
- Banshee.Base.ThreadAssist.ProxyToMain (delegate {
- OnHaveResult (lookup_job.Track, lookup_job.ResultTags);
- });
- }
+ RemoveJob (lookup_job);
}
private void OnSchedulerJobUnscheduled (IJob job)
diff --git a/src/Core/Banshee.Services/Banshee.Metadata/MetadataServiceJob.cs b/src/Core/Banshee.Services/Banshee.Metadata/MetadataServiceJob.cs
index d4f8794..5e658fd 100644
--- a/src/Core/Banshee.Services/Banshee.Metadata/MetadataServiceJob.cs
+++ b/src/Core/Banshee.Services/Banshee.Metadata/MetadataServiceJob.cs
@@ -101,6 +101,8 @@ namespace Banshee.Metadata
Hyena.Log.Exception (e);
}
}
+
+ service.OnHaveResult (this);
}
public virtual IBasicTrackInfo Track {
diff --git a/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs
index d9d5102..be833d8 100644
--- a/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs
+++ b/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs
@@ -172,7 +172,7 @@ namespace Banshee.Gui.Widgets
if (current_track == null) {
LoadCurrentTrack ();
} else {
- LoadImage (current_track, true);
+ LoadImage (current_track, false, true);
}
}
@@ -374,17 +374,17 @@ namespace Banshee.Gui.Widgets
incoming_track = track;
- LoadImage (track, false);
+ LoadImage (track, force_reload, false);
if (stage.Actor == null) {
stage.Reset ();
}
}
- private void LoadImage (TrackInfo track, bool force)
+ private void LoadImage (TrackInfo track, bool track_updated, bool force)
{
string artwork_id = track.ArtworkId;
- if (current_artwork_id != artwork_id || force) {
+ if (current_artwork_id != artwork_id || force || (track_updated && IsMissingImage (current_image))) {
current_artwork_id = artwork_id;
incoming_image = artwork_manager.LookupScaleSurface (artwork_id, ArtworkSizeRequest);
}
diff --git a/src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtJob.cs b/src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtJob.cs
index 6fa1b6c..c08d098 100644
--- a/src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtJob.cs
+++ b/src/Extensions/Banshee.CoverArt/Banshee.CoverArt/CoverArtJob.cs
@@ -80,7 +80,7 @@ namespace Banshee.CoverArt
);
SelectCommand = new HyenaSqliteCommand (@"
- SELECT DISTINCT CoreAlbums.AlbumID, CoreAlbums.Title, CoreArtists.Name, CoreTracks.Uri
+ SELECT DISTINCT CoreAlbums.AlbumID, CoreAlbums.Title, CoreArtists.Name, CoreTracks.Uri, CoreTracks.TrackID
FROM CoreTracks, CoreArtists, CoreAlbums
WHERE
CoreTracks.PrimarySourceID = ? AND
@@ -107,19 +107,25 @@ namespace Banshee.CoverArt
Register ();
}
- protected override void IterateCore (HyenaDataReader reader)
+ private class CoverartTrackInfo : DatabaseTrackInfo
{
- DatabaseTrackInfo track = new DatabaseTrackInfo ();
+ public int DbId {
+ set { TrackId = value; }
+ }
+ }
- track.AlbumTitle = reader.Get<string> (1);
- track.ArtistName = reader.Get<string> (2);
- track.PrimarySource = ServiceManager.SourceManager.MusicLibrary;
- track.Uri = new SafeUri (reader.Get<string> (3));
- track.AlbumId = reader.Get<int> (0);
- //Console.WriteLine ("have album {0}/{1} for track uri {2}", track.AlbumId, track.AlbumTitle, track.Uri);
+ protected override void IterateCore (HyenaDataReader reader)
+ {
+ var track = new CoverartTrackInfo () {
+ AlbumTitle = reader.Get<string> (1),
+ ArtistName = reader.Get<string> (2),
+ PrimarySource = ServiceManager.SourceManager.MusicLibrary,
+ Uri = new SafeUri (reader.Get<string> (3)),
+ DbId = reader.Get<int> (4),
+ AlbumId = reader.Get<int> (0)
+ };
Status = String.Format (Catalog.GetString ("{0} - {1}"), track.ArtistName, track.AlbumTitle);
-
FetchForTrack (track);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]