Skip to content

curtisgibby/mpris-slack-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

MPRIS / Slack Integration

Why does this exist?

I wanted to be able to push my now-listening status (including album art) to my company's Slack.

Sounds cool. What do I need to do?

1. Create your config.json file

cp config.default.json config.json

2. Update your config.json file

Update slack-token (required)

Open the Slack customization page, e.g. subdomain.slack.com/customize. Open the console (F12) and paste:

window.prompt("Your API token is: ", TS.boot_data.api_token)

Copy the API token from the popup and replace YOUR_SLACK_TOKEN with your actual token.

Update emoji-name (optional)

Replace my-album-art with your desired Slack emoji name

3. Start your MPRIS-enabled media player

This integration has been tested on the following players:

You need to be playing your media before moving on to step 4.

4. Run the Python script

python mpris-track-change-to-slack.py

The script will let you know which media player it found. For example, I see this when I start Google Play Music:

Currently playing: Google Play Music Desktop Player

You can either wait until the current track finishes playing on its own, or if you're feeling impatient, skip to the next track to manually trigger the "track change" functionality. The script will attempt to:

  • save your album art as a Slack emoji and
  • set your status to the now-playing text including the artist and title and the album-art emoji
Attempting to set status: Now Playing: INXS - Devil Inside
Success

If the script is unable to create the album-art emoji (because of a bad token, no local album art, whatever), it will try to set the status using a standard emoji instead, randomly picking one of the following:

  • 💿 (:cd:)
  • 🎧 (:headphones:)
  • 🎵 (:musical_note:)
  • 🎶 (:notes:)
  • 📻 (:radio:)

Whom should I thank?

Thanks to Jack Ellenberger (@jackellenberger) for his ":slack_on_fire:" article and his emojme library (particularly emoji-add.js) for helping me figure out how to push an emoji to Slack's undocumented /api/emoji.add endpoint.

About

Push MPRIS (now playing information) into Slack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages