1

Closed

Hotkeys can skip multiple songs

description

As per report from jalude55:
 
Changed ActionHookCallback after creating a public static Boolean called IsProcessing in the hotkey class. It would skip more than one track when skipping tracks. This seems to work a lot better for me although i'm sure this is a much better way to solve this issue.
 
internal static void ActionHookCallback(Hotkey hotkey)
   {
       if (Hotkey.IsProcessing)
           return;
       Hotkey.IsProcessing = true;
       string currentTrack = string.Empty;

       try
       {
           string trackBeforeAction = Spotify.GetCurrentTrack();
           if (hotkey.Action == SpotifyAction.CopyTrackInfo && !string.IsNullOrEmpty(trackBeforeAction))
               Clipboard.SetText(string.Format(SettingsXml.Current.ClipboardTemplate, trackBeforeAction));
           else
               Spotify.SendAction(hotkey.Action);
 
           Toast.Current.DisplayAction(hotkey.Action, trackBeforeAction);
       }
       catch (Exception ex)
       {
           System.Diagnostics.Debug.WriteLine("Exception with hooked key! " + ex);
           Toast.Current.Title1.Text = "Unable to communicate with Spotify";
           Toast.Current.Title2.Text = "";
           Toast.Current.FadeIn();
       }
       System.Threading.Thread.Sleep(400);
       Hotkey.IsProcessing = false;
   }

file attachments

Closed by

comments

jalude55 wrote Aug 25, 2011 at 8:42 PM

I have attached my proposed bug fix so it is easier for you to take a look at it.

nachmore wrote Aug 26, 2011 at 9:00 AM

I just made the below checkin. Please let me know if this doesn't solve the issue for you - at this point I can't repro it exactly on any of my machines (single taps only advance single songs), but this should still solve the issue according to your description. You can find the diff of the change at http://toastify.codeplex.com/SourceControl/changeset/changes/69336#Toastify%2fToast.xaml.cs.

BUG 9421: Added a buffer between hotkey processing during which time repeated hotkey presses will be ignored. This is currently set to 150ms. For accessibility (if there is a need) we could modify this slightly in the future to read from Settings and to support a setting that disallowed continuous press on a hotkey.

Thanks for reporting this and proposing a fix!

nachmore wrote Aug 30, 2011 at 9:47 PM

jalude55 has confirmed that the fix fixes his issue. I'll spin a new build and close this bug when that is published.

matssee wrote Oct 12, 2011 at 7:36 AM

I just installed 1.5 Beta, and every time I use the hotkeys, it skips multiple songs.

razzle22 wrote Jul 27, 2012 at 2:31 PM

Toastify still skips multiple songs when I press the next track hotkey and also results in a delay of a few seconds between songs. This is most annoying, especially if I want to play through an album, though I am very happy with it otherwise.
It is also pauses fine but tries to play/pause/play/pause repeatedly sometimes when I want it to resume.

Can you please sort this?

rubenmp8 wrote Oct 23, 2012 at 10:20 PM

Note that 1.5 was released BEFORE this patch. If you want this fix, you will have to compile from source. However, the latest version did fix this problem for me.