bacardi55 / pimaton

A customizable photo booth application for Raspberry Pi
GNU General Public License v3.0
2 stars 4 forks source link

Store to %%uuid%% sub-directories #5

Closed ukoofred closed 6 years ago

ukoofred commented 6 years ago

Maybe can store the pictures by UUID sub directories could give some possibilities :

I'm looking to link this to a Event website solution. Bee free to ask if you want some shares of my ideas & works

bacardi55 commented 6 years ago

I actually manage this outside of pimaton because i don't want to introduce html generation or things like that in pimaton

Have a look here https://bacardi55.org/pimaton/part5-optional-webgallery.html

Let me know if that answers your needs :)

And please do share your ideas, multiple brains are always better than one (:

ukoofred commented 6 years ago

Ok that's what i have in mind đź‘Ť Just by clean paths/sub-directorys store pictures by sessions on the source will be better for rsync and easier to manage them on destination. My Gallery / CMS will be able to generate good looking responsive pages with some other stuffs :

I will share a prototype maybe on few days

james-lasersoft commented 6 years ago

Consider using a serial type number for each possible equipment in the field to maintain separate directories on the server. I am using something similar to the _version.py file called _serial.py and manually changing for each device.

bacardi55 commented 6 years ago

@ukoofred i can implement a simple.option to create directory per photo session that would be easy if you think there is an interest doing so.

@james-lasersoft i'm sorry but didn't understood wgat you mean...

ukoofred commented 6 years ago

Yes it could be betterto simplify job on thé other side webserver or simple hosting.

Le sam. 5 mai 2018 Ă  18:32, bacardi55 notifications@github.com a Ă©crit :

@ukoofred https://github.com/ukoofred i can implement a simple.option to create directory per photo session that would be easy if you think there is an interest doing so.

@james-lasersoft https://github.com/james-lasersoft i'm sorry but didn't understood wgat you mean...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/bacardi55/pimaton/issues/5#issuecomment-386817711, or mute the thread https://github.com/notifications/unsubscribe-auth/AgPRt0LvMcDOf5hH6b5QhgFD6NK1GUaXks5tvdQlgaJpZM4Tzr-- .

--

Pour toutes demandes d'assistance, veuillez envoyer vos demandes à l'adresse support@ukoo.pro mailto:support@ukoo.pro http://www.ukoo.fr/

Tél. : 03.89.64.05.12

Site : www.ukoo.fr http://www.ukoo.fr/

Adresse : 37, Boulevard Alfred Wallach 68100 MULHOUSE

  http://www.facebook.com/agence.web.ukoo|   http://twitter.com/#!/agence_web_ukoo| Le blog http://blog.ukoo.fr/

https://www.google.com/partners/#a_profile;idtf=08191393431854158427;

https://www.prestashop.com/fr/agences-web-partenaires/or/ukoo

http://www.rhenatic.eu/membre/ukoo/

james-lasersoft commented 6 years ago

@bacardi55 I plan on having multiple photo booths installed. I would like to see a type of serial number that would be part of the UUID and identify which machine the photos were generated from as a way to segregate them on the server and possibly fixing some problems that may arise.

bacardi55 commented 6 years ago

@james-lasersoft You can use options already there for this. just use different picture_prefix_name and / or generated_prefix_name

https://github.com/bacardi55/pimaton/blob/master/pimaton/assets/default_config_full.yaml

james-lasersoft commented 6 years ago

OK, I have implemented all of the sample server side code you suggested using sigal. My first thought at this point without reworking anything is that you are moving all of the rsynced files on the server to different sub-directories. This makes the destination directory empty. On the second iteration of a photo session it will now rsync all of the files, including the first session. This continues increasing, after 20 photo sessions it rsyncs 120 files to the server. Would it not be better to eliminate them from the booth side after the rsync is successful? Or replicate the server action (if syncing is enabled) and move them to the same sub-directory structure so they are not rsynced every time.

I think the more efficient method would be direct elimination therefore maintaining free disk space on the booth.

It would also be neat to add a configuration variable to point to the ssh certificate key instead of having to configure the ~/.ssh/config file for the user and server. I believe that this would make new machines easier to configure.

@bacardi55 And as to your last answer about serial numbering or identifying with the picture_prefix_name, yes that works. It does make for a more difficult edit. If you could place a single file similar as to what you use for the _version.py file in the /boot directory this could be edited with windows at the time the SD card was first written. Alternatively using the hostname automatically for the picture_prefix_name could also eliminate that need altogether.

bacardi55 commented 6 years ago

Indeed, seems I'm rsync-ing too much as I move files on remote server, but that could be improved by changing the server side script to create symlink instead of moving files.

That being said, I'm thinking of adding an option to create directory for each pimaton run as you suggested as it might simplify the whole process…

I'm not sure about the deletion option though, as it might end up in picture being lost (eg: if a transfer goes wrong at some point? Rsync should fix that next round but still…)

It would also be neat to add a configuration variable to point to the ssh certificate key instead of having to configure the ~/.ssh/config file for the user and server. I believe that this would make new machines easier to configure.

I can work on that, shouldn't be too hard.

It does make for a more difficult edit. If you could place a single file similar as to what you use for the _version.py file in the /boot directory this could be edited with windows at the time the SD card was first written.

Pimaton should be independent of things outside of its configuration, so I don't think a random file placed somewhere in an installation (like the ssh file in boot) is a good solution.

I don't think anyone will use pimaton default configuration, so as you have to update the config, why not just put the hostname in the 2 given options? If you use automated deployment script, this can still be automated.

bacardi55 commented 6 years ago

I've implemented the per run directory option in this commit

https://git.bacardi55.org/bacardi55/pimaton/issues/49#issuecomment-105

If you want to have a directory per run (including taken and generated pictures), use: In picamera: photo_directory: "/home/pi/pimaton_pictures/%%uuid%%" In image → print_pic: output_dir: "/home/pi/pimaton_pictures/%%uuid%%"

Or you can still have everything in the same folder or have a directory for taken pic and another for generated ones. And even a per directory per run within these 2 folders, like this: In picamera: photo_directory: "/home/pi/pimaton_pictures/taken_pics/%%uuid%%" In image → print_pic: output_dir: "/home/pi/pimaton_pictures/generated_pics/%%uuid%%"

@ukoofred @james-lasersoft happy to read some feedbacks on that (:

james-lasersoft commented 6 years ago

I would agree that we are not going to use the default config file. But that said once my config file and install are working the way I want there should be no problem with cloning the install to an identical hardware install. I do this with other types of equipment and only need to change the hostname of the device and run a script that downloads a new VPN certificate to connect back to me. All the rest of the configs are static.

As to the location: I can edit a file in the /boot directory of the SD card on the windows machine used to write the card. This is much easier than having to boot it and login to fix these configs.

That said I would prefer to use the hostname as an additional identifier in the file name to for me to determine which machine was used.

I will checkout the per directory code this afternoon and comment later.

bacardi55 commented 6 years ago

I've implemented the hostname thing in the master branch. Now, you can use %%hostname%% placeholder in Picamera → picture_prefix_name and/or in image → print_pic → generated_prefix_name

bacardi55 commented 6 years ago

I think with %%uuid%% in directory path name and %%hostname%% in the image names, it solves the issue. I'm closing this ticket for now, but feel free to reopen it if needed.

james-lasersoft commented 6 years ago

Exactly what I wanted but it doesn't seem to be creating the directories in the capture_image routine

image

In this example I am only using the %%uuid%% and this is the error it gives. With the %%hostname%% as well it compounds the issue.

bacardi55 commented 6 years ago

I'll give it a try tonight. Can you share your config file ? Or at least the value for the path and file names.

bacardi55 commented 6 years ago

@james-lasersoft I've tested again by trying different possibility for

picamera → photo_directory: "/home/pi/pimaton_pictures/taken/%%uuid%%"
picamera → picture_prefix_name: "%%hostname%%_taken"
image → print_pic → output_dir: "/home/pi/pimaton_pictures/generated/%%uuid%%"
image → print_pic → generated_prefix_name: "%%hostname%%_generated"

but it seemed to work fine here.

Please:

james-lasersoft commented 6 years ago

To start I just cloned a clean copy from github. I am using the config lines you used as an example in your config and have created the base directory and it belongs to pi:pi or www-data (neither makes a difference).

I am getting this at the moment. I run and start the pics but it hangs on the first picture. After I kill the python process I get this error: image

PiCamera Options are as follows; image Image Options: image

When testing I try to change as little as possible until things work. Then I tend to mix the pot and see what comes out.

Interesting that in the error I am getting the place holders and not the value. If I don't use the sessions directory or the hostname all works normally and even the QR code portion generates correctly with the unique keys on each generated picture.

Thanks for your help

bacardi55 commented 6 years ago

I think you are using the pimaton installed via pip (so 0.4) and not the latest master code branch.

To test, you need to clone the repo and run it like: git clone https.... cd pimaton python pimaton.py --config...

james-lasersoft commented 6 years ago

I did not realize that I needed to change the launch line. I had cloned the repo but my computer was still using something from the old version. I guess that it explains why it didn't make much sense.

Seems to be working normally now after getting some permissions set on the destination.

Thanks,

this can be closed now

bacardi55 commented 6 years ago

great, thanks for the tests! :)