marker.sh 664 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/sh
  2. # https://mro.name/radio-privatkopie
  3. #
  4. cd "$(dirname "${0}")/.." || exit 1
  5. [ "${1}" = "" ] && {
  6. cat >&2 <<EOF
  7. Write a podcast marker next the broadcast into /stations/*/????/??/??/????.podcasts
  8. SYNOPSIS
  9. \$ sh ${0} b2/2021/10/05/1905
  10. EOF
  11. exit 1
  12. }
  13. while [ "" != "${1}" ]
  14. do
  15. ls "../stations/${1}.xml" >/dev/null || exit $?
  16. # it's a bit hairy to write inside the stations dir.
  17. dst="../stations/${1}.podcasts"
  18. {
  19. readonly pre="../../../../.."
  20. for po in "../podcasts"/*/"${1}"
  21. do
  22. [ -r "${po}" ] && echo "${pre}/$(echo "${po}" | cut -d / -f 2-3)"
  23. done
  24. } | sort > "${dst}"
  25. [ -s "${dst}" ] || rm "${dst}"
  26. shift
  27. done