Compare commits

..

2 Commits

Author SHA1 Message Date
e32acae572 upload fix 2025-06-27 23:58:21 +02:00
ec296b76db removed wron flip 2025-06-27 23:38:45 +02:00
5 changed files with 19 additions and 11 deletions

View File

@ -38,7 +38,6 @@ class Fotobox:
camera.preview_configuration.main.size = res camera.preview_configuration.main.size = res
camera.preview_configuration.main.format = 'BGR888' camera.preview_configuration.main.format = 'BGR888'
camera.preview_configuration.transform = Transform(hflip=1, vflip=1)
camera.configure("preview") camera.configure("preview")
self._capture_config = camera.create_still_configuration() self._capture_config = camera.create_still_configuration()
@ -238,10 +237,10 @@ class Fotobox:
self._qr = qr_create(self._choice.urlWithProtocol) self._qr = qr_create(self._choice.urlWithProtocol)
self._qr_rect = self._qr.get_rect(left=2 * BORDER, centery=SCREEN_RECT.centery) self._qr_rect = self._qr.get_rect(left=2 * BORDER, centery=SCREEN_RECT.centery)
self.save(self._choice.photo_image, "") self.save(self._choice.photo_image, "", False)
self.save(self._choice.framed_image, "framed") 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" % ( filename = "F-%s---R%04d-%s---S%04d-%s---P%04d-%s---%s%s.jpg" % (
self._fotobox_uuid, self._fotobox_uuid,
self._runtime_number, self._runtime_number,
@ -261,7 +260,11 @@ class Fotobox:
)) ))
path.parent.mkdir(parents=True, exist_ok=True) path.parent.mkdir(parents=True, exist_ok=True)
img.convert('RGB').save(path, format='JPEG', quality=95) 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) upload.parent.mkdir(parents=True, exist_ok=True)
os.chmod(upload.parent, 0o777)
os.link(path, upload) os.link(path, upload)
os.chmod(upload, 0o777)
print("Photo saved: %s" % path.absolute()) print("Photo saved: %s" % path.absolute())

View File

@ -1,7 +1,7 @@
from PIL import Image from PIL import Image
from Event import Event, shrink_inside from Event import Event, shrink_inside
from config import THUMB_WIDTH, pil_image_to_surface, SCREEN_RECT, BORDER, now, generate_code, HTTPS, DOMAIN, PHOTO_HEIGHT from config import THUMB_WIDTH, pil_image_to_surface, SCREEN_RECT, BORDER, now, generate_code, HTTPS, DOMAIN, PHOTO_HEIGHT, WIDTH
class Photo: class Photo:
@ -29,7 +29,7 @@ class Photo:
self.thumb_rect = self.thumb_surface.get_rect(centery=SCREEN_RECT.centery, left=(self.number - 1) * (THUMB_WIDTH + BORDER) + BORDER) self.thumb_rect = self.thumb_surface.get_rect(centery=SCREEN_RECT.centery, left=(self.number - 1) * (THUMB_WIDTH + BORDER) + BORDER)
self.chosen_surface = pil_image_to_surface(shrink_inside(self.framed_image, THUMB_WIDTH, PHOTO_HEIGHT)) self.chosen_surface = pil_image_to_surface(shrink_inside(self.framed_image, THUMB_WIDTH, PHOTO_HEIGHT))
self.chosen_rect = self.thumb_surface.get_rect(centery=SCREEN_RECT.centery, left=(self.number - 1) * (THUMB_WIDTH + BORDER) + BORDER) self.chosen_rect = self.chosen_surface.get_rect(right=WIDTH - 2 * BORDER, centery=SCREEN_RECT.centery)
def _resize(self, width: float): def _resize(self, width: float):
height = width / self.photo_image.width * self.photo_image.height height = width / self.photo_image.width * self.photo_image.height

View File

@ -8,7 +8,7 @@ from pygame import Surface
from pygame.time import Clock from pygame.time import Clock
from qrcode.main import QRCode from qrcode.main import QRCode
DEBUG: bool = True DEBUG: bool = False
WIDTH: int = 800 WIDTH: int = 800
HEIGHT: int = 480 HEIGHT: int = 480

7
rsync.sh Normal file → Executable file
View File

@ -2,4 +2,9 @@
cd "$(dirname "$0")/data/photos/upload" || exit 1 cd "$(dirname "$0")/data/photos/upload" || exit 1
rsync -a ./* fotobox@mc.ph87.de:/srv/fotobox.online/html/p/ while true; do
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

0
upload.sh Normal file → Executable file
View File