a09f28b34f
one directory per day, play all files in it
28 lines
643 B
Bash
Executable file
28 lines
643 B
Bash
Executable file
#!/bin/bash
|
|
# This script will list *all* audiofiles inside $basedir/$today
|
|
# Suggestion: if you want to have more than 1 file, please list them prefixed with numbers.
|
|
|
|
export LC_ALL=C # so that sorting order is table
|
|
|
|
set -eu
|
|
|
|
baseDir=$1
|
|
|
|
is_audio() {
|
|
mimeType=$(file --mime-type --brief "$1")
|
|
if [[ "$mimeType" = audio/* ]]; then
|
|
return 0
|
|
else
|
|
return 1
|
|
fi
|
|
}
|
|
|
|
cd "$baseDir"
|
|
cd "$(date +%Y-%m-%d)" # YYYY-MM-DD, like 1945-04-25
|
|
for file in * # this should be alphabetically sorted
|
|
do
|
|
if ! is_audio "$file"; then # non-audio is ignored
|
|
continue
|
|
fi
|
|
echo "file://$(realpath "$file")"
|
|
done
|