Get a count of scheduled recordings from the command-line

BTW, still really love Plex, it is the best; I am just relaying my pain in losing two weeks of recordings before realizing the issue. Missing one week of shows, you say, maybe there was no new episode this week; but two weeks needs investigation.

I have been burned a couple of time in the last few months with the EPG changes. First it stopped downloading based on the cable provider selected, and more recently, it looks like all the Show ID’s were changed, as all my scheduled recordings changed to “No upcoming episodes”, even though my Program Guide was complete with data. I had to re-lookup every show and re-schedule the recording, leaving me with show schedules for each show. I still need to adjust the recording priorities.

So my ask, can I query the database to get a list of upcoming shows to be recorded, or a count of how many shows there are in the recording schedule. I plan to use that as part of an alerting system to let me know there is an issue. Either on when the total number recordings drops below a level or if there 1 or less episodes of a specific show in my recording list.

I am currently running the server on Windows, but I not tied to staying there. So a method of reading the database on Windows and/or Linux is what I am really looking for, and perhaps some guidance on where to find the scheduled recordings in the Database.

Thanks,
Ed

Server Version#: 1.18.0.1944
Player Version#: Various

Browse towards http://<IP_OF_PMS>:32400/media/subscriptions?X-Plex-Token=<YOUR-TOKEN>

To get your token, look here:

When browsing, it should show you an output like:

<MediaContainer size="1">
<MediaSubscription key="126" type="4" targetLibrarySectionID="16" title="This Event">
<Video grandparentGuid="tv.plex.xmltv://show/Formel%201%3A%20Mexicos%20Grand%20Prix" grandparentThumb="http://images.yousee.tv/pics/182377432/1440x1080.jpg" grandparentTitle="Formel 1: Mexicos Grand Prix" guid="tv.plex.xmltv://episode/Formel%201%3A%20Mexicos%20Grand%20Prix/2019/18" index="18" parentIndex="2019" tagline="This Event" title="Sæson: 2019" type="episode"/>
</MediaSubscription>
</MediaContainer>

And in above, MediaContainer size="1" is the count of recordings you have scheduled

1 Like

Excellent, thanks Dane22.

2 Likes

Dane,

Not exactly what I was looking for, likely a problem with my question.

This appears to show number of series I have set to record, what I am looking for is the number of episodes which will be recorded in the future. i.e. we have two weeks of EPG info, Survivor is set to record All New Episodes. There are two new episodes in the EPG which will be recorded. I would like to get that 2 returned, or a total of all episodes of all shows which will be recorded. Either value would be useful.

What I m looking for is likely close to where this data is in the database.

BTW, great to know that so much data is accessible via the web interface.

Thanks.

The count is number of movies or series to be recorded.

If a serie is set to record all episodes, you’ll have to digest that your self from the returned XML

Like in below, where I’ve set my PMS to record the danish news:

