Play Track/Album/Playlist on Headless RPi Using Python Code

Is it possible to have Plexamp play a song/album/playlist from a link (hopefully the “listen.plex.tv” url) on a headless raspberry pi? My goal would be to run a python command (with the url hardcoded) to play a specific album from my library on the headless raspberry pi directly.

For context, I have been looking into making a modern day record player thing, where I would tap a specific NFC chip to my raspberry pi to play an album. I have found guides for a spotify-based version, but I was hoping to use my own Plex music library. I have seen that I can install plexamp on a pi and control it from my phone, but I haven’t seen anything about controlling plexamp with python code.

Thanks in advance!

the headless pi has an http api so yes, technically it’s possible. look at the log while you control it re lately and you’ll see how to use it.

For an NFC implementation, you can take a look at this project I put together:

It’s Node, not Python though, so if that matters to you and you’d rather roll your own solution, it might be a good starting point :slightly_smiling_face:

thanks guys!

I ended up using the Plex API (Table of Contents — Python PlexAPI documentation) so that I could run python code to play specific albums and playlists

If anyone comes across this in the future, I used something like this:

account = MyPlexAccount(<username>, <password>)
plex = account.resource(<servername>).connect()
plex.client(<RaspberryPiClientName>).playMedia(<AlbumGUID>)

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.