upload fix
This commit is contained in:
parent
ec296b76db
commit
e32acae572
16
Fotobox.py
16
Fotobox.py
@ -237,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,
|
||||||
@ -260,13 +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())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
6
rsync.sh
6
rsync.sh
@ -3,6 +3,8 @@
|
|||||||
cd "$(dirname "$0")/data/photos/upload" || exit 1
|
cd "$(dirname "$0")/data/photos/upload" || exit 1
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
rsync -a -e 'ssh -p 2222' ./* mc@mc.ph87.de:/srv/fotobox.online/html/p/
|
if compgen -G "./*" > /dev/null; then
|
||||||
sleep 60
|
rsync -a --remove-source-files -e 'ssh -p 2222' ./* mc@mc.ph87.de:/srv/fotobox.online/html/p/
|
||||||
|
fi
|
||||||
|
sleep 3
|
||||||
done
|
done
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user