Re: [Banshee-List] [PATCH] Audiosrobbler patch thing



This patch causes a crash when I try to enter my Last.fm account. Also there is a rogue Console.WriteLine in it. 

Exception in Gtk# callback delegate
  Note: Applications can use GLib.ExceptionManager.UnhandledException to handle the exception.
System.NullReferenceException: Object reference not set to an instance of an object
  at Banshee.Lastfm.Audioscrobbler.AudioscrobblerService+<>c__CompilerGenerated0.<IExtensionService.Initialize>c__13 (System.Object o, System.EventArgs args) [0x00000] in /home/aaron/svn/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs:104 
  at (wrapper delegate-invoke) System.MulticastDelegate:invoke_void_object_EventArgs (object,System.EventArgs)
  at (wrapper delegate-invoke) System.MulticastDelegate:invoke_void_object_EventArgs (object,System.EventArgs)
  at Lastfm.Account.OnUpdated () [0x0000d] in /home/aaron/svn/banshee/src/Libraries/Lastfm/Lastfm/Account.cs:93 
  at Lastfm.Account.Save () [0x00000] in /home/aaron/svn/banshee/src/Libraries/Lastfm/Lastfm/Account.cs:86 
  at Lastfm.Gui.AccountLoginForm.UpdateLogin () [0x00080] in /home/aaron/svn/banshee/src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginForm.cs:114 
  at Lastfm.Gui.AccountLoginForm.OnDestroyed () [0x0000b] in /home/aaron/svn/banshee/src/Libraries/Lastfm.Gui/Lastfm.Gui/AccountLoginForm.cs:88 
  at Gtk.Object.NativeDestroy (System.Object o, System.EventArgs args) [0x00000] 
  at GLib.Signal.voidObjectCallback (IntPtr handle, IntPtr gch) [0x00000] 
   at GLib.ExceptionManager.RaiseUnhandledException(System.Exception e, Boolean is_terminal)
   at GLib.Signal.voidObjectCallback(IntPtr handle, IntPtr gch)
   at GLib.Signal.voidObjectCallback(IntPtr , IntPtr )
   at Gtk.Object.gtk_object_destroy(IntPtr )
   at Gtk.Object.gtk_object_destroy(IntPtr )
   at Gtk.Object.Destroy()
   at Gtk.Widget.Destroy()
   at Banshee.Lastfm.Radio.LastfmActions.ShowLoginDialog() in /home/aaron/svn/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmActions.cs:line 385
   at Banshee.Lastfm.Radio.LastfmActions.OnSourceProperties(System.Object o, System.EventArgs args) in /home/aaron/svn/banshee/src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Radio/LastfmActions.cs:line 225
   at System.MulticastDelegate.invoke_void_object_EventArgs(System.Object , System.EventArgs )
   at GLib.Signal.voidObjectCallback(IntPtr handle, IntPtr gch)
   at GLib.Signal.voidObjectCallback(IntPtr , IntPtr )
   at Gtk.Application.gtk_main()
   at Gtk.Application.gtk_main()
   at Gtk.Application.Run()
   at Banshee.Gui.GtkBaseClient.Run() in /home/aaron/svn/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs:line 107
   at Banshee.Gui.GtkBaseClient.Startup() in /home/aaron/svn/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs:line 55
   at Hyena.Gui.CleanRoomStartup.Startup(Hyena.Gui.StartupInvocationHandler startup) in /home/aaron/svn/banshee/src/Libraries/Hyena.Gui/Hyena.Gui/CleanRoomStartup.cs:line 54
   at Banshee.Gui.GtkBaseClient.Entry() in /home/aaron/svn/banshee/src/Core/Banshee.ThickClient/Banshee.Gui/GtkBaseClient.cs:line 50
   at Nereid.Client.Main() in /home/aaron/svn/banshee/src/Clients/Nereid/Nereid/Client.cs:line 45

Thanks,
Aaron

>>> Alex Hixon <hixon alexander mediati org> 03/13/08 2:50 AM >>>

Hi all/Aaron,

Linkied/inline (hopefully my mail client doesn't fsck it up)is a small
patch to resolve the now-playing delay thing (see earlier discussion on the
mailing list), and to fix a small UI bug where the Visit user page menuitem
would remain grayed out even though the user updated their account
information to use valid data.

Patch is also @ http://mediati.org/temp/as-patch.diff

Hopefully we get this in before tomorrow sometime. :)

Cheers,
Alex Hixon

Index:
src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs
===================================================================
---
src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs	(revision
3439)
+++
src/Extensions/Banshee.Lastfm/Banshee.Lastfm.Audioscrobbler/AudioscrobblerService.cs	(working
copy)
@@ -65,6 +65,8 @@
         private Account account;
         
         private bool queued; /* if current_track has been queued */
+        private bool now_playing_sent = false; /* self explanitory :) */
+        private int iterate_countdown = 4 * 4; /* number of times to wait
for iterate event before sending now playing */
         
         private DateTime song_start_time;
         private TrackInfo last_track;
@@ -97,6 +99,11 @@
                 connection.UpdateNetworkState (args.Connected);
             };
             
+            // Update the Visit action menu item if we update our account
info
+            LastfmCore.Account.Updated += delegate (object o, EventArgs
args) {
+                action_service["AudioscrobblerVisitAction"].Sensitive =
LastfmCore.Account.UserName != null && LastfmCore.Account.CryptedPassword
!= null;
+            };
+            
             ServiceManager.PlayerEngine.EventChanged +=
OnPlayerEngineEventChanged;
             
             action_service = ServiceManager.Get<InterfaceActionService>
("InterfaceActionService");
@@ -232,14 +239,8 @@
                     song_start_time = DateTime.Now;
                     last_track = ServiceManager.PlayerEngine.CurrentTrack;
                     queued = false;
-
-                    // Queue as now playing
-                    if (last_track != null &&
last_track.Duration.TotalSeconds > 30 &&
-                        (actions["AudioscrobblerEnableAction"] as
ToggleAction).Active) {
-                        
-                        connection.NowPlaying (last_track.ArtistName,
last_track.TrackTitle,
-                            last_track.AlbumTitle,
last_track.Duration.TotalSeconds, last_track.TrackNumber);
-                    }
+                    now_playing_sent = false;
+                    iterate_countdown = 4 * 4;  /* we get roughly 4
events/sec */
                     
                     break;
                 
@@ -248,11 +249,27 @@
                     break;
                 
                 case PlayerEngineEvent.Iterate:
+                    // 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) {
+                            
+                            connection.NowPlaying (last_track.ArtistName,
last_track.TrackTitle,
+                                last_track.AlbumTitle,
last_track.Duration.TotalSeconds, last_track.TrackNumber);
+                        }
+                        
+                        now_playing_sent = true;
+                    } else if (iterate_countdown > 0) {
+                        Console.WriteLine ("Skipping...");
+                        iterate_countdown --;
+                    }
+                    
                     st.IncreasePosition ();
                     break;
                 
                 case PlayerEngineEvent.EndOfStream:
                     Queue (ServiceManager.PlayerEngine.CurrentTrack);
+                    iterate_countdown = 4 * 4; 
                     break;
             }
         }

_______________________________________________
Banshee-list mailing list
Banshee-list gnome org
http://mail.gnome.org/mailman/listinfo/banshee-list



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