[banshee] AudioscrobblerConnection: Add logging for last.fm scrobbler



commit 3085a6e9812314f26fc8a01e893d7e2e136a6e24
Author: Phil Trimble <PhilTrimble gmail com>
Date:   Sat Feb 4 16:59:24 2012 -0600

    AudioscrobblerConnection: Add logging for last.fm scrobbler
    
    Adds a simple debug log statement that shows exactly what Banshee is
    sending to last.fm, to help with bgo#667499. It does not show the
    session id for safety.
    
    Also changes the timeout for a response from last.fm from 5 to
    10 seconds. This removes the constant warnings about timeouts
    that don't truly indicate a problem.
    
    Signed-off-by: Bertrand Lorentz <bertrand lorentz gmail com>

 .../Lastfm/Lastfm/AudioscrobblerConnection.cs      |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/src/Libraries/Lastfm/Lastfm/AudioscrobblerConnection.cs b/src/Libraries/Lastfm/Lastfm/AudioscrobblerConnection.cs
index e8e6ce7..8a48067 100644
--- a/src/Libraries/Lastfm/Lastfm/AudioscrobblerConnection.cs
+++ b/src/Libraries/Lastfm/Lastfm/AudioscrobblerConnection.cs
@@ -55,7 +55,7 @@ namespace Lastfm
         private const int FAILURE_LOG_MINUTES = 5; /* 5 minute delay on logging failure to upload information */
         private const int RETRY_SECONDS = 60; /* 60 second delay for transmission retries */
         private const int MAX_RETRY_SECONDS = 7200; /* 2 hours, as defined in the last.fm protocol */
-        private const int TIME_OUT = 5000; /* 5 seconds timeout for webrequests */
+        private const int TIME_OUT = 10000; /* 10 seconds timeout for webrequests */
         private const string CLIENT_ID = "bsh";
         private const string CLIENT_VERSION = "0.1";
         private const string SCROBBLER_URL = "http://post.audioscrobbler.com/";;
@@ -241,11 +241,13 @@ namespace Lastfm
                 return;
             }
 
+            string song_transmit_info = queue.GetTransmitInfo  (out num_tracks_transmitted);
+            Log.DebugFormat ("Last.fm scrobbler sending '{0}' to {1}", song_transmit_info, post_url);
+
             StringBuilder sb = new StringBuilder ();
 
             sb.AppendFormat ("s={0}", session_id);
-
-            sb.Append (queue.GetTransmitInfo (out num_tracks_transmitted));
+            sb.Append (song_transmit_info);
 
             current_web_req = (HttpWebRequest) WebRequest.Create (post_url);
             current_web_req.UserAgent = LastfmCore.UserAgent;
@@ -253,8 +255,6 @@ namespace Lastfm
             current_web_req.ContentType = "application/x-www-form-urlencoded";
             current_web_req.ContentLength = sb.Length;
 
-            //Console.WriteLine ("Sending {0} ({1} bytes) to {2}", sb.ToString (), sb.Length, post_url);
-
             TransmitState ts = new TransmitState ();
             ts.Count = num_tracks_transmitted;
             ts.StringBuilder = sb;



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