[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:00:41 UTC 2023
-----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
Thanks Bill,
The endpoint is a good possibility, but unfortunately I need this for the Backend, since it's for setting up recordings, rather than watching live tv on a frontend.
I've taken a closer look at the API and GetProgramDetails looked like a possibility, but it requires the Program Start time, which is the information I'm actually trying to find to feed into my SQL search above.
What I need is the start time of the current program on channel number xxx.
Regards,
Dave.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20230501/4b070700/attachment.htm>
More information about the mythtv-users
mailing list