webcam-capture 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/bin/sh
  2. if [ "$1" = "frontyard" ]; then
  3. host="loge.local"
  4. port=8082
  5. fi
  6. if [ "$1" = "basement_table" ]; then
  7. host="loge.local"
  8. port=8081
  9. fi
  10. if [ "$1" = "mailbox" ]; then
  11. host="loge.local"
  12. port=8083
  13. fi
  14. if [ "$1" = "house" ]; then
  15. port=8083
  16. host="kiviuq.local"
  17. fi
  18. if [ "$1" = "basement_cape" ]; then
  19. port=8081
  20. host="kiviuq.local"
  21. fi
  22. if [ "$1" = "basement_cape_2" ]; then
  23. port=8081
  24. host="bebhionn.local"
  25. fi
  26. if [ "$1" = "bulkhead" ]; then
  27. port=8082
  28. host="kiviuq.local"
  29. fi
  30. if [ "$1" = "backyard" ]; then
  31. port=8083
  32. host="paaliaq.local"
  33. fi
  34. if [ "$1" = "backyard_low" ]; then
  35. port=8081
  36. host="paaliaq.local"
  37. fi
  38. if [ "$1" = "basement_extension" ]; then
  39. port=8082
  40. host="paaliaq.local"
  41. fi
  42. if [ "$1" = "diningroom" ]; then
  43. port=8082
  44. host="kari.local"
  45. fi
  46. if [ "$1" = "livingroom" ]; then
  47. port=8081
  48. host="mimas.local"
  49. fi
  50. if [ "$1" = "christmas_tree" ]; then
  51. port=8083
  52. host="mimas.local"
  53. fi
  54. if [ "$1" = "backyard_high" ]; then
  55. port=8082
  56. host="geforce.local"
  57. fi
  58. if [ "$1" = "orchard" ]; then
  59. port=8081
  60. host="mobian.local"
  61. fi
  62. ROOT="/var/photos/misc/webcams"
  63. filepath="$1/$(date +%Y)/$(date +%m)/$(date +%d)/$(date +%Y%m%d%H%M%S).jpg"
  64. mkdir -p /$ROOT/$1/$(date +%Y)/$(date +%m)/$(date +%d)/
  65. curl $host:$port/snapshot -o /$ROOT/$filepath
  66. url="https://files.lab.unbl.ink/webcams/$filepath"
  67. curl -H prio:low -H "click:$url" -d "Captured photo from $1 successfully" https://ntfy.unbl.ink/webcams