weekly.sh 946 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/sh
  2. # https://mro.name/radio-privatkopie
  3. #
  4. # dash man page https://www.mankier.com/1/dash#Description-Builtins
  5. #
  6. cd "$(dirname "${0}")" || exit 1
  7. readonly base="../.."
  8. # no tombstones.
  9. find "${base}/enclosures" \
  10. -mindepth 5 \
  11. -type f \
  12. -mtime +91 \
  13. -delete
  14. find "${base}/enclosures" \
  15. -type d \
  16. -empty \
  17. -delete
  18. per_station () {
  19. . ./app/etc.sh
  20. curl \
  21. --output logo.svg \
  22. --remote-time \
  23. --silent \
  24. --time-cond logo.svg \
  25. --url "${LOGO_URL}" \
  26. --user-agent "https://mro.name/radio-privatkopie"
  27. [ app/etc.sh -ot about.rdf ] || {
  28. export LOGO_URL PROGRAM_URL STREAM_URL
  29. envsubst < "${base}/app/about.rdf.env" \
  30. | xmllint \
  31. --encode utf-8 \
  32. --format \
  33. --nsclean \
  34. --output about.rdf \
  35. -
  36. }
  37. }
  38. readonly cwd="$(pwd)"
  39. for etc in "${base}/stations"/*/"app/etc.sh"
  40. do
  41. cd "${cwd}" || continue
  42. cd "$(dirname "${etc}")/.." || continue
  43. per_station
  44. done