Compare commits
2 Commits
21a7e0cede
...
e32acae572
| Author | SHA1 | Date | |
|---|---|---|---|
| e32acae572 | |||
| ec296b76db |
17
Fotobox.py
17
Fotobox.py
@ -38,7 +38,6 @@ class Fotobox:
|
||||
|
||||
camera.preview_configuration.main.size = res
|
||||
camera.preview_configuration.main.format = 'BGR888'
|
||||
camera.preview_configuration.transform = Transform(hflip=1, vflip=1)
|
||||
camera.configure("preview")
|
||||
|
||||
self._capture_config = camera.create_still_configuration()
|
||||
@ -238,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,
|
||||
@ -261,7 +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,))
|
||||
upload.parent.mkdir(parents=True, exist_ok=True)
|
||||
os.link(path, upload)
|
||||
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())
|
||||
|
||||
|
||||
4
Photo.py
4
Photo.py
@ -1,7 +1,7 @@
|
||||
from PIL import Image
|
||||
|
||||
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:
|
||||
@ -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.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):
|
||||
height = width / self.photo_image.width * self.photo_image.height
|
||||
|
||||
@ -8,7 +8,7 @@ from pygame import Surface
|
||||
from pygame.time import Clock
|
||||
from qrcode.main import QRCode
|
||||
|
||||
DEBUG: bool = True
|
||||
DEBUG: bool = False
|
||||
|
||||
WIDTH: int = 800
|
||||
HEIGHT: int = 480
|
||||
|
||||
7
rsync.sh
Normal file → Executable file
7
rsync.sh
Normal file → Executable file
@ -2,4 +2,9 @@
|
||||
|
||||
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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user