@@ -9,6 +9,7 @@ MASTERHOST=herb
99# content, but I'll have to life with any security issues it causes, I guess.
1010PATTERN=' \.\(mp3\)\|\(ogg\)\|\(mp4\)\|\(flv\)\|\(flac\)$'
1111hostname=` cat /etc/hostname`
12+ AUDIOBOOKSETTING=-v
1213if [ -e $FILE ]; then
1314 rm $FILE
1415fi
@@ -20,6 +21,10 @@ while [ $# -gt 0 ]; do
2021 echo Play Random V1.1
2122 exit
2223 ;;
24+ -b)
25+ echo Listening to an Audiobook
26+ AUDIOBOOKSETTING=-i
27+ ;;
2328 -m)
2429 DISPLAY=" "
2530 ;;
@@ -41,10 +46,10 @@ while [ $# -gt 0 ]; do
4146 -* )
4247 cat << 'EOF '
4348usage: playrandom [-v] [-h|--help|-?] [directory...] [word...]
44- usage: playme [-v] [-h|--help|-?] [directory...] [word...]
45- usage: playonce [-v] [-h|--help|-?] [directory...] [word...]
46- usage: playmeonce [-v] [-h|--help|-?] [directory...] [word...]
49+ Can also be called as "playme" "playonce" or "playmeonce" to disable randomization or repeating.
4750 -v: version
51+ -b: Play only files with "audiobook" in the path/filename, rather than never playing them
52+ Also disables randomization and repeating, like "playmeonce"
4853 -m: Use mplayer, instead of audacious. Even if audacious is available.
4954 -h|--help|-?: print this help
5055 -r: Regenerate local play lists
@@ -137,7 +142,7 @@ if [ ! -e $FILE ]; then
137142 echo I am the master host, using my local files. 1>&2
138143 cat $CACHEDLIST
139144 fi
140- ) | grep -i " $PATTERN " | grep -v ' Audiobooks' >> $FILE
145+ ) | grep -i " $PATTERN " | grep $AUDIOBOOKSETTING ' Audiobooks' >> $FILE
141146 echo found ` cat $FILE | wc -l` songs so far
142147fi
143148
@@ -178,7 +183,7 @@ if [ "$FILELINES" -eq 0 ];then
178183 exit 1
179184fi
180185
181- if [ " ${0##*/ } " = " playme" -o " ${0##*/ } " = " playmeonce" ]; then
186+ if [ " ${0##*/ } " = " playme" -o " ${0##*/ } " = " playmeonce" -o " $AUDIOBOOKSETTING " = " -i " ]; then
182187 # For playme, sort the playlist.
183188 echo Sorting Playlist
184189 sort $FILE > $FILE .random
@@ -208,7 +213,7 @@ while mplayer -vo null -nojoystick -playlist ${FILE}.random ; do
208213 if [ " $FILELINES " -lt 60 ] ; then
209214 cat $FILE
210215 fi
211- if [ " ${0##*/ } " = " playonce" -o " ${0##*/ } " = " playmeonce" ]; then
216+ if [ " ${0##*/ } " = " playonce" -o " ${0##*/ } " = " playmeonce" -o " $AUDIOBOOKSETTING " = " -i " ]; then
212217 exit
213218 fi
214219done
0 commit comments