From: Fred Hamster <fred@gruntose.com>
Date: Tue, 11 Mar 2025 16:17:25 +0000 (-0400)
Subject: cleanups in sound scripts
X-Git-Tag: 2.140.189^2~7
X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=76649895e9fa7f280290830b05b27715e446bd6c;p=feisty_meow.git

cleanups in sound scripts
---

diff --git a/scripts/multimedia/play_random.sh b/scripts/multimedia/play_random.sh
index 95df45d1..c4d3e446 100644
--- a/scripts/multimedia/play_random.sh
+++ b/scripts/multimedia/play_random.sh
@@ -6,32 +6,19 @@
 
 our_host="$(hostname -f)"
 
-#hmmm: soooo antiquated and clunky!  just use a bash variable match expression to do this.
-grunty="$(echo "$our_host" | grep -i gruntose.blurgh)"
+# this will eat the entire hostname, if it's a member of our domain.
+grunty="${our_host%%*gruntose.blurgh}"
+#hmmm: generalize the above also.  oy.
 
-if [ ! -z "$grunty" ]; then
+# now check if we should play in our local host zone.
+if [ -z "$grunty" ]; then
   VOXDIR=/z/walrus/media/sounds
-#hmmm: generalize the above.
-
-#  FILE_LIST=$(find $VOXDIR -type f)
-#echo "file list is $FILE_LIST"
-#  LINES=$(find $VOXDIR -type f | wc -l)
-#echo "info found is: $LINES"
-#  LESS_CHANCE=$(expr $LINES \\* 4)
-#echo "less chance is $LESS_CHANCE"
-#  TO_PLAY=
-#  while [ -z "$TO_PLAY" ]; do
-#hmmm: random was used here, but not sure where that came from.
-#    TO_PLAY=$(find $VOXDIR -type f | random $LESS_CHANCE | tail -n 1)
-#hmmm: how was LESS_CHANCE being used previously?  => who cares?  this was bizarre and awful.
+#hmmm: generalize the above location.
 
   TO_PLAY="$(find $VOXDIR -type f | shuf | tail -n 1)"
-#echo "to play is $TO_PLAY"
-
-#  done
+echo "to play is $TO_PLAY"
 
   # now play the file we randomly chose.
   bash $FEISTY_MEOW_SCRIPTS/multimedia/sound_play.sh $TO_PLAY
-
 fi
 
diff --git a/scripts/multimedia/randomly_play.sh b/scripts/multimedia/randomly_play.sh
index 2754b53d..e59cb249 100644
--- a/scripts/multimedia/randomly_play.sh
+++ b/scripts/multimedia/randomly_play.sh
@@ -7,8 +7,9 @@ source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
 
 NOISE_IT_UP=$(expr $RANDOM / 91)
   # range is 0 to 360 after the division.
-#echo noise lev is $NOISE_IT_UP
-if [ $NOISE_IT_UP -gt 108 -a $NOISE_IT_UP -le 128 ]; then
+echo noise lev is $NOISE_IT_UP
+if [ $NOISE_IT_UP -gt 108 -a $NOISE_IT_UP -le 142 ]; then
+echo hit our percentage and playing a random sound
   # we hit our percentage.
   play_random
 fi
diff --git a/scripts/multimedia/sound_play.sh b/scripts/multimedia/sound_play.sh
index dcce0f33..5ae7c1a9 100644
--- a/scripts/multimedia/sound_play.sh
+++ b/scripts/multimedia/sound_play.sh
@@ -38,6 +38,8 @@ else
   echo "I don't know how to play basic sound files for this OS and sound system."
 fi
 
+echo "basic play cmd is: $BASE_PLAY_CMD"
+
 export MP3_PLAY_CMD='echo Unknown mp3 player...'
 
 if [ ! -z "$(whichable mplayer)" ]; then