[mythtv] An example of MythTV archival and DVD playback.

Martin Moeller martin at martinm-76.dk
Wed Mar 19 20:41:58 EST 2003


Earlier I aired an idea of a tree view for mythtv to keep things
organized. I have now actually done something about it, except in a
somewhat different manner.

Noting that mplayer kan play the .nuv files directly given a patch, I
set out to make an archival system using mythvideo and some menu files.
This is the (current) result.

I have created a short script that you give a .nuv file and it will
rename it to it's title followed by [callsign] and (date time). See this
sample run (listing only. A real run give no visible output):

artin at monsterpc:/Multimedia/TV> /usr/local/sbin/myth_archive.sh -l *.nuv
11_20030317001000_20030317010500.nuv : Den skjulte invasion [TVDk1]
(20030317 001000).nuv
11_20030319015000_20030319024500.nuv : Den skjulte invasion [TVDk1]
(20030319 015000).nuv
20_20030303222000_20030304000500.nuv : Species 2 [TV3] (20030303
222000).nuv
20_20030306214000_20030307000000.nuv : The last days of disco [TV3]
(20030306 214000).nuv
20_20030317212500_20030317222000.nuv : Parlamentet [TV3] (20030317
212500).nuv
21_20030302162500_20030302172000.nuv : Stargate [3+] (20030302
162500).nuv
26_20030228213000_20030228220000.nuv : Future Imperfect [BBCW] (20030228
213000).nuv
26_20030307213000_20030307220000.nuv : Future Imperfect [BBCW] (20030307
213000).nuv
27_20030317075500_20030317080500.nuv : Big Knights [BBCP] (20030317
075500).nuv
2_20030228182500_20030228190000.nuv : Go' aften Danmark [TV2] (20030228
182500).nuv
2_20030301214000_20030301221000.nuv : Julie vender hjem [TV2] (20030301
214000).nuv
2_20030312224500_20030312233500.nuv : The Agency [TV2] (20030312
224500).nuv
2_20030313200000_20030313205000.nuv : Den 6 sans [TV2] (20030313
200000).nuv
2_20030318224500_20030318233500.nuv : Strengt fortroligt [TV2] (20030318
224500).nuv
5_20030319065000_20030319071500.nuv : Tegnefilm: X-Men Evolution [TVDk2]
(20030319 065000).nuv
7_20030303203000_20030303220000.nuv : Gullivers rejser [DR2] (20030303
203000).nuv
7_20030310203000_20030310220000.nuv : Gullivers rejser [DR2] (20030310
203000).nuv

When you run it for real, the entry in 'recorded' is deleted and you
move the files wherever you want after that. I have chosen a different
hard disk partition for now but for some programs a burning to CD-ROM
will likely follow. I have edited the mainmenu.xml file to call
videomenu.xml in stead of EXEC'ing mythvideo directly (probably default
by now anyway).

I have included som xml menu files to illustrate what I do, hoping that
some other people might want to use it.

Much the same has been done with DVD playback, giving a choice of
MPlayer or ogle. MPplayer in region 2 seems to have a lot of special
cases so I have made special menus for those (setup for danish subtitles
with english text). Probably not super useful for most of you but the
idea of it might work for other people too...

Attached are the menus and the script that did the above.

-- 
Martin Moeller <martin at martinm-76.dk>
-------------- next part --------------
<mythmenu name="DVD">

   <button>
     <type>Special</type>
     <text>Special Cases I</text>
     <action>MENU special1.xml</action>
   </button>

   <button>
     <type>Special</type>
     <text>Special Cases II</text>
     <action>MENU special2.xml</action>
   </button>

  <button>
     <type>Mplayer</type>
     <text>Play DVD Directly</text>
     <action>EXEC mplayer -menu -fs -quiet -slang da,en,no,se -alang en,da -dvd 1 /dev/dvd</action>
   </button>

  <button>
     <type>Ogle</type>
     <text>Play DVD with Menus</text>
     <action>EXEC ogle</action>
   </button>


</mythmenu>

-------------- next part --------------
martin at monsterpc:/Multimedia/TV> ls -lhR /Multimedia/ArchivedTV/
/Multimedia/ArchivedTV/:
totalt 1.2G
drwxr-xr-x    7 martin   users         176 2003-03-19 08:15 Films
drwxr-xr-x    5 martin   users         136 2003-03-19 08:14 Music
drwxr-xr-x    3 martin   users          72 2003-03-19 08:14 Series
-rw-r--r--    1 martin   users        1.1G 2003-03-16 10:31 The Rise and Rise of Shania Twain (480x480).avi

