[mythtv-users] "Whats that file?" Script
Ben Curtis
fmstratk at coronium.com
Mon Nov 3 13:23:20 EST 2003
One of my frustrations when using GOPChop was figuring out what file was
what. I use a PVR-250 so just renaming the nuv files to mpg is fine, but
the name of the file using then chanid, starttime, and endtime made no
quick association. So I wrote the following script, figured someone else
might find it useful. Basically it just creates a directory and puts .mpg
symlinks to the real files using the title_starttime. Then when your done
accessing the files directly, you can just remove the directory containing
the symlinks.
Ben
-----------------------------
#!/bin/bash
# Where your recordings sit
RECDIR=/opt/video/recordings/
# The directory to create symlinks in
LINKDIR=/opt/video/shows/
# Command to return the sql rows. Must have -N !!A
SQLCOMM="mysql -N -u root mythconverg";
mkdir $LINKDIR;
LIST=`echo "select chanid, starttime, endtime, title, 'RECEND' from recorded order by starttime" | $SQLCOMM |perl -pe 's/\&/and/g' |perl -pe "s/\'//g" |perl -pe 's/://g' |perl -pe 's/"//g'`;
NEXT=1;
for L in $LIST; do
if test "$L" == "RECEND"; then
REALFILE="${RECDIR}${CHANID}_${STARTTIME}_${ENDTIME}.nuv";
FAKEFILE="${LINKDIR}${TITLE}_${STARTTIME}.mpg";
echo "Linking $FAKEFILE";
ln -s $REALFILE $FAKEFILE;
NEXT=1;
else
if test $NEXT == 5; then
TITLE="${TITLE}_${L}";
fi;
if test $NEXT == 4; then
TITLE="$L";
NEXT=5;
fi;
if test $NEXT == 3; then
ENDTIME="$L";
NEXT=4;
fi;
if test $NEXT == 2; then
STARTTIME="$L";
NEXT=3;
fi;
if test $NEXT == 1; then
CHANID="$L";
NEXT=2;
fi;
fi;
done;
More information about the mythtv-users
mailing list