ubnewbie2
January 30th, 2008, 04:18 AM
I have written the following user job, based on the script posted by stdPikachu (thanks heaps)
Mine is simplified, and uses mythtranscode. It seems to work, except that mythtranscode gets the aspect ratio wrong - I have to look into that.
Here's the code...
#!/bin/bash
# Custom user job designed to save recordings to the videos directory for myth video
# This script needs the following variables in this exact order to run:
# %DIR%
# %FILE%
# %TITLE%
# %SUBTITLE%
# %CHANID%
# %STARTTIME%
# TODO: error check args!
# So the prog will be called like: /path/to/script "%DIR%" "%FILE%" "%TITLE%" "%SUBTITLE%" "%CHANID%" "%STARTTIME%"
echo "Starting save_to_videos job..."
# Locate the file specified (not really used - from old script)
SRC_DIR="$1/" # %DIR% plus a trailing slash
SRC_FILENAME=$2 # %FILE%
SRC_FILE="${SRC_DIR}${SRC_FILENAME}"
echo "Source file is $SRC_FILE"
# find channel and start time
CHANID="$5"
STARTTIME="$6"
echo "Channel ID and start time are $CHANID , $STARTTIME"
# Specify output path to myth video directory
DEST_DIR=/var/lib/mythtv/videos/
# Form unique filename
DEST_FILENAME="$3 XX-XX $4.mpeg2"
FILE_PREFIX="$5$6"
DEST_FILE="${DEST_DIR}${FILE_PREFIX}_${DEST_FILENAME}"
echo "Destination file is $DEST_FILE"
mythtranscode --mpeg2 --chanid "$CHANID" --starttime "$STARTTIME" --outfile "$DEST_FILE" --profile autodetect
echo "Finished $DEST_FILE"
# Exit nicely
exit 0
Mine is simplified, and uses mythtranscode. It seems to work, except that mythtranscode gets the aspect ratio wrong - I have to look into that.
Here's the code...
#!/bin/bash
# Custom user job designed to save recordings to the videos directory for myth video
# This script needs the following variables in this exact order to run:
# %DIR%
# %FILE%
# %TITLE%
# %SUBTITLE%
# %CHANID%
# %STARTTIME%
# TODO: error check args!
# So the prog will be called like: /path/to/script "%DIR%" "%FILE%" "%TITLE%" "%SUBTITLE%" "%CHANID%" "%STARTTIME%"
echo "Starting save_to_videos job..."
# Locate the file specified (not really used - from old script)
SRC_DIR="$1/" # %DIR% plus a trailing slash
SRC_FILENAME=$2 # %FILE%
SRC_FILE="${SRC_DIR}${SRC_FILENAME}"
echo "Source file is $SRC_FILE"
# find channel and start time
CHANID="$5"
STARTTIME="$6"
echo "Channel ID and start time are $CHANID , $STARTTIME"
# Specify output path to myth video directory
DEST_DIR=/var/lib/mythtv/videos/
# Form unique filename
DEST_FILENAME="$3 XX-XX $4.mpeg2"
FILE_PREFIX="$5$6"
DEST_FILE="${DEST_DIR}${FILE_PREFIX}_${DEST_FILENAME}"
echo "Destination file is $DEST_FILE"
mythtranscode --mpeg2 --chanid "$CHANID" --starttime "$STARTTIME" --outfile "$DEST_FILE" --profile autodetect
echo "Finished $DEST_FILE"
# Exit nicely
exit 0