[mythtv-users] Force refresh of recordings list?

Mike Holden mythtv at mikeholden.org
Fri Apr 15 17:26:55 UTC 2011


Raymond Wagner wrote:
> On 4/15/2011 09:05, Mike Holden wrote:
>> I have a script which manually updates the recording group on
>> recorded programs depending on certain criteria. It does this by
>> directly accessing the database to update the recgroup column in
>> the
>> recording table, via a php script.
>>
>> This brings me to a couple of questions.
>>
>> 1. Is there a better way to do this, via either the perl or python
>> mythtv bindings? I appreciate that direct database updates are
>> frowned upon and I would prefer to do it the proper way if
>> possible!
>> I've checked the wiki and can't see any api for updating the
>> recgroup for a recording.
>
> import MythTV
> #either this
> rec = MythTV.Recorded((<chanid>, <starttime>))
> # or
> db = MythTV.MythDB()
> rec = db.searchRecorded(multiple=<someval>, search=<someval>,
> criteria=<someval>)
> #followed by
> rec.update(recgroup="your new group")
>
>> 2. The problem I have with 1. above is that once the recgroup is
>> updated, the frontend doesn't automatically see the changes. I
>> would
>> like to send some kind of "recordings refresh" command to all
>> frontends to tell it to refresh it's list of recordings. Is this
>> possible? Again, I've searched the wiki and can't see anything
>> that
>> looks relevant.
>
> be = MythTV.MythBE()
> prog = Program.fromRecorded(rec)
> be.backendCommand(MythTV.static.BACKEND_SEP.join("MESSAGE",
> "RECORDING_LIST_CHANGE UPDATE", prog.toString))

Thanks for that.

Not sure the last bit is exactly right though. I got errors until I
changed it from
   prog = Program.fromRecorded(rec)
to
   prog = MythTV.Program.fromRecorded(rec)

Hope that change makes sense.

However I still get a problem with the backendCommand call though:

Traceback (most recent call last):
  File "./myth_refresh_rec.py", line 16, in <module>
    "RECORDING_LIST_CHANGE UPDATE", prog.toString))
TypeError: join() takes exactly one argument (3 given)

I'm no python expert at all, having never used it, so hopefully a
quick pointer in the right direction would be much appreciated,
thanks.

I'm using recent 0.24-fixes from atrpms on Fedora 14, if it makes
any difference:

[mike at puzzle bin]$ mythbackend --version
Please attach all output as a file in bug reports.
MythTV Version   : v0.24-238-g2a9d9f5
MythTV Branch    : fixes/0.24
Network Protocol : 63
Library API      : 0.24.20101129-1
QT Version       : 4.6.3
Options compiled in:
 linux release using_alsa using_jack using_oss using_pulse
using_pulseoutput using_backend using_bindings_perl
using_bindings_python using_dvb using_firewire using_frontend
using_hdhomerun using_hdpvr using_iptv using_ivtv
using_joystick_menu using_libfftw3 using_lirc using_mheg
using_opengl_video using_opengl_vsync using_qtdbus using_qtwebkit
using_v4l using_x11 using_xrandr using_xv using_xvmc using_xvmc_vld
using_xvmcw using_bindings_perl using_bindings_python
using_mythtranscode using_opengl using_vdpau using_ffmpeg_threads
using_live using_mheg
-- 
Mike Holden



More information about the mythtv-users mailing list