# Get currently playing song (Plex Headless)

**URL:** <https://forums.plex.tv/t/get-currently-playing-song-plex-headless/819275>\
**Category:** Plex Labs\
**Tags:** plexamp\
**Created:** [November 20, 2022, 3:15pm UTC](https://forums.plex.tv/t/get-currently-playing-song-plex-headless/819275 "2022-11-20T15:15:34Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul-Vincent\_Roll](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/paul-vincent_roll/32/268001_2.png) [@Paul-Vincent\_Roll](https://forums.plex.tv/u/Paul-Vincent_Roll)\
**Post date:** [November 20, 2022, 3:15pm UTC](https://forums.plex.tv/t/get-currently-playing-song-plex-headless/819275/1 "2022-11-20T15:15:34Z")

</div>

Hi there,  
is there a possibility to get the currently playing song for displaying it on a screen via a local API or linux socket on the same device Plex amp is running? A playback position would also be awesome!

Best,  
Paul

---

<div class="post-metadata">

**Author:** ![elan](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/elan/32/5_2.png) [@elan](https://forums.plex.tv/u/elan)\
**Post date:** [November 20, 2022, 9:35pm UTC](https://forums.plex.tv/t/get-currently-playing-song-plex-headless/819275/2 "2022-11-20T21:35:13Z")

</div>

Hit `curl http://xxx:32500/:/eventsource/notifications` with any player, as long as it has remote control enabled.

---

<div class="post-metadata">

**Author:** ![Paul-Vincent\_Roll](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/paul-vincent_roll/32/268001_2.png) [@Paul-Vincent\_Roll](https://forums.plex.tv/u/Paul-Vincent_Roll)\
**Post date:** [November 20, 2022, 9:55pm UTC](https://forums.plex.tv/t/get-currently-playing-song-plex-headless/819275/3 "2022-11-20T21:55:15Z")

</div>

Awesome thank you!

---

<div class="post-metadata">

**Author:** ![shinedou](https://avatars.discourse-cdn.com/v4/letter/s/b487fb/32.png) [@shinedou](https://forums.plex.tv/u/shinedou)\
**Post date:** [November 29, 2022, 12:42am UTC](https://forums.plex.tv/t/get-currently-playing-song-plex-headless/819275/4 "2022-11-29T00:42:27Z")

</div>

@Paul-Vincent_Roll How are you planning on using this? I am very interested in a now playing function. Thanks

---

<div class="post-metadata">

**Author:** ![Paul-Vincent\_Roll](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/paul-vincent_roll/32/268001_2.png) [@Paul-Vincent\_Roll](https://forums.plex.tv/u/Paul-Vincent_Roll)\
**Post date:** [November 29, 2022, 6:03am UTC](https://forums.plex.tv/t/get-currently-playing-song-plex-headless/819275/5 "2022-11-29T06:03:02Z")

</div>

You can see it [here](https://whisper.tf/@paul/109386784077299380).

---

<div class="post-metadata">

**Author:** ![Nojeee](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@Nojeee](https://forums.plex.tv/u/Nojeee)\
**Post date:** [December 7, 2022, 1:18pm UTC](https://forums.plex.tv/t/get-currently-playing-song-plex-headless/819275/6 "2022-12-07T13:18:23Z")

</div>

A quick query about this; I have Plexamp running under Windows 10 on a NUC that connects to my amp. Everything works fine but I’d like to be able to display the Now Playing information on a Pi that’s also showing other information. Is there any way of accessing the elapsed time from the player? The suggestion above returns artist, track and album information plus total duration but I don’t understand the “time” value - it doesn’t reflect the current position in a track? Is there a way of polling the player to get this information? I’ve spent hours searching for a solution but can’t find a simple way to retrieve the required infomation.

Many thanks.

---

<div class="post-metadata">

**Author:** ![Paul-Vincent\_Roll](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/paul-vincent_roll/32/268001_2.png) [@Paul-Vincent\_Roll](https://forums.plex.tv/u/Paul-Vincent_Roll)\
**Post date:** [December 7, 2022, 1:39pm UTC](https://forums.plex.tv/t/get-currently-playing-song-plex-headless/819275/7 "2022-12-07T13:39:18Z")

</div>

Time is the position in ms. Starting a timer when the info is received and then counting up works for me to get the current position.

---

<div class="post-metadata">

**Author:** ![Nojeee](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@Nojeee](https://forums.plex.tv/u/Nojeee)\
**Post date:** [December 7, 2022, 2:13pm UTC](https://forums.plex.tv/t/get-currently-playing-song-plex-headless/819275/8 "2022-12-07T14:13:31Z")

</div>

Thanks for the reply - I did wonder if I’d have to maintain a timer from the start of the track. I checked a number of tracks and the duration in ms is fine … it’s just the actual "time’ value which didn’t seem to relate to anything.

My main reason for asking is because I’ve been working on a Pi with official 7" display that monitors a Sonos player. This works fine, and along with album art and track info shows elapsed time and a progress bar. The problem is that there are stability issues casting from Plexamp using my iPad. I was hoping to keep all of the Sonos monitoring working and just switch to the Plexamp information when it’s active. I think I have some experimenting to do - I’m new to all of this 😉

---

<div class="post-metadata">

**Author:** ![Paul-Vincent\_Roll](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/paul-vincent_roll/32/268001_2.png) [@Paul-Vincent\_Roll](https://forums.plex.tv/u/Paul-Vincent_Roll)\
**Post date:** [December 7, 2022, 2:17pm UTC](https://forums.plex.tv/t/get-currently-playing-song-plex-headless/819275/9 "2022-12-07T14:17:38Z")

</div>

You have to start a timer from when you receive the data as the time stamp is the playback position at the time the data is send (as far as I figured). You also get updates on pause / skip / scrub etc.

Yeah I am doing the same with airplay and plexamp both use the same interface.

The way I do it is:  
Store a time stamp when the data is received.  
On display update get a new time stamp, calculate the time elapse since the data was received and now and add it to the received time stamp.

---

<div class="post-metadata">

**Author:** ![Nojeee](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@Nojeee](https://forums.plex.tv/u/Nojeee)\
**Post date:** [December 7, 2022, 3:13pm UTC](https://forums.plex.tv/t/get-currently-playing-song-plex-headless/819275/10 "2022-12-07T15:13:14Z")

</div>

Thanks again for the help - it’s much appreciated. I’ll try to incorporate the Plexamp method into my current code and see how it goes. This is all a long way from writing assembler in the 80’s!

---

<div class="post-metadata">

**Author:** ![Nojeee](https://avatars.discourse-cdn.com/v4/letter/n/b5ac83/32.png) [@Nojeee](https://forums.plex.tv/u/Nojeee)\
**Post date:** [December 9, 2022, 12:27pm UTC](https://forums.plex.tv/t/get-currently-playing-song-plex-headless/819275/11 "2022-12-09T12:27:45Z")

</div>

That now works fine with my code and, as you say, you automatically get notified of change of status - perfect! The only thing I’m missing is the album art of the currently playing track. I realise that you’re using a text display but wondered if there’s a way to get a URL to the artwork from the information returned.I guess the track’s GUID could be used with the server to return a URL to the artwork? Failing that, if there’s a way to find the source directory of the track that’s playing I could pull in the folder.jpg

I see there are Python Plex API’s available that may help but wondered if there’s a simpler solution?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [March 9, 2023, 12:27pm UTC](https://forums.plex.tv/t/get-currently-playing-song-plex-headless/819275/12 "2023-03-09T12:27:59Z")

</div>

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