[mythtv-users] perl bindings - stop a recording

Michael T. Dean mtdean at thirdcontact.com
Fri Feb 13 03:40:29 UTC 2009

On 02/12/2009 10:24 PM, Bob wrote:
> I have been studying the perl bindings, but it's not obvious to me.  
> Is there a way to stop a recording that is in progress using the perl 
> bindings?
> I found a backend_command from the wiki:
> $Myth->backend_command(['FORCE_DELETE_RECORDING', $file->to_string()], 
> '0');
>  but I'm not sure what the syntax would be to stop a recording.

While you /could/ use FORCE_DELETE_RECORDING (or just plain 
DELETE_RECORDING--the difference is that FORCE_DELETE_RECORDING deletes 
the recording metadata even if the recording file cannot be located to 
delete, which risks leaving multiple gigabytes of orphaned data around), 
doing so would result in, er, deleting the recording.  :)

The command you probably want is STOP_RECORDING (you can see the 
commands in programs/mythbackend/mainserver.cpp --and you can read the 
Handle*() functions--and, usually, the associated DoHandle*() 
functions--to find out what data/what format data they expect).

The STOP_RECORDING command (as well as the DELETE_RECORDING and the 
FORCE_DELETE_RECORDING commands) expects a ProgramInfo (in string list 
format) to follow.

A good example of how to do this with the Perl bindings would be the 
pixmap_last_mod subroutine in bindings/perl/MythTV/Recording.pm...  Just 
change the command from QUERY_PIXMAP_LASTMODIFIED.  (I'm pretty sure the 
return will be different, too, but don't know what it is off the top of 
my head.  You can find out through trial and error or by reading the 
{,Do}Handle*() functions.)


More information about the mythtv-users mailing list