annotate TOOLS/subsearch.sh @ 22265:02333de881a7

probe ~/.xmms/Plugins for plugins too, so users without root access on their machine can install them in their homedir and, if necessary, override system wide defaults. patch by Nicolas George, nicolas george at ens fr
author ivo
date Tue, 20 Feb 2007 16:12:46 +0000
parents 4d8489f21983
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15587
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
1 #!/bin/sh
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
2 #
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
3 # Collects all the appropriate subtitle files in a given directory and
16343
4d8489f21983 description typo fixes
diego
parents: 15587
diff changeset
4 # its subdirectories, no matter what the filename is.
4d8489f21983 description typo fixes
diego
parents: 15587
diff changeset
5 # Use this together as: mplayer -sub `subsearch.sh` movie
15587
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
6 # Author: Alex
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
7 #
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
8
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
9 [ $1 ] && cd `dirname $1`
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
10
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
11 _sub_names=""
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
12
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
13 one_dir_search() {
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
14 for i in $dir/*
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
15 do
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
16 case "`echo $i | tr [:upper:] [:lower:]`" in
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
17 *.sub|*.srt|*.mps|*.txt) _sub_names="$i,$_sub_names" ;;
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
18 *) ;;
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
19 esac
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
20 done
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
21 }
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
22
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
23 dir="."
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
24 one_dir_search
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
25
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
26 # add subdirectories too
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
27 for dir in *
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
28 do
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
29 [ -d $dir ] && one_dir_search
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
30 done
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
31
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
32 _len="`echo $_sub_names | wc -c`"
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
33 _len=$((_len-2))
46a8dc7bb562 very dummy script, written for a friend
alex
parents:
diff changeset
34 echo $_sub_names | cut -b -"$_len"