ambience script now has automatic timeout
This commit is contained in:
@@ -1,7 +1,22 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
#set -ex
|
||||
|
||||
duration=$1
|
||||
|
||||
if [ -z "$duration" ]
|
||||
then
|
||||
echo "Missing required argument duration, ex 20m"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Duration: $duration"
|
||||
|
||||
choices=$(ls *ambience*.mp3)
|
||||
shuffled=$(printf "%s\n" "${choices[@]}" | shuf -n1)
|
||||
echo $shuffled
|
||||
totem ${shuffled[ $RANDOM % ${#shuffled[@]} ]}
|
||||
timeout $duration totem ${shuffled[ $RANDOM % ${#shuffled[@]} ]}
|
||||
if [ $? -eq 124 ]
|
||||
then
|
||||
totem '/media/cowley/muninn/ambience/Maarten Schellekens - Spring Morning.mp3'
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user