瀏覽代碼

[bin] Update NYT and webcam capture

Colin Powell 3 月之前
父節點
當前提交
6ddcdae4b5
共有 1 個文件被更改,包括 60 次插入9 次删除
  1. 60 9
      bin/.bin/webcam-capture

+ 60 - 9
bin/.bin/webcam-capture

@@ -1,17 +1,68 @@
 #!/bin/sh
-host = "loge.local"
-
-if [ "$1" = "east" ]; then
+if [ "$1" = "frontyard" ]; then
+  host="loge.local"
   port=8082
 fi
-
-if [ "$1" = "basement" ]; then
+if [ "$1" = "basement_table" ]; then
+  host="loge.local"
   port=8081
 fi
-
-if [ "$1" = "west" ]; then
+if [ "$1" = "mailbox" ]; then
+  host="loge.local"
+  port=8083
+fi
+if [ "$1" = "house" ]; then
+  port=8083
+  host="kiviuq.local"
+fi
+if [ "$1" = "basement_cape" ]; then
+  port=8081
+  host="kiviuq.local"
+fi
+if [ "$1" = "basement_cape_2" ]; then
+  port=8081
+  host="bebhionn.local"
+fi
+if [ "$1" = "bulkhead" ]; then
+  port=8082
+  host="kiviuq.local"
+fi
+if [ "$1" = "backyard" ]; then
+  port=8083
+  host="paaliaq.local"
+fi
+if [ "$1" = "backyard_low" ]; then
+  port=8082
+  host="paaliaq.local"
+fi
+if [ "$1" = "basement_extension" ]; then
+  port=8083
+  host="paaliaq.local"
+fi
+if [ "$1" = "diningroom" ]; then
+  port=8082
+  host="kari.local"
+fi
+if [ "$1" = "livingroom" ]; then
+  port=8081
+  host="mimas.local"
+fi
+if [ "$1" = "christmas_tree" ]; then
+  port=8083
+  host="mimas.local"
+fi
+if [ "$1" = "backyard_high" ]; then
+  port=8082
+  host="geforce.local"
+fi
+if [ "$1" = "orchard" ]; then
   port=8081
-  host="atlas.local"
+  host="mobian.local"
 fi
 
-curl $host:$port/snapshot -o /media/photos/webcams/$1/$(date +%Y%m%d%H%M%S).jpg
+ROOT="media/photos/misc/webcams"
+mkdir -p /$ROOT/$1/$(date +%Y)/$(date +%m)/$(date +%d)/
+filepath="$1/$(date +%Y)/$(date +%m)/$(date +%d)/$(date +%Y%m%d%H%M%S).jpg"
+curl $host:$port/snapshot -o /$ROOT/$filepath
+url="https://files.lab.unbl.ink/webcams/$filepath"
+curl -H prio:low -H "click:$url" -d "Captured photo from $1 successfully" https://ntfy.unbl.ink/webcams