mirror of
https://github.com/pjandro/fbS1Scripts.git
synced 2025-12-09 02:50:57 +03:00
move binary files to bins folder. Add sleep for tgBot starting
This commit is contained in:
parent
ead4a1ab8a
commit
b13faecefd
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.idea/
|
||||
9
addHosts.sh
Normal file
9
addHosts.sh
Normal file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
cat << EOF | tee -a /server/tmp/etc/hosts
|
||||
185.199.111.133 raw.githubusercontent.com
|
||||
151.101.66.132 deb.debian.org
|
||||
167.82.48.223 files.pythonhosted.org
|
||||
149.154.167.220 api.telegram.org
|
||||
140.82.121.4 github.com
|
||||
EOF
|
||||
sync
|
||||
37
adds/changeCameraSettings.py
Normal file
37
adds/changeCameraSettings.py
Normal file
@ -0,0 +1,37 @@
|
||||
import base64
|
||||
import sys
|
||||
|
||||
file = open("moonraker.db", "r")
|
||||
|
||||
result = []
|
||||
printerIp = sys.argv[1]
|
||||
pattern = '{"name": "timelapse", "service": "mjpegstreamer", "targetFps": 15, "urlStream": "http://{printerIp}:8080/?action=stream", "urlSnapshot": "http://{printerIp}:8080/?action=snapshot", "flipX": false, "flipY": false, "enabled": true, "targetFpsIdle": 5, "aspectRatio": "4:3", "icon": "mdiWebcam", "location": "printer", "rotation": 0, "extra_data": {}}'
|
||||
webcams = False
|
||||
webCamAdded = False
|
||||
while True:
|
||||
line = file.readline()
|
||||
if not line:
|
||||
break
|
||||
splitted = line.split(":")[1].split("->")
|
||||
key = base64.b64decode(splitted[0]).decode()
|
||||
value = base64.b64decode(splitted[1]).decode()
|
||||
if key.startswith("namespace_webcams"):
|
||||
webcams = True
|
||||
newValue = base64.b64encode(b"entries=1").decode()
|
||||
fullNewStr = f"+24,{len(newValue)}:{splitted[0]}->{newValue}\n"
|
||||
result.append(fullNewStr)
|
||||
continue
|
||||
if webcams:
|
||||
if webCamAdded:
|
||||
continue
|
||||
newValue = pattern.replace("{printerIp}", printerIp)
|
||||
newValue = base64.b64encode(newValue.encode()).decode()
|
||||
fullNewStr = f"+48,{len(newValue)}:{splitted[0]}->{newValue}\n"
|
||||
result.append(fullNewStr)
|
||||
webCamAdded = True
|
||||
else:
|
||||
result.append(line)
|
||||
file.close()
|
||||
file = open("moonraker_updated.db", "w")
|
||||
file.write("".join(result))
|
||||
file.close()
|
||||
@ -1,4 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
sleep 15
|
||||
|
||||
cd /home/gem/moonraker-telegram-bot
|
||||
/home/gem/moonraker-telegram-bot-env/bin/python /home/gem/moonraker-telegram-bot/bot/main.py -c /home/gem/printer_data/config/telegram-bot.cfg -l /tmp/tgBot.log
|
||||
|
||||
4
universalInstaller.py
Normal file
4
universalInstaller.py
Normal file
@ -0,0 +1,4 @@
|
||||
import base64
|
||||
import subprocess
|
||||
|
||||
# WIP
|
||||
Loading…
x
Reference in New Issue
Block a user