<html><head></head><body><span class="viv-signature"></span>On Monday 01 
May 2023 03:00:41 PM (-05:00), Lists wrote:<br><br><blockquote 
style="margin: 0 0 0.80ex; border-left: #0000FF 2px solid; padding-left: 
1ex">
   
   
   <title>RE: [mythtv-users] How can I query database for the details of 
the program currently playing on a channel?</title>


<p style="font-size:11pt;font-family:arial, helvetica, 
sans-serif;min-height:11pt;margin-left:0px;margin-bottom:0px;margin-right:0px;margin-top:0px;padding-left:0px;padding-bottom:0px;padding-right:0px;padding-top:0px;"><br></p>

<p style="font-size:11pt;font-family:arial, helvetica, 
sans-serif;min-height:11pt;margin-left:0px;margin-bottom:0px;margin-right:0px;margin-top:0px;padding-left:0px;padding-bottom:0px;padding-right:0px;padding-top:0px;"><br></p>

<blockquote 
style="margin-left:5px;margin-bottom:1em;margin-right:5px;margin-top:0px;padding-left:5px;border-left-color:rgb(50, 
95, 186);border-left-style:solid;border-left-width:2px;"><span 
style="font-size:10pt;font-family:tahoma, arial, helvetica, 
sans-serif;">-----Original message-----<br><span><strong>From:</strong> 
Bill 
Meek <keemllib@gmail.com></span><br><span><strong>Sent:</strong> 
Monday 1st May 2023 19:00</span><br><span><strong>To:</strong> Discussion 
about MythTV <mythtv-users@mythtv.org>; Lists 
<lists@the-pearsons.co.uk></span><br><span><strong>Subject:</strong> 
Re: [mythtv-users] How can I query database for the details of the program 
currently playing on a channel?</span><br><br></span>On Monday 01 May 2023 
12:30:27 PM (-05:00), Lists wrote:<br><br>
<blockquote style="padding-left:1ex;border-left-color:rgb(0, 0, 
255);border-left-style:solid;border-left-width:2px;margin-left:0px;margin-bottom:0.8ex;margin-right:0px;margin-top:0px;">

<p 
style="margin-left:0px;margin-bottom:0px;margin-right:0px;margin-top:0px;padding-left:0px;padding-bottom:0px;padding-right:0px;padding-top:0px;"><span 
style="font-size:11pt;font-family:arial, helvetica, sans-serif;">Hi 
all,<br></span></p>
<p 
style="margin-left:0px;margin-bottom:0px;margin-right:0px;margin-top:0px;padding-left:0px;padding-bottom:0px;padding-right:0px;padding-top:0px;"><span 
style="font-size:11pt;font-family:arial, helvetica, 
sans-serif;"><br></span></p>
<p 
style="margin-left:0px;margin-bottom:0px;margin-right:0px;margin-top:0px;padding-left:0px;padding-bottom:0px;padding-right:0px;padding-top:0px;"><span 
style="font-size:11pt;font-family:arial, helvetica, sans-serif;">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.</span></p>
<p 
style="margin-left:0px;margin-bottom:0px;margin-right:0px;margin-top:0px;padding-left:0px;padding-bottom:0px;padding-right:0px;padding-top:0px;"><span 
style="font-size:11pt;font-family:arial, helvetica, 
sans-serif;"><br></span></p>
<p 
style="margin-left:0px;margin-bottom:0px;margin-right:0px;margin-top:0px;padding-left:0px;padding-bottom:0px;padding-right:0px;padding-top:0px;"><span 
style="font-size:11pt;font-family:arial, helvetica, sans-serif;">so my 
query would be something like</span></p>
<p 
style="margin-left:0px;margin-bottom:0px;margin-right:0px;margin-top:0px;padding-left:0px;padding-bottom:0px;padding-right:0px;padding-top:0px;"><span 
style="font-size:11pt;font-family:arial, helvetica, 
sans-serif;"><br></span></p>
<p 
style="margin-left:0px;margin-bottom:0px;margin-right:0px;margin-top:0px;padding-left:0px;padding-bottom:0px;padding-right:0px;padding-top:0px;"><span 
style="font-size:11pt;font-family:arial, helvetica, sans-serif;">select 
rating from programrating where programrating.system like "%British%" and 
starttime like (select starttime from "currently showing program query") 
and chanid like </span></p>
<p class="p1" 
style="margin-left:0px;margin-bottom:0px;margin-right:0px;margin-top:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-optical-sizing:auto;font-feature-settings:normal;font-variation-settings:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;"><span 
class="s1" style="font-variant-ligatures:no-common-ligatures;">(select 
chanid from channel where channum = "402" and sourceid = 2);</span></p>
<p class="p1" 
style="margin-left:0px;margin-bottom:0px;margin-right:0px;margin-top:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-optical-sizing:auto;font-feature-settings:normal;font-variation-settings:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;"><span 
class="s1" 
style="font-variant-ligatures:no-common-ligatures;"><br></span></p>
<p class="p1" 
style="margin-left:0px;margin-bottom:0px;margin-right:0px;margin-top:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-optical-sizing:auto;font-feature-settings:normal;font-variation-settings:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;"><span 
class="s1" style="font-variant-ligatures:no-common-ligatures;">Any helpful 
suggestions?</span></p>
<p class="p1" 
style="margin-left:0px;margin-bottom:0px;margin-right:0px;margin-top:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-optical-sizing:auto;font-feature-settings:normal;font-variation-settings:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;"><span 
class="s1" 
style="font-variant-ligatures:no-common-ligatures;"><br></span></p>
<p class="p1" 
style="margin-left:0px;margin-bottom:0px;margin-right:0px;margin-top:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-variant-alternates:normal;font-kerning:auto;font-optical-sizing:auto;font-feature-settings:normal;font-variation-settings:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;"><span 
class="s1" 
style="font-variant-ligatures:no-common-ligatures;"><br></span></p>
</blockquote>
<div><span class="viv-signature-below"><br></span></div>
<div><span class="viv-signature-below">The Services API has an endpoint you 
may like:</span></div>
<div><span class="viv-signature-below"><br></span></div>
<div><span class="viv-signature-below">  curl --silent --header 
'Accept:Application/JSON' localhost:6547/Frontend/GetStatus|</span></div>
<div><span class="viv-signature-below"><br></span></div>
<div><span class="viv-signature-below">You can pipe the output to json_pp 
if you want something nice to look at. Otherwise,</span></div>
<div><span class="viv-signature-below">the output is on a single line. If 
you omit the --header, the output will be in XML if</span></div>
<div><span class="viv-signature-below">you prefer. </span></div>
<div><span class="viv-signature-below"><br></span></div>
<div><span class="viv-signature-below">There are Python tools that can 
help. 
See: https://www.mythtv.org/wiki/Python_API_Examples#The_Myth.2FGetTimeZone_endpoint_example</span></div>

<div><span class="viv-signature-below">for an example. Then you can filter 
out just the info you want.</span></div>
<span class="viv-signature-below"></span></blockquote><span 
class="viv-signature-below"><br>-- <br>Bill</span></blockquote><br><blockquote 
style="margin: 0 0 0.80ex; border-left: #0000FF 2px solid; padding-left: 
1ex"><span 
class="viv-signature-below"></span></blockquote><div><br></div><div>curl 
--silent --header 'Accept:Application/JSON' 
localhost:6544/Dvr/GetEncoderList | 
json_pp</div><div><br></div><div><br></div></body></html>