/Multimedia/ArchivedTV/Films:
totalt 0
drwxr-xr-x    2 martin   users          48 2003-03-19 08:15 Action
drwxr-xr-x    2 martin   users          48 2003-03-19 08:15 Adventure
drwxr-xr-x    2 martin   users         192 2003-03-19 15:01 Comedy
drwxr-xr-x    2 martin   users          48 2003-03-19 08:15 Drama
drwxr-xr-x    2 martin   users          48 2003-03-19 08:15 SciFi

/Multimedia/ArchivedTV/Films/Action:
totalt 0

/Multimedia/ArchivedTV/Films/Adventure:
totalt 0

/Multimedia/ArchivedTV/Films/Comedy:
totalt 1.2G
-rw-r--r--    1 martin   users         110 2003-03-19 14:26 Varme drenge 3 - hævnen [TV2Zulu] (20030305 220500).desc
-rw-r--r--    1 martin   users        1.2G 2003-03-05 23:40 Varme drenge 3 - hævnen [TV2Zulu] (20030305 220500).nuv

/Multimedia/ArchivedTV/Films/Drama:
totalt 0

/Multimedia/ArchivedTV/Films/SciFi:
totalt 0

/Multimedia/ArchivedTV/Music:
totalt 512
drwxr-xr-x    2 martin   users          48 2003-03-19 08:14 Artists
drwxr-xr-x    2 martin   users         512 2003-03-19 14:10 The Rise and Rise Of
drwxr-xr-x    2 martin   users         328 2003-03-19 14:56 Top 10

/Multimedia/ArchivedTV/Music/Artists:
totalt 0

/Multimedia/ArchivedTV/Music/The Rise and Rise Of:
totalt 2.3G
-rw-r--r--    1 martin   users           1 2003-03-19 14:09 The Rise & Rise of Celine Dion [VH-1] (20030301 140000).desc
-rw-r--r--    1 martin   users        755M 2003-03-01 15:00 The Rise & Rise of Celine Dion [VH-1] (20030301 140000).nuv
-rw-r--r--    1 martin   users         504 2003-03-19 14:09 The Rise & Rise of Pink [VH-1] (20030301 130000).desc
-rw-r--r--    1 martin   users        753M 2003-03-01 14:00 The Rise & Rise of Pink [VH-1] (20030301 130000).nuv
-rw-r--r--    1 martin   users           1 2003-03-19 13:23 The Rise & Rise of Shania Twain [VH-1] (20030301 120000).desc
-rw-r--r--    1 martin   users        756M 2003-03-01 13:00 The Rise & Rise of Shania Twain [VH-1] (20030301 120000).nuv

/Multimedia/ArchivedTV/Music/Top 10:
totalt 1.5G
-rw-r--r--    1 martin   users           1 2003-03-19 14:55 Kylie Minogue: Top 10 [VH-1] (20030223 110000).desc
-rw-r--r--    1 martin   users        770M 2003-02-23 12:00 Kylie Minogue: Top 10 [VH-1] (20030223 110000).nuv
-rw-r--r--    1 martin   users           1 2003-03-19 14:55 Top 10: Sexy Videos [VH-1] (20030302 110000).desc
-rw-r--r--    1 martin   users        755M 2003-03-02 12:00 Top 10: Sexy Videos [VH-1] (20030302 110000).nuv

/Multimedia/ArchivedTV/Series:
totalt 0
drwxr-xr-x    3 martin   users          80 2003-03-19 08:14 StarTrek

/Multimedia/ArchivedTV/Series/StarTrek:
totalt 0
drwxr-xr-x    2 martin   users          48 2003-03-19 08:14 Enterprise

/Multimedia/ArchivedTV/Series/StarTrek/Enterprise:
totalt 0

-------------- next part --------------
#!/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

function help() {
  echo "Usage: $0 MytvTV-NupelVideo-file.nuv [nuv-file...]"
  echo "Usage: $0 -l nuv-file [nuv-file]"
  echo "Purpose: Giving Usefull names for archival purposes."
  exit 0
}

if [ "$1" = "-l" ] || [ "$1" = "-L" ] ; then
  LIST=1
  shift 1
fi

if [ "$1" = "" ] || [ "$(echo $1 | grep '\-h')" != "" ] ; then
  help
