[mythtv-users] MythDVD offline Archive or Catalog?

Michael T. Dean mtdean at thirdcontact.com
Mon Aug 1 03:10:45 EDT 2005


Roman Romaniuk wrote:

> I have a fairly large DVD collection, but nowhere near sufficient disk 
> space to be able to host all of it on my backend server. Is there any 
> way to maintain the DVD listing within mythdvd, but have a note pop up 
> requesting that the user insert the appropriate DVD (and possibly 
> noting the DVD's location)  into the drive when it is selected for play?

I like this idea, too.  It could really make for an impressive looking 
MythVideo gallery view.  Imagine having 1000+ movies listed in there.  
:)  (Although, you'll probably want to make heavy use of categories so 
you can find things.)

As of now, there's nothing within Myth to handle it.  However, it's not 
too difficult to "fake it"...

Create an executable script file (whose contents we'll add later--a 
working example is attached) called something like prompt_for_media (or 
whatever you like) within a directory that's readable by the mythtv user 
(i.e. /usr/local/bin).  Then, within the MythVideo videos directory 
structure, create a link to the script but with the DVD's name and some 
appropriate extension (i.e. ".dvd"--more on that later).  For example:

ln -s /usr/local/bin/prompt_for_media \
      /path/to/videos/Stargate_SG-1_Season_1_Volume_1.dvd

(if you don't have SG-1 in your collection, you should ;).

Then, in Setup|Media Settings|Videos|File Types, add a file type to 
MythVideo associating the extension ".dvd" to your shell (i.e. bash) 
with appropriate command-line arguments.  If using the attached files, 
it would be

bash %s DVD %s

(Yes, "%s" should be in there twice--just trust me; once to execute the 
script and a second time to name the DVD.)  Also, make sure you 
*uncheck* the "Use default player" checkbox.

Now, all you need to do is write the "prompt_for_media" script.  I've 
included one below that prompts for media using a "poor-man's prompt."  
I just pop up an xterm window asking for the DVD by name and waiting for 
a keypress (basically, I have xterm execute the "prompt" command--also 
attached).  As far as the other xterm arguments go, I'm using a 
background and foreground color that look OK (at least to me--a guy with 
no artistic talent) with the MythCenter theme, telling it not to display 
scrollbars, setting a font size that's readable from a distance, and 
specifying an appropriate window size.  If you also tell your window 
manager to remove decorations (i.e. title bar and borders) from xterm 
windows, it looks like a pretty respectable prompt message (although my 
WM's placement policy gives a weird effect--keeps stairstepping it down 
and right about 10 pixels...).  BTW, I recommend sticking with xterm 
(instead of something like gnome-terminal) because it's pretty lightweight.

In theory, you could get the xterm to respond to remote button presses 
using irxevent, but I haven't played with this.  Ideally, you would 
create a custom LIRC client that listens for any remote keypress and use 
it instead of the xterm.  This would also give you the benefit of having 
access to all the GUI prettiness you're willing to create--even to the 
point of using data from the MythTV database to find the DVD 
data--title, producer, year, description, movie poster, etc.--and 
displaying it.  If I really get into this idea and create something like 
that, I'll post a followup (but don't hold your breath ;).

The scripts are relatively generic.  You could set up similar links for 
backup CD's using an extension of ".cd" and a file-association command 
of "bash %s CD %s" (where the attached script assumes a backup CD is an 
ISO9660 CD with a single file--the video file--on it).  If you use real 
VCD's, instead, use an extension of ".vcd" and a file-association 
command of "bash %s VCD %s".

Note that once you add the ".dvd" (or ".cd" or ".vcd") links to the 
MythVideo database, you can do IMDB lookups and everything.

If you accidentally select a DVD/CD/VCD or decide you don't want to walk 
over and insert the disc, it won't hurt anything.  When you "Press any 
key to continue," xine will start up, but it will error out when it 
fails to find a disc in the drive, so it will exit.  Note that if you 
put the "wrong" disc in the drive, xine will just play it, anyway 
(assuming it's the same disc type as requested)--nothing is checking to 
verify it's the requested disc.  If you put in the wrong type of disc, 
xine will error out and exit.

Well, I've got to go put 5 volumes per season times 7 seasons of 
Stargate SG-1 in my database...  I think it's even worth scanning the 
cover art from the DVD's since they won't be in IMDB for SG-1.

HTH.

Mike

-------------- next part --------------
#!/bin/bash

MEDIA_TYPE=$1
FILE_NAME=$2

# Find the name of the disc
case "${MEDIA_TYPE}" in
  DVD)
    DISC_NAME=`basename $FILE_NAME .dvd`
    ;;
  CD)
    DISC_NAME=`basename $FILE_NAME .cd`
    ;;
  VCD)
    DISC_NAME=`basename $FILE_NAME .vcd`
    ;;
esac

# Prompt the user to insert the disc
xterm -bg NavyBlue -fg White +sb -fs 18 -geometry 40x6 \
      -e prompt "Please insert ${MEDIA_TYPE}:" "${DISC_NAME}"

# Play the disc
case "${MEDIA_TYPE}" in
  DVD)
    xine --no-splash --auto-play=fhq --auto-scan dvd
    ;;
  CD)
    xine --no-splash --auto-play=fhq /mnt/cd
    ;;
  VCD)
    xine --no-splash --auto-play=fhq --auto-scan vcd
    ;;
esac

-------------- next part --------------
#!/bin/bash

MESSAGE=$1
MESSAGE2=$2

echo "${MESSAGE}"
echo
echo "${MESSAGE2}"

## Uncomment the for loop for a standard 80x24 terminal or use the
## xterm command line to customize the display for 5 or 6 lines
#for line in `seq 1 20`; do
  echo
#done

read -n 1 -p "Press any key to continue."



More information about the mythtv-users mailing list