Get the recording_id of currently playing recording

I am working on a system whereby, using my home automation system, I can go into any room in the house that has Channels, hit a specific button on my remote and have it play whatever we were last watching in the Lounge.

I can do it easily if we were watching live TV - I just store the current channel number from the lounge and use the API /api/play/channel/:channel_number to go directly to that channel in the other room.

What would be great though is if we were watching a recording the same feature would also work. I have tested the API command /api/play/recording/recording_id which works fine once I look up the recording_id from the Server WebUI, but so far I haven't been able to find out the recording_id from the client API status. It gives lots of info about title, season, episode etc but not the recording_id.

Does anyone know an API command to get the recording_id either from the specific client playing it or from the server?

See if this server endpoint gets you what you need:

http://x.x.x.x:8089/dvr/files

Thanks. That does give me a complete list of all my recordings and includes the ID for each one, but it doesn't tell me which one is currently playing on a particular client.

I might be able to search within that output for the title/season/episode that I know from the API status data and get the ID that way, but that seems very long winded and prone to error.

We have no plans on exposing the recording id in the api status response, so @mike_here’s suggestion is the correct one.

Check extra response here:

OK. I'll have to set up a search for the recording id from the Summary/Season/Episode data that the status does give then. Thanks for the quick response.

Actually, why aren't you just using the API? This is the preferred stable way of fetching this information, rather than using the private endpoints like /dvr/files. It will also give you sorting options to you can just pick off the top.

You should be able to fetch the currently playing (or most recently played) recording with this:

Just episodes

http://$IP:8089/api/v1/episodes?sort=date_watched&order=desc

Just movies

http://$IP:8089/api/v1/movies?sort=date_watched&order=desc

All episodes, movies, and videos

http://$IP:8089/api/v1/all?sort=date_watched&order=desc

You can learn more with the API explorer found in your Channels DVR Server web admin under Support > API & Feeds

1 Like

Works perfectly :+1:

I was playing around in the API explorer but was still looking for currently playing. But last played order works great though, as you say just pick of the top of the list.

Thanks very much.