[mythtv-users] Automatically Transcoding the Commercials Away
Eric Mesa
ericsbinaryworld at gmail.com
Wed Feb 6 04:25:38 UTC 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I've been reading the code provided in the wiki and I just wanted to
make sure I was doing things correctly before potentially messing up my
files and/or database. I have a row of hashes (#) where I'm going to
change up the script.
#!/bin/sh
VIDEODIR=$1
FILENAME=$2
# Sanity checking, to make sure everything is in order.
if [ -z "$VIDEODIR" -o -z "$FILENAME" ]; then
~ echo "Usage: $0 <VideoDirectory> <FileName>"
~ exit 5
fi
if [ ! -f "$VIDEODIR/$FILENAME" ]; then
~ echo "File does not exist: $VIDEODIR/$FILENAME"
~ exit 6
fi
# The meat of the script. Flag commercials, copy the flagged commercials to
# the cutlist, and transcode the video to remove the commercials from the
# file.
#I want to delete this section since I already commercial flag all of my
recordings and will only
#transcode certain ones
#######################################################################################3
mythcommflag -f $VIDEODIR/$FILENAME
ERROR=$?
if [ $ERROR -gt 126 ]; then
~ echo "Commercial flagging failed for ${FILENAME} with error $ERROR"
~ exit $ERROR
fi
############################################################################################
mythcommflag --gencutlist -f $VIDEODIR/$FILENAME
ERROR=$?
if [ $ERROR -ne 0 ]; then
~ echo "Copying cutlist failed for ${FILENAME} with error $ERROR"
~ exit $ERROR
fi
mythtranscode --honorcutlist --showprogress -i $VIDEODIR/$FILENAME -o
$VIDEODIR/$FILENAME.tmp
ERROR=$?
if [ $ERROR -ne 0 ]; then
~ echo "Transcoding failed for ${FILENAME} with error $ERROR"
~ exit $ERROR
fi
#I if I just want to overwrite the original files w/o saving this .old
file, do I just remove this next line?
############################################################################################################
mv $VIDEODIR/$FILENAME $VIDEODIR/$FILENAME.old
###########################################################################################################
mv $VIDEODIR/$FILENAME.tmp $VIDEODIR/$FILENAME
mythcommflag -f $VIDEODIR/${FILENAME} --rebuild
ERROR=$?
if [ $ERROR -ne 0 ]; then
~ echo "Rebuilding seek list failed for ${FILENAME} with error
$ERROR"
~ exit $ERROR
fi
mythcommflag --clearcutlist -f $VIDEODIR/$FILENAME
ERROR=$?
if [ $ERROR -eq 0 ]; then
~ # Fix the database entry for the file
~ cat << EOF | mysql mythconverg
UPDATE
~ recorded
#I added this since I have auto-commercial skip enabled
##########################################################################
DELETE FROM
~ `recordedmarkup`
WHERE
~ CONCAT( chanid, starttime ) IN (
~ SELECT
~ CONCAT( chanid, starttime )
~ FROM
~ recorded
~ WHERE
~ basename = '$FILENAME'
~ );
#############################################################################
SET
~ cutlist = 0,
~ filesize = $(ls -l $VIDEODIR/$FILENAME | awk '{print $5}')
WHERE
~ basename = '$FILENAME';
EOF
~ exit 0
else
~ echo "Clearing cutlist failed for ${FILENAME} with error $ERROR"
~ rm /usr/video/$FILENAME.tmp
~ exit $ERROR
fi
Also, once this is all put into a file - do I put it into /usr/local/bin
? And how do I run it as a user job?
Thanks!
- --
Eric Mesa
ericsbinaryworld at gmail.com
http://www.ericsbinaryworld.com
Note: All emails from this address should have a GPG signature. If you
have the proper setup you can use this to confirm my identity and that
the email was not changed in transit.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iD8DBQFHqTbBPvU+8ApmWXIRAh6ZAJ0UOJe2/UBCywbL2ico08fYGHKIjQCfY6D8
bSSKIzcQSMxAGIjnxU1qHQk=
=NRYa
-----END PGP SIGNATURE-----
More information about the mythtv-users
mailing list