[banshee] [Extensions] Update EoS handlers for CurrentTrack now being null



commit 02fdeaeee9ec60e3e93f86f14a9b61b5cb59fe6f
Author: Gabriel Burt <gabriel burt gmail com>
Date:   Mon Oct 25 17:59:38 2010 -0500

    [Extensions] Update EoS handlers for CurrentTrack now being null

 .../AudioscrobblerService.cs                       |    3 ++-
 .../NotificationAreaService.cs                     |    2 +-
 .../Banshee.PlayQueue/PlayQueueSource.cs           |    9 ++++++---
 3 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs
index 1842642..b9d9c60 100644
--- a/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs
+++ b/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs
@@ -278,7 +278,8 @@ namespace Banshee.Lastfm.Audioscrobbler
                     break;
 
                 case PlayerEvent.EndOfStream:
-                    Queue (ServiceManager.PlayerEngine.CurrentTrack);
+                    Queue (last_track);
+                    last_track = null;
                     iterate_countdown = 4 * 4;
                     break;
             }
diff --git a/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/NotificationAreaService.cs b/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/NotificationAreaService.cs
index cd38f9c..a08a3b8 100644
--- a/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/NotificationAreaService.cs
+++ b/src/Extensions/Banshee.NotificationArea/Banshee.NotificationArea/NotificationAreaService.cs
@@ -402,7 +402,7 @@ namespace Banshee.NotificationArea
                 return;
             }
 
-            if (ServiceManager.PlayerEngine.CurrentTrack is DatabaseTrackInfo) {
+            if (current_track is DatabaseTrackInfo) {
                 rating_menu_item.Show ();
             } else {
                 rating_menu_item.Hide ();
diff --git a/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs b/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
index d016dae..6b41b89 100644
--- a/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
+++ b/src/Extensions/Banshee.PlayQueue/Banshee.PlayQueue/PlayQueueSource.cs
@@ -632,6 +632,7 @@ namespace Banshee.PlayQueue
         private void OnPlayerEvent (PlayerEventArgs args)
         {
             if (args.Event == PlayerEvent.EndOfStream) {
+                // If EoS is for the last track in the play queue
                 if (this == ServiceManager.PlaybackController.Source &&
                     TrackModel.IndexOf (current_track) == Count - 1) {
                     SetCurrentTrack (null);
@@ -639,11 +640,14 @@ namespace Banshee.PlayQueue
                     if (was_playing) {
                         ServiceManager.PlaybackController.PriorTrack = prior_playback_track;
                     } else {
+                        // Stop playback; nothing was playing before the play queue, so it doesn't
+                        // make sense to continue playback.
                         ServiceManager.PlaybackController.StopWhenFinished = true;
                     }
                 }
+
                 if (ServiceManager.PlaybackController.StopWhenFinished) {
-                    if (current_track != null && ServiceManager.PlayerEngine.CurrentTrack == current_track) {
+                    if (current_track != null && this == ServiceManager.PlaybackController.Source) {
                         int index = TrackModel.IndexOf (current_track) + 1;
                         SetCurrentTrack (index < Count ? TrackModel[index] as DatabaseTrackInfo : null);
                     }
@@ -733,8 +737,7 @@ namespace Banshee.PlayQueue
                     FROM CorePlaylistEntries
                     WHERE PlaylistID = ?", DbId
                 );
-            }
-            else {
+            } else {
                 view_order = ServiceManager.DbConnection.Query<long> (@"
                     SELECT ViewOrder
                     FROM CorePlaylistEntries



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