OK I hope I posted in the right forum because this is not real programming...
So now I've wrote this script that
-gets all the audio streams in an ogm file
-displays them and displays a menu so I can select from 1 to 3
-gets all the subtitle streams in an ogm file
-displays them and displays a menu so I can select from 1 to 3
-starts mplayer
Code:
#!/bin/bash
#filter ogminfo for lines that contain audio streams
AID=`ogminfo -v $1 | grep ") a" | grep -i LANGUAGE`
#display a menu so I can select the desidered stream
AUDIO=`kdialog --menu "$AID" 0 "audio a1" 1 "audio a2" 2 "audio a3"
#filter ogminfo for lines that contain subtitle streams
SID=`ogminfo -v $1 | grep ") t" | grep -i LANGUAGE`
#display a menu so I can select the desidered stream
SUBS=`kdialog --menu "$SID" 0 "subtitles t1" 1 "subtitles t2" 2 "subtitles t3"
#start mplayer
mplayer $1 -aid $AUDIO -sid $SUBS
But this is a little slow...probably because of kdialog...
So now I would like to modify the script so that instead of kdialog displaying the menu it would read the $AID variable and get the line that contains "Japanese" and then create a variable like -aid $LINENUMBER
and the same for subtitles just that it would search for the line that contains english.
I think that could be done with bash but I don't know
how to loop trough lines and find which line contains the searched string?