publish.sh 958 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/sh
  2. # https://mro.name/radio-privatkopie
  3. cd "$(dirname "${0}")/../" || exit 1
  4. [ "" = "${1}" ] && {
  5. cat >&2 <<EOF
  6. Refresh the RSS feeds a broadcast belongs to.
  7. Enclosures must have 3-char extensions to be picked up.
  8. SYNOPSIS
  9. \$ sh ${0} b2/2021/10/05/1905
  10. EOF
  11. exit 1
  12. }
  13. while [ "" != "${1}" ]
  14. do
  15. for bc in ./*/"${1}"
  16. do
  17. po="$(echo "${bc}" | cut -d / -f 2)"
  18. # rss mandatory
  19. sh "${po}/app/rss.sh" "${1}" \
  20. | xmllint \
  21. --encode utf-8 \
  22. --format \
  23. --nonet \
  24. --nsclean \
  25. --output "${po}/broadcasts.rss" \
  26. --relaxng "app/rss.rng" \
  27. - \
  28. &
  29. # atom optional
  30. [ -r "${po}/app/atom.sh" ] || continue
  31. sh "${po}/app/atom.sh" "${1}" \
  32. | xmllint \
  33. --encode utf-8 \
  34. --format \
  35. --nonet \
  36. --nsclean \
  37. --output "${po}/broadcasts.atom" \
  38. --relaxng "app/atom.rng" \
  39. - \
  40. &
  41. done
  42. wait
  43. shift
  44. done 2>&1 | grep -vE "^- validates\$" >&2