Mercurial > mplayer.hg
comparison TOOLS/subsearch.sh @ 15587:46a8dc7bb562
very dummy script, written for a friend
author | alex |
---|---|
date | Sun, 29 May 2005 13:51:35 +0000 |
parents | |
children | 4d8489f21983 |
comparison
equal
deleted
inserted
replaced
15586:34cf1cf85ee3 | 15587:46a8dc7bb562 |
---|---|
1 #!/bin/sh | |
2 # | |
3 # Collects all the appropriate subtitle files in a given directory and | |
4 # it's subdirectories. No matter what the filename is. | |
5 # Use this together as: mplayer -sub `subsearch3.sh` movie | |
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" |