Thursday, August 11, 2011

How To Make Grooveshark A Stand-Alone Application with Hot Keys, Part 2 of 2 for Windows Users

Click here for the first part of this tutorial.

Grooveshark logo


1. Download Wget for PC here and grab a copy of AutoHotKey here. Install both.

AutoHotkey logo


2. Open AutoHotkey, (it's located wherever you downloaded it). When it asks you if you want to generate a example script, click "Yes".



Create sample script in Auto Hot Key

3. Create a new hot key for Grooveshark by adding this line:
    HOTKEYS::Run, WGET_EXE --spider --no-cache KEYSHARKY_API, , Hide

4.  The "HOTKEYS" is where you define the keyboard shortcut. For example, you could put #G (Windows key and "G" key) See the AutoHotkey documentation for more info.

5. Replace the WGET_EXE with the path to the location of the wget executable. Normally it is installed in C:\Program Files (x86)\GnuWin32\bin\wget.exe If you are not sure where it was installed, go to the Start Menu>Run>cmd. Once you are in the command line, run this command:
     dir c:\ /s /b | find "wget.exe"
When it returns the path, copy and paste the path and replace the WGET_EXE section.

WGET command prompt


When you are all finished, the code will look similar to this, except the keyboard shortcut will be your own:
    !+z::Run, "C:\Program Files (x86)\GnuWin32\bin\wget.exe" --spider --no-cache "http://localhost:8800/play", , Hide
The above code will play/pause Grooveshark when ALT + SHIFT + Z is pressed.



6. Repeat steps 3-5 to add another hot key. See the below commands to change the hot key command.
Adding hot keys to Auto Hot Key

This is a list of all the keySharky commands. To change the hot key command, change the URL (http://localhost:8800/play)

Play/Pause current song:
http://localhost:PORT/play

Stop playing current song:
http://localhost:PORT/stop

Select previous song in playlist:
http://localhost:PORT/previous

Select next song in playlist:
http://localhost:PORT/next

Favorite current song:
http://localhost:PORT/favorite

Vote up current song:
http://localhost:PORT/voteup

Vote down current song:
http://localhost:PORT/votedown

Clear vote of current song:
http://localhost:PORT/voteclear

Toggle mute (>= version 1.5.2):
http://localhost:PORT/mute

Decrease volume (>= version 1.5.2):
http://localhost:PORT/voldown

Increase volume (>= version 1.5.2):
http://localhost:PORT/volup

Replace "PORT" with whatever port number you chose in the keySharky preferences.

The API server has access to every keyboard shortcut toggle in keySharky, so you can play, stop, select next song etc. easily with one of the above methods.

You are done!! Have fun using your Grooveshark player and thanks for following this tutorial. Please follow my blog if you liked this tutorial.

-- Matthew

No comments:

Post a Comment