upload fix

This commit is contained in:
Patrick Haßel 2025-06-27 23:58:21 +02:00
parent ec296b76db
commit e32acae572
2 changed files with 13 additions and 13 deletions

View File

@ -237,10 +237,10 @@ class Fotobox:
self._qr = qr_create(self._choice.urlWithProtocol)
self._qr_rect = self._qr.get_rect(left=2 * BORDER, centery=SCREEN_RECT.centery)
self.save(self._choice.photo_image, "")
self.save(self._choice.framed_image, "framed")
self.save(self._choice.photo_image, "", False)
self.save(self._choice.framed_image, "framed", True)
def save(self, img: Image, suffix: str):
def save(self, img: Image, suffix: str, do_upload: bool):
filename = "F-%s---R%04d-%s---S%04d-%s---P%04d-%s---%s%s.jpg" % (
self._fotobox_uuid,
self._runtime_number,
@ -260,13 +260,11 @@ class Fotobox:
))
path.parent.mkdir(parents=True, exist_ok=True)
img.convert('RGB').save(path, format='JPEG', quality=95)
upload = Path("./data/photos/upload/%s" % (filename,))
if do_upload:
upload = Path("./data/photos/upload/%s.jpg" % (self._choice.code,))
upload.parent.mkdir(parents=True, exist_ok=True)
os.chmod(upload.parent, 0o777)
os.link(path, upload)
os.chmod(upload, 0o777)
print("Photo saved: %s" % path.absolute())

View File

@ -3,6 +3,8 @@
cd "$(dirname "$0")/data/photos/upload" || exit 1
while true; do
rsync -a -e 'ssh -p 2222' ./* mc@mc.ph87.de:/srv/fotobox.online/html/p/
sleep 60
if compgen -G "./*" > /dev/null; then
rsync -a --remove-source-files -e 'ssh -p 2222' ./* mc@mc.ph87.de:/srv/fotobox.online/html/p/
fi
sleep 3
done