Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
github.com/erebusbat/camera-upload-organizer
This is a quick and dirty little utility I wrote to mess around with Go and solve a problem.
I have the dropbox app on my wife and I's (is that correct? English is hard) phone set to auto upload all of our photos.
Dropbox puts these photos into the /Camera Uploads
folder, which is great for backup but not ideal for sharing as Dropbox does not allow you to create a public album from this folder.
I have a public Photostream photo album that I share with my family. Given that I am not uploading any TMZ worthy pictures, by a matter of practice I want all my photos that both my wife and I take to upload into this album in a sane, sortable manner.
$ go get -v github.com/ErebusBat/camera-upload-organizer/
$ go install github.com/ErebusBat/camera-upload-organizer/app/photorg
# Should now have $GOPATH/bin/photorg
The photorg
(Photo Organizer) tool uses a very simple TOML config file:
SourcePath = "/data/Dropbox/Camera Uploads"
DestRoot = "/data/Dropbox/Photos/Photostream"
You can specifc the name of the config file as the first argument:
photorg /path/to/config_file.toml
If no file is specified then the tool will look for a file named config.toml
in the current working directory.
The photorg
tool will move and all photos from the SourcePath
into the DestRoot
, creating a tree like:
.
βββ 2014
βΒ Β βββ 2014-01 January
βΒ Β βββ 2014-02 February
βΒ Β βββ 2014-03 March
βΒ Β βββ 2014-04 April
βΒ Β βββ 2014-05 May
βΒ Β βββ 2014-06 June
βΒ Β βββ 2014-07 July
βΒ Β βββ 2014-08 August
βΒ Β βββ 2014-09 September
βΒ Β βββ 2014-10 October
βΒ Β βββ 2014-11 November
βΒ Β βββ 2014-12 December
βββ 2015
βββ 2015-01 January
βββ 2015-02 February
βββ 2015-03 March
It will only create folders for photos with the given dates. If you didn't have any pictures in May 2014 then that folder would not be created.
The photorg
tool will attempt to first read the photo date from the EXIF data, then from the file name (formatted in the way the iOS Dropbox app uploads it), and then from the date (lstat) of the file.
If one were so inclined they could write a custom decoder (See photorg.RegisterDecoder
). In fact this is how the lstat encoder is implemented (See main.dumpDecoderInfo
).
I set this up on my media server to run and move my pictures, always ensuring they are in the correct date folder.
0,15,30,45 * * * * /bin/bash -l -c 'cd /data/Dropbox/Camera\ Uploads && photorg >> ~/.photorg.log 2>&1'
git checkout -b my-new-feature
git commit -am 'Add some feature'
git push origin my-new-feature
Go is far more strict and perhaps verbose than Ruby; however it provides a much better deploy time story.
I had a much uglier and simple version of this tool implemented as a maid script. The problem with that is that it ran on my laptop, because that is where my ruby environment was setup. I could have installed ruby on my media server and all that jazz... I just never got around to it.
With go, I just compile and have a static binary that I scp to my server and bob is your uncle.
Also it is fast... like lightning fast.
You could even use something like golang-geo to perform actions on where the picture was taken at.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.