diff --git a/README.md b/README.md index a6617c7..39f54cf 100644 --- a/README.md +++ b/README.md @@ -25,3 +25,11 @@ audiobanner Insert an audio content (the "banner") in another audio file every X seconds. This is useful, for example, to put "announcements" in a podcast. + +dataoggi +--------- + +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. + diff --git a/dataoggi b/dataoggi new file mode 100755 index 0000000..2147a55 --- /dev/null +++ b/dataoggi @@ -0,0 +1,28 @@ +#!/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