Plex What's Playing Plugin for BitBar

This is a Bitbar plugin that I wrote that shows you what’s currently playing on your Plex Media server.

BitBar Plex

Requirements

This plugin / script uses bash. Additionally you’ll need the following packages installed:

  • Imagemagick: used for the mogrify command.
  • base64: used to convert image into a format BitBar can handle easily
  • curl: used to make API calls to Plex

To see if you have these installed, open a terminal in OS X and run:

1
2
3
4
which mogrify
which base64
which curl
which ping

On my Macbook, these files are:

1
2
3
4
- /usr/local/bin/mogrify
- /usr/bin/base64
- /usr/bin/curl
- /bin/ping

Adjust these paths if necessary. If you don’t have these programs, you can install them using brew: brew install <app name>.

Usage

Install into your Bitbar plugin directory. Update the environment variables for your configuration. The pinghost variable can be the same as the plexhost variable (presuming the server is pingable).

Configuration

Update the values in the plugin as follows:

Rename the plugin to adjust how frequently it refreshes. I don’t recommend setting too low of a refresh rate, but your usage may vary. The default is 1 minute, hence the .1m. in the filename.

  • The pinghost value is used to see if the Plex host server is up. It is mostly used for laptops where networks can change. The script won’t attempt to curl the Plex identity if the host is unreachable. If your Plex server isn’t pingable, this value can changed to any other pingable host on your network.
  • The plexhost value is the hostname or IP address of your Plex server.
  • The plextoken value is your Plex authentication token. You can see how to get it here
  • The serverid value is your local Plex server’s UUID. You can find it in the address bar. In this example, it’s 867c53098dc5feccea1cb108c18448cd6af92:

serverid is in the address bar on a detail page

Troubleshooting

If you have problems or bitbar doesn’t respond, kill the BitBar.app process. Find the process ID with:

1
2
$ ps aux | grep -i bitbar | egrep -v grep
username 1993 0.0 0.2 5116184 35752 ?? S Mon02PM 2:14.61 /Applications/BitBar.app/Contents/MacOS/BitBar

Now kill the process ID, in this case 1993:

1
$ kill -9 1993

Move the plugins out of the plugin directory and restart Bitbar. Replace the plugins back into the plugin directory until you find the one causing a problem.

To Do

  • Add support for Music
  • Display currently playing Trailer
  • Clean up the code
  • Possibly rewrite the code (python)

Misc

Join the conversation with plugin authors and BitBar maintainers on Slack

Plex is registered trademark of Plex.

Author

Chris Bergeron

Posted on

02-19-2019

Updated on

07-01-2022

Licensed under

Comments