fi 

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

  if [ ! -e $1 ] ; then 
    help
  fi

  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)

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

  CHANNEL=$(mysql -u${MUSER} -p${MPASS} mythconverg -B -e "select callsign from channel where chanid=$CHANID;" | tail -1)

  NAME="$TITLE [$CHANNEL] ($(echo $STARTTIME | cut -c1-8) $(echo $STARTTIME | cut -c9-))"

  if [ "$LIST" = "1" ] ; then
    echo $1 : ${NAME}.nuv | recode $CHARCONV
  else
    NAME=$(echo $NAME | recode $CHARCONV)
    mv $1 "$NAME.nuv"

    mysql -u${MUSER} -p${MPASS} mythconverg -B -e "select description from recorded where chanid=$CHANID and starttime=$STARTTIME and endtime=$ENDTIME;" | tail -1 | recode $CHARCONV > "${NAME}.desc"

    ## Move the data to oldrecorded... Heh, not neccessary anyway...

    ## (mysqldump -umythtv -pmythtv mythconverg recorded | grep $CHANID,$STARTTIME,$ENDTIME | sed s#recorded#oldrecorded# | sed s#"\\\'"#"§½"#g | cut -d\' -f1-6 | sed s#"§½"#"\\\'"#g | tr -d '\012' ; echo "');") | mysql -u${MUSER} -p${MPASS} mythconverg

    mysql -u${MUSER} -p${MPASS} mythconverg -e "delete from recorded where chanid=$CHANID and starttime=$STARTTIME and endtime=$ENDTIME;" 
  fi

  shift 1
done 
-------------- next part --------------
<mythmenu name="SPECIAL">

  <button>
     <type>BringItOn</type>
     <text>Bring It On</text>
     <action>EXEC mplayer -fs -quiet -sid 0 -alang en,da -dvd 3 /dev/dvd</action>
   </button>

   <button>
     <type>Coyote</type>
     <text>Coyte Ugly</text>
     <action>EXEC mplayer -fs -quiet -sid 8 -aid 128 -dvd 1 /dev/dvd</action>
   </button>

  <button>
     <type>DnD</type>
     <text>Dungeons and Dragons</text>
     <action>EXEC mplayer -fs -quiet -slang da,en,no,se -alang en,da -dvd 7 /dev/dvd</action>
   </button>

  <button>
     <type>DownToYou</type>
     <text>Down To You</text>
     <action>EXEC mplayer -fs -quiet -slang no -alang en,da -dvd 1 /dev/dvd</action>
   </button>

  <button>
     <type>Scary1</type>
     <text>Scary Movie</text>
     <action>EXEC mplayer -fs -quiet -slang da,en,no,se -alang en,da -dvd 3 /dev/dvd</action>
   </button>

</mythmenu>

-------------- next part --------------
<mythmenu name="Special2">

  <button>
     <type>Supergirl</type>
     <text>Supergirl</text>
     <action>EXEC mplayer -fs -quiet -sid 5 -alang en,da -dvd 5 /dev/dvd</action>
   </button>

  <button>
     <type>Superman1</type>
     <text>Superman - The Movie</text>
     <action>EXEC mplayer -fs -quiet -slang no -alang en,da -dvd 5 /dev/dvd</action>
   </button>

  <button>
     <type>Superman2</type>
     <text>Superman II</text>
     <action>EXEC mplayer -fs -quiet -sid 4 -alang en,da -dvd 5 /dev/dvd</action>
   </button>

  <button>
     <type>Superman3</type>
     <text>Superman III</text>
     <action>EXEC mplayer -fs -quiet -sid 5 no -alang en,da -dvd 5 /dev/dvd</action>
   </button>

</mythmenu>
-------------- next part --------------
<mythmenu name="VIDEO">

   <button>
     <type>Music</type>
     <text>Music Videos</text>
     <action>EXEC mythvideo /mnt/store/Video movies</action>
   </button>

  <button>
     <type>Videos</type>
     <text>Movies</text>
     <action>EXEC mythvideo /mnt/store/Movies movies</action>
   </button>

  <button>
     <type>Movies</type>
     <text>Archived TV (HDD)</text>
     <action>EXEC mythvideo /Multimedia/ArchivedTV movies</action>
   </button>

  <button>
     <type>Videos</type>
     <text>Archived TV/Video (CD-ROM)</text>
     <action>EXEC mythvideo /media/cdrom movies</action>
   </button>

  <button>
     <type>DVD</type>
     <text>Play a DVD</text>
     <action>MENU dvdmenu.xml</action>
   </button>


</mythmenu>



More information about the mythtv-dev mailing list