[banshee] Last.fm: Set the now_playing_started flag



commit ddc5b01fad56b87967aedefec18795267c021171
Author: Alexander Kojevnikov <alexk gnome org>
Date:   Fri Jun 29 19:18:32 2012 -0400

    Last.fm: Set the now_playing_started flag

 .../Lastfm/Lastfm/AudioscrobblerConnection.cs      |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/Libraries/Lastfm/Lastfm/AudioscrobblerConnection.cs b/src/Libraries/Lastfm/Lastfm/AudioscrobblerConnection.cs
index 8d9fa4c..0bb3796 100644
--- a/src/Libraries/Lastfm/Lastfm/AudioscrobblerConnection.cs
+++ b/src/Libraries/Lastfm/Lastfm/AudioscrobblerConnection.cs
@@ -201,7 +201,7 @@ namespace Lastfm
             current_scrobble_request = new LastfmRequest ("track.scrobble", RequestType.Write, ResponseFormat.Json);
             IList<IQueuedTrack> tracks = queue.GetTracks ();
 
-             for (int i = 0; i < tracks.Count; i ++) {
+             for (int i = 0; i < tracks.Count; i++) {
                 IQueuedTrack track = tracks[i];
 
                 string str_track_number = String.Empty;
@@ -283,14 +283,17 @@ namespace Lastfm
         public void NowPlaying (string artist, string title, string album, double duration,
                                 int tracknum, string mbrainzid)
         {
-            if (now_playing_started) {
+            if (String.IsNullOrEmpty (artist) || String.IsNullOrEmpty (title) || !connected) {
                 return;
             }
 
-            if (String.IsNullOrEmpty(artist) || String.IsNullOrEmpty(title) || !connected) {
+            // FIXME: need a lock for this flag
+            if (now_playing_started) {
                 return;
             }
 
+            now_playing_started = true;
+
             string str_track_number = String.Empty;
             if (tracknum != 0) {
                 str_track_number = tracknum.ToString();



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