Skip to content

Python script using SpotifyAPI to display your current song and song playback position using the VRChat message box and OSC.

License

Notifications You must be signed in to change notification settings

Mezque/VRC-SpotifyOSC-Py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VRC-SpotifyOSC-Py

A simple Spotify OSC chatbox for VRChat using SpotifyAPI.

Key FeaturesHow To UseDownloadDev Portal InstructionsCreditsLicense

Key Features

  • Customizable
    • Able to change the chatbox text formatting very easy! Just change the formatting on
      Song1[0] = f"Now playing {cur_song} by {cur_artist} {time2}/{time1}" (time display/OSC always mode)
      or Song1[0] = f"Now playing {cur_song} by {cur_artist}" (send once per song mode).
  • Uses API
    • Slightly more optimized than reading the Spotify program name, or limiting to Windows only via usage of the godawful Windows Now Playing API, plus with the added song scrobble time feature returned by SpotifyAPI.
    • Able to display the current song playing on any device due to using API to retrieve playing information.
  • Cross platform
    • Windows, macOS and Linux ready.
  • Timestamp and song length display. (updated aprox every 5 seconds)
    Screenshot 2023-02-26 184155
  • Or alternatively only send playing song once per each song, checked for song change on a 2 second interval.
    image

Note : Usage of the Spotify API requires a premium account; this will not work with free accounts.

How To Use

To clone and run this application, you'll need Python and git (links for windows) From your command line:

# Clone this repository
$ git clone https://github.com/Mezque/VRC-SpotifyOSC-Py

# Go into the repository
$ cd VRC-SpotifyOSC-Py/Py/Spotify

# Install dependencies
$ pip install -r requirements.txt

# Run the app
$ py Spotify.py

Open Spotify.py and set client_id and client_secret to their respected value on your created application from the Spotify Dev Portal. Instructions here

Note If you're using Windows, there is included bat files to do step 3 and 4.
(if you choose to download below you don't need to clone the repositroy or install git)
If Python is failing to run properly on Windows install it from the Microsoft Store instead of the python website for an easy fix; this is a Windows problem to do with how python is set up under your system variables.

Download

You can download the latest version as well if you don't want to use git to clone the repository. It's the same thing just slower for people less experienced with usage of git through a CLI.

Spotify Dev Portal

How to set up the application,

  1. Head to the Spotify Dev Portal and log into your account.
  2. Press the green button on the top of the right side that says "Create an app", the name doesn't matter and a description is not required.
  3. Open up the newly created app and copy your Client ID and set this value in the Spotify.py file. Do the same thing for the Client Secret after pressing Show Client Secret.
  4. Press the green button around the same location where the create app button was on the previous menu and under the section "Redirect URIs" put http://localhost:8888/spotify/callback

Credits

This software uses the following open source packages:

License

MIT