Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] mplayer.sh: solution of DVD chapter selection with mp3/mplayer plugin



Hi,

I'm using the mp3/mplayer plugin together with Michael's & Juri's
mplayer.sh script.

Current mplayer.sh only supports playing dvd chapter 1. Due some of
my DVDs have their main track in chapter 2 (or 12 like Star Trak Nemesis)
I wanted to select the DVD chapters inside VDR. 

Here's my little solution, it would like to here some comments about it:

I changed the mplayer.sh so it doesn't play a DVD when the dummy
DVD file is selected, but calls a little perl script I wrote that examines the dvd
and created dummy files called DVD-01, DVD-02... for every DVD track it
can find.

So if you now select the DVD dummy in VDR no track will be played
at all and you will be back in VDR again. But if you check the mplayer 
directory in VDR again you will see the files DVD-01... available for 
every track on the DVD. Select one of those files and the corresponding 
track will be played.

Changes below, nice weekend @all

Martin Fischer





Here's the change of mplayer.sh (line #436 in my version):
( You will have to correct the CMDLINE="usr/local/bin..." to
the place this script is located, script follows below )
-------------------------------------------
...
# read config file and initialize the variables
initialize
if test "$FILE" == "$DVDFiles/DVD" -a -n "$DVDFiles"  -a  -n "$DVD" ; then
      # Scan DVD
      CMDLINE="/usr/local/bin/scandvd.pl"
      FILE=""
elif test "${FILE:0:$[${#FILE}-3]}" == "$DVDFiles/DVD" -a -n "$DVDFiles"  -a  -n "$DVD" ; then
      CHAPTER="${FILE:$[${#FILE}-2]:2}"
      CMDLINE="$MPLAYER -vo $VO $AOUT -dvd $CHAPTER -alang $DVDLANG $DVDOPTIONS $FDSTR $CACHESTR $REMOTE $USERDEF -dvd-device"
      FILE="$DVD"
elif test "$FILE" == "$DVDFiles/VCD" -a -n "$DVDFiles" -a -n "$DVD" ; then
      CMDLINE="$MPLAYER -vo $VO $AOUT -vcd 1 $VCDOPTIONS $FDSTR $CACHESTR $REMOTE $USERDEF -cdrom-device"
      FILE="$DVD"
...


Here's my little perl script scandvd.pl
-------------------------------------------
#!/usr/bin/perl

use strict;
use warnings;


use constant VIDEO_DIRECTORY => '/home/freigabe/Videos';
use constant MOUNT_DIRECTORY => '/media/dvd';


# Try to mount DVD if not already
if ( ! -d MOUNT_DIRECTORY() ."/VIDEO_TS" ) {

  # Try to mount DVD
  system( "/bin/mount ". MOUNT_DIRECTORY() );

  # On Success
  if ( -d MOUNT_DIRECTORY ."/VIDEO_TS" ) {

    # Ok, it is mounted now: get chapters
    my @newChapters = glob( MOUNT_DIRECTORY ."/VIDEO_TS/VTS_??_0.IFO" );

    # What old chapter files does exist?
    my @oldChapters = glob( VIDEO_DIRECTORY ."/DVD*" );

    # If different chapter count
    if ( scalar( @newChapters ) != scalar( @oldChapters ) ) {

      # Remove all old chapter files
      foreach my $chapterFile ( @oldChapters ) {
        unlink( $chapterFile );
      }

      # Create the DVD Main-File too
      if ( open( DVDFILE, "> ". VIDEO_DIRECTORY ."/DVD" ) ) {
        print DVDFILE "DUMMY FILE - DVD MAIN\n";
        close( DVDFILE );
      }

      # Create required new chapter files and main file
      foreach my $chapterFile ( @newChapters ) {

        # Get title number if any
        my $title = substr( $chapterFile, -8, 2 );
        # Create new DVD file
        if ( open( DVDFILE, "> ". VIDEO_DIRECTORY ."/DVD-$title" ) ) {
          print DVDFILE "DUMMY FILE - DVD CHAPTER $title\n";
          close( DVDFILE );
        }

      } # foreach
    } # different chapter count

    # unmount DVD
    system( "/bin/umount ". MOUNT_DIRECTORY );

  } # mounted successfully
} # DVD wasn't mounted

exit 0;




-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index