banshee r3572 - in trunk/banshee: . src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler



Author: ahixon
Date: Thu Mar 27 23:15:18 2008
New Revision: 3572
URL: http://svn.gnome.org/viewvc/banshee?rev=3572&view=rev

Log:
2008-03-28  Alexander Hixon  <hixon alexander mediati org>

	* src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs::
	Make sure we only scrobble and set the Now Playing information on Music
	tracks, rather than anything played.

	* src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/Queue.cs:
	Removed some extra debug spew that was unnecessary.


Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs
   trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/Queue.cs

Modified: trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs	Thu Mar 27 23:15:18 2008
@@ -185,8 +185,6 @@
                 }
                 
                 previouspos = ServiceManager.PlayerEngine.Position;
-                
-                //Console.WriteLine ("Position now {0} (increased by {1} msec) : {2}", playtime, increase, ignorenext);
             }
             
             public void SkipPosition ()
@@ -207,7 +205,7 @@
         SongTimer st = new SongTimer ();
         
         private void Queue (TrackInfo track) {
-            if (track == null || st.PlayTime == 0 ||
+            if (track == null || st.PlayTime == 0 || 
                 !(actions["AudioscrobblerEnableAction"] as ToggleAction).Active) {
                 
                 return;
@@ -217,6 +215,7 @@
                 st.PlayTime, track.Duration.TotalMilliseconds, queued, track, st.PlayTime / 1000);
             
             if (!queued && track.Duration.TotalSeconds > 30 && 
+                (track.MediaAttributes & TrackMediaAttributes.Music) != 0 && 
                 !String.IsNullOrEmpty (track.ArtistName) && !String.IsNullOrEmpty (track.TrackTitle) &&
                 (st.PlayTime > track.Duration.TotalMilliseconds / 2 || st.PlayTime > 240 * 1000)) {
                     if (!connection.Started) {
@@ -252,7 +251,8 @@
                     // Queue as now playing
                     if (!now_playing_sent && iterate_countdown == 0) {
                         if (last_track != null && last_track.Duration.TotalSeconds > 30 &&
-                            (actions["AudioscrobblerEnableAction"] as ToggleAction).Active) {
+                            (actions["AudioscrobblerEnableAction"] as ToggleAction).Active &&
+                            (last_track.MediaAttributes & TrackMediaAttributes.Music) != 0) {
                             
                             connection.NowPlaying (last_track.ArtistName, last_track.TrackTitle,
                                 last_track.AlbumTitle, last_track.Duration.TotalSeconds, last_track.TrackNumber);

Modified: trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/Queue.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/Queue.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/Queue.cs	Thu Mar 27 23:15:18 2008
@@ -268,7 +268,6 @@
         {
             TrackInfo t = (track as TrackInfo);
             if (t != null) {
-                Log.DebugFormat ("Queued: {0}", t);
                 queue.Add (new QueuedTrack (t, started_at));
                 dirty = true;
                 RaiseTrackAdded (this, new EventArgs ());



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