Skip to content

Commit f5e8ab6

Browse files
committed
Added audiobook setting
Without this setting, it was rejecting all tracks with "Audiobook" in the path or filename. With this setting, that's reversed, and it always playes once only and sorts rather than radomizing the list.
1 parent 3f42d0c commit f5e8ab6

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

playrandom

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ MASTERHOST=herb
99
#content, but I'll have to life with any security issues it causes, I guess.
1010
PATTERN='\.\(mp3\)\|\(ogg\)\|\(mp4\)\|\(flv\)\|\(flac\)$'
1111
hostname=`cat /etc/hostname`
12+
AUDIOBOOKSETTING=-v
1213
if [ -e $FILE ]; then
1314
rm $FILE
1415
fi
@@ -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'
4348
usage: 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
142147
fi
143148

@@ -178,7 +183,7 @@ if [ "$FILELINES" -eq 0 ];then
178183
exit 1
179184
fi
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
214219
done

0 commit comments

Comments
 (0)