15587
|
1 #!/bin/sh
|
|
2 #
|
|
3 # Collects all the appropriate subtitle files in a given directory and
|
16343
|
4 # its subdirectories, no matter what the filename is.
|
|
5 # Use this together as: mplayer -sub `subsearch.sh` movie
|
15587
|
6 # Author: Alex
|
|
7 #
|
|
8
|
|
9 [ $1 ] && cd `dirname $1`
|
|
10
|
|
11 _sub_names=""
|
|
12
|
|
13 one_dir_search() {
|
|
14 for i in $dir/*
|
|
15 do
|
|
16 case "`echo $i | tr [:upper:] [:lower:]`" in
|
|
17 *.sub|*.srt|*.mps|*.txt) _sub_names="$i,$_sub_names" ;;
|
|
18 *) ;;
|
|
19 esac
|
|
20 done
|
|
21 }
|
|
22
|
|
23 dir="."
|
|
24 one_dir_search
|
|
25
|
|
26 # add subdirectories too
|
|
27 for dir in *
|
|
28 do
|
|
29 [ -d $dir ] && one_dir_search
|
|
30 done
|
|
31
|
|
32 _len="`echo $_sub_names | wc -c`"
|
|
33 _len=$((_len-2))
|
|
34 echo $_sub_names | cut -b -"$_len"
|