[mythtv-users] Changing channels online via webpage

Raymond Wagner raymond at wagnerrp.com
Fri Nov 13 08:16:04 UTC 2009


On 11/13/2009 02:36, Michael T. Dean wrote:
> On 11/13/2009 02:13 AM, Marius Schrecker wrote:
>>
>> My cable company offers an online channel guide with the possibility  
>> to change channel instantly, or for a planned showing. I can script 
>> the actions using selenium, so should be able to substitute the 
>> regular channel changer with this selenium script. The only problem 
>> is that the change needs the exact program name and time slot as the 
>> argument, and not the channel id. Does anyone know how I could easily 
>> extract this information from mythtv to feed to selenium? By doing 
>> this I'd bypass using the hd-pvr ir blaster, and be more robust 
>> against channel numbering changes.
>>
>>
>> The guide is here for anyone who's interested:
>>
>> https://tvguide.altibox.no/tvguide.html?channellist=1
>>
>> I'd also be interested if there is any way to parse this kind of page 
>> and feed to xmltv, as tv_grab_no is incomplete and unreliable at the 
>> moment.
>>
> You may also be able to do something with the bindings--the Python 
> bindings may actually have something to get you exactly what you 
> need.  I'll defer to Raymond Wagner (or someone else who knows the 
> Python bindings).

If the recording has officially started, it's very simple.

import MythTV
myth = MythTV.MythTV()
pg = myth.getCurrentRecording("<tuner id>")

Then the values of interest would be 'pg.title', 'pg.starttime', and 
'pg.endtime'.

If the recording does not officially start until the channel changer 
script has returned, it's a bit more difficult.

import MythTV
myth = MythTV.MythDB()
pg = db.getGuideData(<chanid>,<date>)

Date is the current date in the form 'YYYYMMDD'.  This returns a list of 
programs for that day, takes a couple seconds to run, and then you have 
to sort through them afterwards.  This is just a canned SQL query and 
you could pull out the innards to adjust the time range as needed, to 
get it to run faster.  However at that point, it may be worthwhile just 
to use a MythXML call.



More information about the mythtv-users mailing list