From a09f28b34f63c1573577a29941ed9d4b04bad76f Mon Sep 17 00:00:00 2001 From: boyska Date: Sat, 27 Jul 2024 20:49:50 +0200 Subject: [PATCH] add dataoggi one directory per day, play all files in it --- README.md | 8 ++++++++ dataoggi | 28 ++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100755 dataoggi 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