File: mplayer.sh.example

package info (click to toggle)
vdr-plugin-mp3 0.9.15-5
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 756 kB
  • ctags: 1,144
  • sloc: ansic: 13,062; sh: 237; makefile: 152
file content (57 lines) | stat: -rw-r--r-- 1,000 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
#
# This script is called from VDR to start MPlayer
#
# argument 1: the file to play
# argument 2: (optional) the phrase SLAVE if SlaveMode is enabled
# argument 3: (optional) the phrase AID x to select audio stream x

# where to find mplayer
MPLAYER="mplayer"

# mplayer options, -vc will be added below
# add "-lircconf <lircrc>" to enable LIRC support
OPTS="-vo mpegpes"

# mplayer options for SlaveMode
SLAVE="-slave -quiet -nolirc"

#####################

FILE=$1
case "$FILE" in
*.pls | *.m3u)
  popt="-playlist"
  first=`grep -v -m1 "^#" $FILE`
  type=`file "$first"`
  ;;
*)
  type=`file "$FILE"`
  ;;
esac

while shift; do
  if [ "$1" = "SLAVE" ]; then
    sopt=$SLAVE
  elif [ "$1" = "AID" ]; then
    aopt="-aid $2"
    shift
  fi
done

case "$type" in
*AVI*)
  VC="ffdivx"
  ;;
*MPEG*)
  VC="mpegpes"
  ;;
*)
  echo "Unknown video file format $type"
  echo "Edit mplayer.sh to support this file type"
  exit 1
  ;;
esac

exec $MPLAYER $OPTS -vc $VC $sopt $aopt $popt "$FILE"