[mythtv-users] automating commercial removal

Chris Pinkham cpinkham at bc2va.org
Sat Sep 22 16:54:02 UTC 2007

* On Sat Sep 22, 2007 at 11:34:59AM -0400, Tom Metro wrote:
> Braindead wrote:
> > Simply setup a userjob with this:
> > mythcommflag --chanid %CHANID% --starttime %STARTTIME% --gencutlist
> Yeah, that's what I had in mind...providing the user job runs before
> transcoding. Elsewhere I saw mention of an option to causing transcoding
> to be delayed. If such an option exists, that could address the
> potential ordering problem.

If you are confident enough in the commercial flagger to always copy the
commercial skip list to the cut list automatically before transcoding,
then here is how you can accomplish that with existing Myth functionality.

1) Make sure Myth is setup to run commercial flagging before transcoding.

2) Make a shell script containing the following (untested) code:

    mythcommflag --chanid $1 --starttime $2 -V $3

    mythcommflag --chanid $1 --starttime $2 -V $3 --gencutlist
    exit $?

    As an example I'll say that you called this script

3) Go into mythtv-setup and change the "Commercial Flagger command" to be
    the following:

    /usr/local/bin/mythcommflag_wrapper.sh %CHANID% %STARTTIME% %VERBOSELEVEL%

    That will run the wrapper script giving it the chanid, starttime, and
    the verbose level that mythbackend or mythjobqueue was run with.
    The script should flag the recording as normal, then copy the generated
    commecial skip list to the cutlist automatically.

The "Commercial Flagger command" and "Transcoder command" settings are
configured identical to the "User Job #X Command" settings.  You have
to specify all options that the called program needs to execute, you
can't just put in "mythcommflag_wrapper.sh" and expect things to work.
I only mention this because some have tried it in the past, expecting
the JobQueue to pass the appropriate options to the called program,
but the JobQueue has know way of knowing what the appropriate options
are so the only thing it does it the mornal %VALUE% substitutions and
then runs the command exactly as given in mythtv-setup.

I think you can even put multiple commands in the "Commercial Flagger
command" setting as long as they are separated by a semi-colon.  So you
might want to try the following instead of making a wrapper shell script
(this may wrap in your email program so make sure you get it all):

mythcommflag -c %CHANID% -s %STARTTIME% -V %VERBOSELEVEL% ; mythcommflag -c %CHANID% -s %STARTTIME% -V %VERBOSELEVEL% --gencutlist

The JobQueue should replace all instances of the variables in the command,
so %CHANID% should be replaced both times it occurs, etc..

> Feels like there should be an --alsocopycutlist option, or something
> like that.

Since you'd have to modify the "Commercial Flagger command" anyway to add
this command line option and it's so easy to do this anyway by calling
mythcommflag twice, I don't see a big need to add another option.

All that being said, even I don't even trust mythcommflag enough to do
this and transcode automatically and I'm the guy that wrote most of it,
but it's up to you what you want to do. :)

Chris Pinkham

More information about the mythtv-users mailing list