29 lines
643 B
Text
29 lines
643 B
Text
|
#!/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
|