Ubuntu: Lock Screen and Pause Spotify

When I used a mac I had a shonky little applescript to pause iTunes when I locked the screen. These days I mostly listen to Spotify (running under wine) on Ubuntu which of course doesn't have applescript. What I wanted was a similar script so I can hit a keystroke…