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

Hika van den Hoven hikavdh at gmail.com
Tue May 2 01:24:12 UTC 2023


Hoi Lists,

Monday, May 1, 2023, 7:30:27 PM, you 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?
>  

See here a Python module: https://drive.google.com/file/d/1PNFXNDc8hIBTbXVEO8TR_CXwTrm13aeY/view?usp=share_link

It is part of my project to manage up-time of my network. It has a
python Class MythData(name, log, **kwargs)

name is just for identification

log should be a function to process logging that accepts a message and
    a loglevel

as further qualified argument it expects "address" as a tuple of
ip-address or dns name and port to access the backend. It defaults to
('LocalHost', 6544)

The class contains functions to retrieve the list of upcoming
recordings, in-progress recordings, and idle gaps. Look for yourself.

There is a remarked out function to send the output to screen or file
for analysis. It converts json text dates and times to python datetime
values. If you still have an older python version, I think pre 3.6 you
will still need pytz for proper timezone handling.


Tot mails,
  Hika                            mailto:hikavdh at gmail.com

"Zonder hoop kun je niet leven
Zonder leven is er geen hoop
Het eeuwige dilemma
Zeker als je hoop moet vernietigen om te kunnen overleven!"

De lerende Mens



More information about the mythtv-users mailing list