<MediaGrabOperation mediaSubscriptionID="190" mediaIndex="0" key="/media/grabbers/operations/9351505fc07357dbc56a25086d842654945198d8" grabberIdentifier="tv.plex.grabbers.hdhomerun" grabberProtocol="livetv" deviceID="1" status="scheduled" provider="tv.plex.providers.epg.xmltv:68">
<Video addedAt="1571538032" duration="1800000" grandparentGuid="tv.plex.xmltv://show/Nyhederne" grandparentKey="/tv.plex.providers.epg.xmltv:68/metadata/tv%2Eplex%2Exmltv%3A%2F%2Fshow%2FNyhederne" grandparentRatingKey="tv%2Eplex%2Exmltv%3A%2F%2Fshow%2FNyhederne" grandparentSubscriptionID="190" grandparentSubscriptionType="show" grandparentThumb="http://images.yousee.tv/pics/180173284/1440x1080.jpg" grandparentTitle="Nyhederne" guid="tv.plex.xmltv://episode/Nyhederne/1/1" index="1" key="/tv.plex.providers.epg.xmltv:68/metadata/tv%2Eplex%2Exmltv%3A%2F%2Fepisode%2FNyhederne%2F1%2F1" parentGuid="tv.plex.xmltv://season/Nyhederne/1" parentIndex="1" parentTitle="Season 1" ratingKey="tv%2Eplex%2Exmltv%3A%2F%2Fepisode%2FNyhederne%2F1%2F1" skipParent="1" summary="Der findes ingen beskrivelse til denne udsendelse." title="Episode 1" type="episode">
<Media audioChannels="2" beginsAt="1572199200" channelCallSign="TV 2 Danmark" channelID="3" channelIdentifier="3" channelThumb="http://cloud.yousee.tv/static/img/logos/Large_Tv2.png" channelTitle="3 TV 2 Danmark" duration="1800000" endsAt="1572201000" id="9186" premiere="1" protocol="livetv" videoResolution="720"> </Media>
<Media audioChannels="2" beginsAt="1572285600" channelCallSign="TV 2 Danmark" channelID="3" channelIdentifier="3" channelThumb="http://cloud.yousee.tv/static/img/logos/Large_Tv2.png" channelTitle="3 TV 2 Danmark" duration="1800000" endsAt="1572287400" id="9288" premiere="1" protocol="livetv" videoResolution="720"> </Media>
<Media audioChannels="2" beginsAt="1572294600" channelCallSign="TV 2 Danmark" channelID="3" channelIdentifier="3" channelThumb="http://cloud.yousee.tv/static/img/logos/Large_Tv2.png" channelTitle="3 TV 2 Danmark" duration="1800000" endsAt="1572296400" id="9292" premiere="1" protocol="livetv" videoResolution="720"> </Media>
<Media audioChannels="2" beginsAt="1572372000" channelCallSign="TV 2 Danmark" channelID="3" channelIdentifier="3" channelThumb="http://cloud.yousee.tv/static/img/logos/Large_Tv2.png" channelTitle="3 TV 2 Danmark" duration="1800000" endsAt="1572373800" id="9379" premiere="1" protocol="livetv" videoResolution="720"> </Media>
<Media audioChannels="2" beginsAt="1572381000" channelCallSign="TV 2 Danmark" channelID="3" channelIdentifier="3" channelThumb="http://cloud.yousee.tv/static/img/logos/Large_Tv2.png" channelTitle="3 TV 2 Danmark" duration="1800000" endsAt="1572382800" id="9383" premiere="1" protocol="livetv" videoResolution="720"> </Media>
</Video>
</MediaGrabOperation>

Hint: count above word in the returned xml :wink:

That looks like what I am looking for.

Did you query a different object to get that output?

My output does not include any or tags. Only the tags like this.

<MediaContainer size="57">
<MediaSubscription key="56" type="2" targetLibrarySectionID="6" createdAt="1521603408" title="All Episodes">
<Directory guid="plex://show/5cffa17249fba9001ea19888" mediaProviderID="3" thumb="http://cps-static.rovicorp.com/2/Open/NBC_6/Program/22055953/Brooklyn%20Nine-Nine_sc03.jpg" title="Brooklyn Nine-Nine" type="show" year="2013"/>
</MediaSubscription>
<MediaSubscription key="9" type="2" targetLibrarySectionID="6" createdAt="1519079235" title="All Episodes">
<Directory guid="plex://show/5cffa18cd5c642001dd4f1de" mediaProviderID="3" thumb="http://cps-static.rovicorp.com/2/Open/CBS_2/Program/37805294/37802455_AmazingRace_S31_VSC.jpg" title="The Amazing Race" type="show" year="2001"/>
</MediaSubscription>

Forgot to flag as preformatted text. My output does not include the <MediaGragOperation>, <Video> or <Media Tags>.
:slight_smile:

If you can tell me the URL you accessed for your data, or alternatively…

When browsing to different location (http://:32400/media/providers?X-Plex-Token=), I did come across

<MediaProvider>
<Feature>
<Directory>
<Pivot>

Which has view://dvr/recording-schedule
<Pivot key="view://dvr/recording-schedule" type="view" title="DVR Schedule" context="content.dvr.schedule"/>

But I don’t know how to access that object, which looks promising.

Ah, found it. /media/subscriptions/scheduled
Thanks again.
Ed

1 Like

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