Crates.io | photobook |
lib.rs | photobook |
version | 0.2.0 |
source | src |
created_at | 2020-07-10 16:23:56.075639 |
updated_at | 2020-07-10 21:37:13.312903 |
description | a command line tool to harvest, organize, download from clouds and backup your photos |
homepage | https://gitlab.com/slyatwork/photobook |
repository | https://gitlab.com/slyatwork/photobook |
max_upload_size | |
id | 263743 |
size | 121,354 |
A rust command line tool to harvest, organize, download from clouds and backup your photos.
Packaged with an Elasticsearch database and Kibana as consultation interface.
First Clone this repo.
Adapt the code and configurations as needed.
Then run
$ cargo build --release
The PhotoBook bin will be available under the target/release
directory of the project.
Finally, don't forget to fulfill the config photobook.toml
to get an operational tool (see below).
This tool is packaged and published on crates.io.
Simply install it on your system with cargo !
$ cargo install photobook
Note : beware to copy your config file described below where your system attempts it.
For example, on a linux system, the photobook.toml
must land on /home/<your user>/.config/photobook/
.
PhotoBook proposes 4 main features:
This command creates an inventory of all the pictures referenced in a source, as a filesystem or a flickr repository, and stores it in an elasticsearch database.
Then you can consult, request those documents as you need, to create by your own albums, favorites, and more.
Harvest command allows 3 operations:
initialize to (re)create a proper index based on the pictures from a source : $ photobook harvest -o initialize -s flickr
update to maintain your index up to date (the default operation)
$ photobook harvest -o update -s flickr
$ photobook harvest -s flickr // update is the default operation, so could be omit
clean to remove from your index deleted pictures into the source
$ photobook harvest -o clean -s flickr
and 2 sources:
local to inventory from a path (mandatory) on your local filesystem
$ photobook harvest -s local -p '/home/comtelabs/pictures/'
flickr connecting a flickr account and referencing all photos stored on its repository whatever their status is
$ photobook harvest -o initialize -s flickr
This command performs a structured and supervised copy of pictures from a directory to another.
Organize command thus expects 2 mandatory arguments:
The process only operates pictures located into the source directory, filtering files by their type.
It orders and sorts pictures by year, month and date, then creates a tree of directories based on this sorting architecture, and finally stores them according to these criteria.
Command examples:
$ photobook organize --from '/home/comtelabs/pictures/' --to '/data/pictures/'
$ photobook organize -f '/home/comtelabs/pictures/' -t '/data/pictures/'
This command is dedicated to cloud photo sources, and as the name suggests, download photo from a cloud to a local path.
To use it, you will need to harvest first the cloud chosen: the PhotoBook database references all photos stored on the cloud, and follows photo lives.
Download command proposes one source (Flickr at this time) and need a target path to save your photos. Note iCloud is on the road map !
And allows 2 modes of download:
full to download all photos owned by the flickr user configured that have not been downloaded before whatever their flickr status is (the default feature).
$ photobook -t '/home/comtelabs/pictures/'
server to download all photos stored on a defined flickr server, and that have not been downloaded before, whatever their flickr status is. Note you can find the server list in the dedicated index through a simple query on Kibana.
$ photobook -t '/home/comtelabs/pictures/' -s 936
Not released yet
PhotoBook works with an Elasticsearch database and Kibana as database consultation tool.
ELK stack offers powerful applications and tools for free, if you have simple needs.
2 major advantages for an individual developer of a tool dedicated to privacy usage are:
How to get elastic ?
How to use elastic dockers ?
ensure docker and docker-compose are installed on your machine
and then simply run and re-run each time you need it
$ docker-compose down && docker-compose up -d
your elastic database will be listened to http://localhost:9200
and especially kibana will be available from any browser at http://localhost:5601
Isn't it simply great ?
Configurations are stored into 2 files:
constant.rs
file you will have to create on the project root.photobook.toml
file that is create by default on the user config directory of your system.
photobook.toml
must land on /home/<your user>/.config/photobook/
.photobook
command, it will create an empty default file that you will be able to find, searching about photobook.toml
on your filesystem.A constant_sample.rs
is provided in the /src directory of this public repo to present expected configs:
Elasticsearch
pub const ELASTIC_URL: &str = "http://localhost:9200";
pub const ELASTIC_PICTURES_INDEX: &str = "pictures";
pub const ELASTIC_FLICKR_PHOTOS_INDEX: &str = "flickr_photos";
Flickr
pub const FLICKR_API_URL: &str = "https://api.flickr.com/services/rest";
pub const FLICKR_NONCE: &str = "my_flickr_nonce";
A photobook_sample.toml
is provided on the root of this repo, and will expect those keys:
flickr_key = '<my flickr key>'
flickr_secret = '<my flickr secret>'
flickr_oauth_token = '<my oauth token>'
flickr_oauth_secret = '<my oauth secret>'
Note : PhotoBook uses the last Flickr API based on OAuth 1.0.
Please refer to Flickr API documentation to get or create your tokens and keys.
Some common usages have been described above, widely using the short form of argument declaration.
For further explain please consult the CLI help for more: help is provided by a -h
or --help
mention after any command or sub-command.
For example:
$ photobook --help
$ photobook harvest -h
PhotoBook is an open source project, so feel free to use, re-use, amend, enrich it and more.
The major requirement, according to the CeCILL license (GNU compatible), is to share your evolution and modification with the author.
If so, please just send your code here !
Copyright Silvère Camponovo
Code and program published under CeCILL v2.1 license. Please read LICENCE file before any use.