[mythtv-users] How can I query database for the details of the program currently playing on a channel?

Lists lists at the-pearsons.co.uk
Mon May 1 20:34:04 UTC 2023


-----Original message-----
From: Bill Meek <keemllib at gmail.com>
Sent: Monday 1st May 2023 21:09
To: Lists <lists at the-pearsons.co.uk>; Discussion about MythTV <mythtv-users at mythtv.org>
Subject: RE: [mythtv-users] How can I query database for the details of the program currently playing on a channel?

On Monday 01 May 2023 03:00:41 PM (-05:00), Lists wrote:





-----Original message-----
From: Bill Meek <keemllib at gmail.com>
Sent: Monday 1st May 2023 19:00
To: Discussion about MythTV <mythtv-users at mythtv.org>; Lists <lists at the-pearsons.co.uk>
Subject: Re: [mythtv-users] How can I query database for the details of the program currently playing on a channel?

On Monday 01 May 2023 12:30:27 PM (-05:00), Lists wrote:

Hi all,



I'm looking for some guidance so that when I use my channel change script to select a channel, I can also query the database to find out what is showing on that channel and what time it started - I need my. script to get the rating from the programratings table, which only has chanid and starttime to search on.



so my query would be something like



select rating from programrating where programrating.system like "%British%" and starttime like (select starttime from "currently showing program query") and chanid like 

(select chanid from channel where channum = "402" and sourceid = 2);



Any helpful suggestions?






The Services API has an endpoint you may like:

  curl --silent --header 'Accept:Application/JSON' localhost:6547/Frontend/GetStatus|

You can pipe the output to json_pp if you want something nice to look at. Otherwise,
the output is on a single line. If you omit the --header, the output will be in XML if
you prefer. 

There are Python tools that can help. See: https://www.mythtv.org/wiki/Python_API_Examples#The_Myth.2FGetTimeZone_endpoint_example
for an example. Then you can filter out just the info you want.

-- 
Bill

curl --silent --header 'Accept:Application/JSON' localhost:6544/Dvr/GetEncoderList | json_pp

Thanks Bill,



that looks as though it could give me enough information to create my query - it may even give me the Movie age rating, if I set up a movie to record (unfortunately my tuners are all busy at the moment, so I'll check that later) - there's a lot more information given than I expected when I saw that DVR option in the list.



Regards,

Dave.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20230501/86b64023/attachment.htm>


More information about the mythtv-users mailing list