[mythtv-users] useful script for some of you

AeroPeek AeroPeek at gmail.com
Sun Sep 26 17:41:26 EDT 2004

Last week I asked a question about selecting subtitles in a DVD, thrugh MythTV.
Well, as i couldn't find any idea for doing this, i decided to write a
very simple script that automaticly play the DVD with the local
language (In my case - Hebrew), and if it is not avialable, it plays
the DVD with English subtitles.

Just put it in your /usr/local/bin and chmod +x it, then edit your
/usr/share/mythtv/dvdmenu.xml and replace <action>DVD_PLAY</action>
with <action>EXEC dvdsubplayer</action> in the DVD_PLAY section.
enjoy :)

If you have any ideas about how to make it more usefull or any
faster/better/smaller or something, just inform me, since it's my
second bash script i ever wrote :D

# /usr/local/bin/dvdsubplayer
# |-----------------------------------------------------------|
# | Written by Matan Avi-Tal aka AeroPeek                     |
# | Spread this shitty but useful script as much as you want  |
# |-----------------------------------------------------------|
# This script play a DVD using mplayer. In case of Hebrew subtitles it
plays the DVD with Hebrew subs,
# in case hebrew subs are not avialable, it checks for English subs,
and if avialable plays the DVD with it.
# If both are not avialable, plays DVD with no subs at all.

# NOTE: make sure that /dev/dvd points your real DVD like /dev/hdc

# get subtitle information
mplayer dvd://1 -dvd-device /dev/dvd -v -vo null -ao null -frames 0
2>&1 | grep subtitle > ~/.mplayer_dvd_sub_temp

# check which subs are avialable
HEB=`cat ~/.mplayer_dvd_sub_temp | grep iw | cut -d" " -f8`
ENG=`cat ~/.mplayer_dvd_sub_temp | grep -w 'language: en' -m 1 | cut -d" " -f8`

# play dvd with subtitles in this priority: Hebrew, English, none
if [ -n "$HEB" ]; then
                mplayer dvd://1 -dvd-device /dev/hdc -fs -zoom -vo xv
-slang $HEB
        elif [ -n "$ENG" ]; then
                mplayer dvd://1 -dvd-device /dev/hdc -fs -zoom -vo xv
-slang $ENG
        mplayer dvd://1 -dvd-device /dev/hdc -fs -zoom -vo xv

# delete temp file
rm ~/.mplayer_dvd_sub_temp


More information about the mythtv-users mailing list