[mythtv-users] Converting scripts to not use the database directly

Bill Meek keemllib at gmail.com
Sat Nov 1 14:38:17 UTC 2014


On 10/31/2014 08:17 PM, Mike Rice wrote:
...
 > Anyone have a script to do this that doesn't modify the database directly?
> Or can someone point me to an existing script that can change the
> attributes of a channel?  Or some info on how to do this in general?

I've been trying to make some scripts too. Put these files in some
directory:

    Channel.py         = http://pastebin.com/x3z5dwip
    Connections.py     = http://pastebin.com/TM8ByCp9
    Myth.py            = http://pastebin.com/MfJHYC1Y
    Utilities.py       = http://pastebin.com/xh4x1nrh
    updateDBChannel.py = http://pastebin.com/syE6nuTh

  and execute

     ./updateDBChannel.py --help
     ./updateDBChannel.py --be=<your backend> --nopost --debug <some chanid(s), like 1021 [2055 1234]>

Remove the --nopost argument to actually send to the backend. I've
tried it with just two channels and before running it dumped a
copy of them just in case something weird happened.

Then, maybe someone can see why everything works, except that
the backend returns <false> and of course visible isn't changed.
(I'm looking at planting some LOG messages in libs/libmythtv/channelutil.cpp
to see what's going on.)

Since the developers are recommending the use of the Services API,
I was thinking that a bunch of examples would help. I know this
concept works, as I've used it to schedule programs. I just haven't
used the Channel/UpdataDBChannel endpoint 'til now.

Other readers, please resist to urge to mention how many lines of SQL
the above would take ;).

This was done on 0.28-pre.

-- 
Bill


More information about the mythtv-users mailing list