<html><head></head><body><span class="viv-signature"></span>On Monday 01 
May 2023 12:30:27 PM (-05:00), Lists wrote:<br><br><blockquote 
style="margin: 0 0 0.80ex; border-left: #0000FF 2px solid; padding-left: 
1ex">
   
   
   <title>query database for program currently playing on a channel</title>


<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-family:arial, helvetica, sans-serif;font-size:11pt;">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-family:arial, helvetica, 
sans-serif;font-size:11pt;"><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-family:arial, helvetica, sans-serif;font-size:11pt;">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-family:arial, helvetica, 
sans-serif;font-size:11pt;"><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-family:arial, helvetica, sans-serif;font-size:11pt;">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-family:arial, helvetica, 
sans-serif;font-size:11pt;"><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-family:arial, helvetica, sans-serif;font-size:11pt;">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="font-family:Menlo;line-height:normal;font-size:11px;font-stretch:normal;font-variation-settings:normal;font-feature-settings:normal;font-optical-sizing:auto;font-kerning:auto;font-variant-alternates:normal;font-variant-east-asian:normal;font-variant-numeric:normal;margin-left:0px;margin-bottom:0px;margin-right:0px;margin-top:0px;"><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="font-family:Menlo;line-height:normal;font-size:11px;font-stretch:normal;font-variation-settings:normal;font-feature-settings:normal;font-optical-sizing:auto;font-kerning:auto;font-variant-alternates:normal;font-variant-east-asian:normal;font-variant-numeric:normal;margin-left:0px;margin-bottom:0px;margin-right:0px;margin-top:0px;"><span 
class="s1" 
style="font-variant-ligatures:no-common-ligatures;"><br></span></p>
<p class="p1" 
style="font-family:Menlo;line-height:normal;font-size:11px;font-stretch:normal;font-variation-settings:normal;font-feature-settings:normal;font-optical-sizing:auto;font-kerning:auto;font-variant-alternates:normal;font-variant-east-asian:normal;font-variant-numeric:normal;margin-left:0px;margin-bottom:0px;margin-right:0px;margin-top:0px;"><span 
class="s1" style="font-variant-ligatures:no-common-ligatures;">Any helpful 
suggestions?</span></p>
<p class="p1" 
style="font-family:Menlo;line-height:normal;font-size:11px;font-stretch:normal;font-variation-settings:normal;font-feature-settings:normal;font-optical-sizing:auto;font-kerning:auto;font-variant-alternates:normal;font-variant-east-asian:normal;font-variant-numeric:normal;margin-left:0px;margin-bottom:0px;margin-right:0px;margin-top:0px;"><span 
class="s1" 
style="font-variant-ligatures:no-common-ligatures;"><br></span></p>
<p class="p1" 
style="font-family:Menlo;line-height:normal;font-size:11px;font-stretch:normal;font-variation-settings:normal;font-feature-settings:normal;font-optical-sizing:auto;font-kerning:auto;font-variant-alternates:normal;font-variant-east-asian:normal;font-variant-numeric:normal;margin-left:0px;margin-bottom:0px;margin-right:0px;margin-top:0px;"><span 
class="s1" 
style="font-variant-ligatures:no-common-ligatures;"><br></span></p>

</blockquote><span class="viv-signature-below"><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><br>-- <br>Bill</span></body></html>