eSpotify: Use a PS4 DualShock 4 to Control Spotify Functions Python Script

In PS4 Scene news this weekend developer hdhdhfhfirjf shared an eSpotify Python script on Github to control Spotify functions including PauseNext Song and Volume using a PS4 DualShock 4 Controller so you no longer have to tab out while gaming to perform them. 🎮

Download: / GIT / Spotify (Official Site)

Here’s further details from the README.mdeSpotify

Control Spotify with game controller (PlayStation / Xbox)

This will allow you control Spotify functions like pause, next song, volume with PS4 (possibly Xbox?) controller so you no longer have to take your hands off the controller for keyboard binds or tab out.

Feel free to make issues with suggestions or fork and improve.

Setup Instructions

  1. Create a Spotify developer app in Developer Portal
  2. Edit the Redirect URI for the created app: “http://localhost:8081
  3. Paste the Client Credentials into config.json (Client ID, Client Secret)
  4. Edit config as wanted and run the first time ran it should open the redirect URI in browser (you may have to login, if not accept the scope terms for Spotify API), this is far from perfect… threw together in a few hours, please make an issue if bugs are found

Controller Key Codes:

"x": 0,
"circle": 1,
"square": 2,
"triangle": 3,
"share": 4,
"PS": 5,
"options": 6,
"left_stick_click": 7,
"right_stick_click": 8,
"L1": 9,
"R1": 10,
"up_arrow": 11,
"down_arrow": 12,
"left_arrow": 13,
"right_arrow": 14,
"touchpad": 15

To do:

  • monitor the launch and close of a specific application
eSpotify Use a PS4 DualShock 4 to Control Spotify Functions Python Script.jpg