dataoggi 643 B

12345678910111213141516171819202122232425262728
  1. #!/bin/bash
  2. # This script will list *all* audiofiles inside $basedir/$today
  3. # Suggestion: if you want to have more than 1 file, please list them prefixed with numbers.
  4. export LC_ALL=C # so that sorting order is table
  5. set -eu
  6. baseDir=$1
  7. is_audio() {
  8. mimeType=$(file --mime-type --brief "$1")
  9. if [[ "$mimeType" = audio/* ]]; then
  10. return 0
  11. else
  12. return 1
  13. fi
  14. }
  15. cd "$baseDir"
  16. cd "$(date +%Y-%m-%d)" # YYYY-MM-DD, like 1945-04-25
  17. for file in * # this should be alphabetically sorted
  18. do
  19. if ! is_audio "$file"; then # non-audio is ignored
  20. continue
  21. fi
  22. echo "file://$(realpath "$file")"
  23. done