[mythtv-users] Can Myth auto-name MPG recordings with show names?

Gert van der Knokke gertk at xs4all.nl
Sun Oct 1 15:03:18 UTC 2006


Matt Emmott schreef:
> I'm running MythTV 0.20 with a PVR-150 card. All my recordings are put
> in the /video directory, which right now is full of .mpg files with
> filenames like 1004_20060923153001.mpg, etc. I can connect to the box
> over CIFS from my Windows box and view the mpg files as videos. My
> question is - Is there a way to make Myth rename these files so they
> are more descriptive, like with the show title in the filename or
> something?
>
> I understand that this is the way Myth organizes all the files on the
> backend, so it would make sense if they can't be renamed. So
> alternately, is it possible for myth to create copies of the files
> with a different filename? Say via nuvexport or mytharchive or
> something? I hope this isn't too much of a noobish question, I just
> haven't found a straightforward answer to the subject yet. Thanks.
>   
For a friend of mine (who uses MCE...) I created on the Myth backend a
set of symbolic links with the names of the recordings instead of the
cryptic .nuv names. Cron updates these links hourly and samba makes
these symbolic links available on our (shared) network.
The script is very simple and consists of two scripts actually
(namethatnuv in /usrl/local/bin and makerecordedlinks in /etc/cron.hourly/):

makerecordedlinks:
------------------------------
#!/bin/sh

# remove links without a file
symlinks -d /myth/exports/recordings

for i in /mnt/video_space/recordings/*.nuv
do
        name=`/usr/local/bin/namethatnuv $i`
        if [ ! -f /myth/exports/recordings/$name.mpg ]
        then
                ln -s $i /myth/exports/recordings/$name.mpg
        fi
done
--------------------------
This assumes your recordings are made in the folder
/mnt/video_space/recordings
and the samba exported folder is /myth/exports/recordings

Below the script 'namethatnuv' called by the above script (in
/usr/local/bin original written by Martin Moeller):
----------------
#!/bin/sh
# (C)2003 Martin Moeller. GPL Licensed.
#

MUSER=mythtv
MPASS=mythtv
CHARCONV="UTF8..ISO-8859-1" # You may want to adjust this for your location.
LIST=0
NUM=0

while [ "$1" != "" ] ; do

  LOOKUP=$(basename $1)

  CHANID=$(echo $LOOKUP | cut -d\_ -f1)
  STARTTIME=$(echo $LOOKUP | cut -d\_ -f2)
  ENDTIME=$(echo $LOOKUP | cut -d\_ -f3 | cut -d\. -f1)

  TITLE=$(mysql -u${MUSER} -p${MPASS} mythconverg -B -e "select title
from recorded where chanid=$CHANID and starttime=$STARTTIME and
endtime=$ENDTIME;" | tail -1)
  SUBTITLE=$(mysql -u${MUSER} -p${MPASS} mythconverg -B -e "select
subtitle from recorded where chanid=$CHANID and starttime=$STARTTIME and
endtime=$ENDTIME;" | tail -1)

  if [ "$TITLE" = "" ] ; then
    help
  fi


        RECYEAR=${STARTTIME:0:4}
        RECMONTH=${STARTTIME:4:2}
        RECDAY=${STARTTIME:6:2}
        RECTIME=${STARTTIME:8:4}
        NAME="$TITLE $SUBTITLE $CHANID $RECTIME $RECDAY $RECMONTH $RECYEAR"
        echo ${NAME} | recode $CHARCONV | sed 's/[ :()\|]/_/g'

  shift 1
done


------------------------------------------------

Maybe it is useful to you as well..

Gert



More information about the mythtv-users mailing list