photein 0.0.1 β 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +115 -73
- data/lib/photein/image.rb +1 -2
- data/lib/photein/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8358c084cdf56bab539d9f429706a606cb346b33e7832e056054b2a4ead67e08
|
4
|
+
data.tar.gz: c9e77f835d2ba2d39a3edb08e5fc6973a1871b82c52a823e3bf15a446c263f80
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08be8726129d9b2c2ffcfe4f9ba206db82619c6b6cd1f8f50339d7390988a3c224c9ecb69da7dedc6edfee5e0c479f6ea4119551af75716039e55eda4635cdc7'
|
7
|
+
data.tar.gz: a91a5a3be62081f8a25333f323a1ed98f2e34421134878679d5af8f3fce674c8e7ef8e1a299d4caa3afd9364af38fbe6ef8136045bfe15ac614afd9cf4d2f9ba
|
data/README.md
CHANGED
@@ -1,115 +1,157 @@
|
|
1
1
|
PhπΈtein
|
2
2
|
========
|
3
3
|
|
4
|
-
|
4
|
+
All your photos under one roof.
|
5
5
|
|
6
|
-
|
7
|
-
|
6
|
+
What does it do?
|
7
|
+
----------------
|
8
8
|
|
9
|
-
|
9
|
+
This repo provides two related programs: `photein` and `xferase`.
|
10
10
|
|
11
|
-
|
12
|
-
but if I donβt control the pipeline for viewing/managing it,
|
13
|
-
then does it really?)
|
11
|
+
### Photein
|
14
12
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
Photein is a CLI utility for managing your photos **at the filesystem level**.
|
14
|
+
It wonβt let you browse or edit your photos,
|
15
|
+
but it will give them a uniform folder structure and filenames,
|
16
|
+
no matter where they come from:
|
19
17
|
|
20
|
-
|
21
|
-
|
18
|
+
```sh
|
19
|
+
# Before # After
|
20
|
+
|
21
|
+
~/Pictures ~/Pictures
|
22
|
+
βββ _inbox βββ _inbox
|
23
|
+
βββ 1619593208911.jpeg βββ 2020
|
24
|
+
βββ DCIM β βββ 2020-08-01_113129.heic
|
25
|
+
β βββ 2021_03_26 β βββ 2020-05-20_160209.png
|
26
|
+
β βββ R0014285.MOV βββ 2021
|
27
|
+
β βββ R0014286.DNG βββ 2021-02-12_081933a.jpg
|
28
|
+
β βββ R0014286.JPG βββ 2021-02-12_081933b.jpg
|
29
|
+
β βββ R0014287.DNG βββ 2021-02-12_081939.mp4
|
30
|
+
β βββ R0014287.JPG βββ 2021-03-26_161245.mp4
|
31
|
+
βββ IMG_20210212_081933_001.jpg βββ 2021-03-26_161518.dng
|
32
|
+
βββ IMG_20210212_081933_002.jpg βββ 2021-03-26_161518.jpg
|
33
|
+
βββ IMG_8953.HEIC βββ 2021-03-26_170304.dng
|
34
|
+
βββ Screenshot_20200520_160209.png βββ 2021-03-26_170304.jpg
|
35
|
+
βββ VID_20210212_081939.mp4 βββ 2021-04-28_000008.jpg
|
36
|
+
```
|
22
37
|
|
23
|
-
|
24
|
-
|
38
|
+
> β οΈ **Note**
|
39
|
+
>
|
40
|
+
> If you use a photo management app that decides
|
41
|
+
> where and how your photos should be stored on your system (like Apple Photos),
|
42
|
+
> Photein is not for you.
|
25
43
|
|
26
|
-
|
27
|
-
* EXIF metadata
|
28
|
-
* filename
|
29
|
-
* file birthtime
|
30
|
-
* rename files by that timestamp (`YYYY-mm-dd_HHMMSS.jpg`)
|
31
|
-
* handle conflicts for identical timestamps (`YYYY-mm-dd_HHMMSSa.jpg`, `YYYY-mm-dd_HHMMSSb.jpg`...)
|
32
|
-
* sort files into subdirectories by year (`YYYY/YYYY-mm-dd_HHMMSS.jpg`)
|
33
|
-
* optionally, optimize media for reduced filesize
|
44
|
+
### Xferase
|
34
45
|
|
35
|
-
|
46
|
+
Xferase is a background service built on top of photein.
|
47
|
+
It watches a directory of your choosing,
|
48
|
+
and whenever any files are placed there,
|
49
|
+
it automatically imports them into your photo library.
|
36
50
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
* .mp4
|
42
|
-
* .mov
|
51
|
+
It creates and manages two parallel copies of your library
|
52
|
+
(one original/hi-res, one optimized for web)
|
53
|
+
and ensures that when you delete a photo from one,
|
54
|
+
it is automatically removed from the other.
|
43
55
|
|
44
|
-
|
56
|
+
When combined with other software,
|
57
|
+
Xferase can be used as a self-hosted / DIY alternative
|
58
|
+
to cloud photo services like Google Photos or iCloud.
|
45
59
|
|
46
|
-
|
60
|
+
Why?
|
61
|
+
----
|
47
62
|
|
48
|
-
|
49
|
-
to mount, import from, and unmount your camera
|
50
|
-
whenever you plug it in via USB.
|
63
|
+
I could not find any existing software product that:
|
51
64
|
|
52
|
-
|
53
|
-
$ mkdir -p ~/.local/share/systemd/user
|
54
|
-
$ curl https://raw.githubusercontent.com/rlue/photein/master/examples/share/systemd/user/photein-dcim.service -o ~/.local/share/systemd/user/photein-dcim.service
|
55
|
-
$ systemctl --user daemon-reload
|
56
|
-
$ systemctl --user enable photein-dcim.service
|
57
|
-
```
|
65
|
+
1. imports photos from many sources\* with **no mouse or keyboard interaction**
|
58
66
|
|
59
|
-
|
60
|
-
> assumptions:
|
61
|
-
>
|
62
|
-
> * Your deviceβs label is `RICOH_GR`.
|
63
|
-
> (Use `systemctl --all --full -t device`
|
64
|
-
> to determine the label of your USB device.)
|
65
|
-
> * You use [rbenv][] to manage your systemβs Ruby environment.
|
66
|
-
>
|
67
|
-
> Adjust accordingly.
|
67
|
+
\*_e.g.,_ π± cell phone / π· digital camera / π¬ chat app download
|
68
68
|
|
69
|
-
|
70
|
-
[rbenv]: https://github.com/rbenv/rbenv
|
69
|
+
2. enforces a clean, consistent, **user-visible directory & filename scheme**
|
71
70
|
|
72
|
-
|
71
|
+
(I want to be able to access my photos from the file manager,
|
72
|
+
find them in an βOpen...β dialog,
|
73
|
+
or sync them to other devices with tools like Dropbox or Syncthing.)
|
73
74
|
|
74
|
-
|
75
|
-
your computer. Then, run photein in a cron job to import those photos into
|
76
|
-
your library on a daily basis.
|
75
|
+
3. comes with **no recurring subscription fee**βor better yet, is FOSS
|
77
76
|
|
78
|
-
|
77
|
+
(My digital photo/video library belongs to me,
|
78
|
+
but if I donβt control the pipeline for viewing/managing it,
|
79
|
+
then does it really?)
|
80
|
+
|
81
|
+
4. works with Linux
|
82
|
+
|
83
|
+
> β οΈ **Note**
|
84
|
+
>
|
85
|
+
> Strictly speaking, Photein does not handle requirement #1;
|
86
|
+
> for that, use Xferase in combination with other software,
|
87
|
+
> such as Syncthing or systemd.
|
79
88
|
|
80
89
|
Installation
|
81
90
|
------------
|
82
91
|
|
83
92
|
```sh
|
84
|
-
$
|
85
|
-
$ cd photein
|
86
|
-
$ gem build photein.gemspec
|
87
|
-
$ gem install photein-0.0.1.gem
|
93
|
+
$ gem install photein
|
88
94
|
```
|
89
95
|
|
96
|
+
### Dependencies
|
97
|
+
|
98
|
+
* Ruby 2.7+
|
99
|
+
* [ExifTool][]
|
100
|
+
* [MediaInfo][]
|
101
|
+
* ImageMagick (for `--optimize-for=web` option)
|
102
|
+
* OptiPNG (for `--optimize-for=web` option)
|
103
|
+
* ffmpeg (for `--optimize-for={web,desktop}` options)
|
104
|
+
|
105
|
+
[ExifTool]: https://exiftool.org/
|
106
|
+
[MediaInfo]: https://mediaarea.net/MediaInfo
|
107
|
+
|
90
108
|
Usage
|
91
109
|
-----
|
92
110
|
|
111
|
+
### Simple import
|
112
|
+
|
93
113
|
```sh
|
94
114
|
$ photein \
|
95
|
-
--source
|
96
|
-
--
|
115
|
+
--source /media/ricoh_gr/DCIM \ # batch-import photos from here
|
116
|
+
--recursive \ # including subdirectories
|
117
|
+
--dest /home/rlue/Pictures # into here
|
97
118
|
```
|
98
119
|
|
99
120
|
Use `photein --help` for a summary of all options.
|
100
121
|
|
101
|
-
|
102
|
-
------------
|
122
|
+
#### Supported media formats
|
103
123
|
|
104
|
-
*
|
105
|
-
*
|
106
|
-
*
|
107
|
-
*
|
108
|
-
*
|
109
|
-
*
|
124
|
+
* .jpg
|
125
|
+
* .dng
|
126
|
+
* .heic
|
127
|
+
* .png
|
128
|
+
* .mp4
|
129
|
+
* .mov
|
110
130
|
|
111
|
-
|
112
|
-
|
131
|
+
### Automation guides
|
132
|
+
|
133
|
+
* [π·β‘οΈπ₯οΈ Set up auto-import from a digital camera](doc/auto-import-digital-camera.md)
|
134
|
+
* [π±β‘οΈπ₯οΈ Set up auto-import from an Android phone](doc/auto-import-android-phone.md)
|
135
|
+
* [π±ππ₯οΈ Mirror your library across multiple devices](doc/mirroring-a-library-on-multiple-devices.md)
|
136
|
+
|
137
|
+
Development
|
138
|
+
-----------
|
139
|
+
|
140
|
+
Contributions welcome.
|
141
|
+
|
142
|
+
> β οΈ **Warning**
|
143
|
+
>
|
144
|
+
> The RSpec test suite contains no unit tests.
|
145
|
+
> It solely tests `photein` as a CLI utility, or in other words,
|
146
|
+
> it defines expectations against the effects of `system('photein <args>')`.
|
147
|
+
>
|
148
|
+
> Because `Kernel#system` runs the given command in a subprocess,
|
149
|
+
> it prints to a different stdout than
|
150
|
+
> native Ruby code in a normal RSpec example.
|
151
|
+
> This makes test failures cumbersome to debug,
|
152
|
+
> because `puts` statements never appear in the test output,
|
153
|
+
> and `binding.pry` will cause the test to appear to hang
|
154
|
+
> as it waits for user input on an invisible stdin.
|
113
155
|
|
114
156
|
License
|
115
157
|
-------
|
data/lib/photein/image.rb
CHANGED
@@ -41,9 +41,8 @@ module Photein
|
|
41
41
|
convert << tempfile
|
42
42
|
end unless Photein::Config.dry_run
|
43
43
|
when '.png'
|
44
|
-
return if !Optipng.available?
|
45
|
-
|
46
44
|
FileUtils.cp(path, tempfile, noop: Photein::Config.dry_run)
|
45
|
+
Photein::Logger.info "optimizing #{path}"
|
47
46
|
Optipng.optimize(tempfile, level: 4) unless Photein::Config.dry_run
|
48
47
|
end
|
49
48
|
end
|
data/lib/photein/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: photein
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Lue
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mediainfo
|