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

Bill Meek keemllib at gmail.com
Mon May 1 18:00:47 UTC 2023


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20230501/edf2b07d/attachment.htm>


More information about the mythtv-users mailing list