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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e24eda13e60ea0e81a7ac8005f43f9e9a6bf3f04a48893cab7c10f89fd2021a
4
- data.tar.gz: 7bca13e3736b841bc6ef20f246f3fc6db4c812a31b4204cd0af5399ade995a61
3
+ metadata.gz: 8358c084cdf56bab539d9f429706a606cb346b33e7832e056054b2a4ead67e08
4
+ data.tar.gz: c9e77f835d2ba2d39a3edb08e5fc6973a1871b82c52a823e3bf15a446c263f80
5
5
  SHA512:
6
- metadata.gz: ed7adb5d47bb15496c5c9a30fe9ac54c616b43cc2dace96d611431005496efb5460d374544fa62a95a68abf249150f2983af5338a76080dfebe938bd6448e4e2
7
- data.tar.gz: c17406ac9266527a2d0d85dc61bbc5eeadc90bae17f8ab94885e0616d7d8e06aa400f71b795d2b5c5504853f11c75e76f0a54b5d8d893fdde3f3469860193d83
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
- Import/rename photos & videos from one directory to another.
4
+ All your photos under one roof.
5
5
 
6
- Why?
7
- ----
6
+ What does it do?
7
+ ----------------
8
8
 
9
- * The major cloud photo services (iCloud, Google Photos) are great but not FOSS.
9
+ This repo provides two related programs: `photein` and `xferase`.
10
10
 
11
- (My digital photo/video library belongs to me,
12
- but if I don’t control the pipeline for viewing/managing it,
13
- then does it really?)
11
+ ### Photein
14
12
 
15
- * Importing photos from many sources
16
- (πŸ“± cell phone / πŸ“· digital camera / πŸ’¬ chat app)
17
- into one library with as few manual steps as possible
18
- is not simple, especially on Linux.
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
- What does it do?
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
- Suppose your digital camera creates files with names like `R0017839.JPG`.
24
- Photein will...
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
- * look for a timestamp in...
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
- #### Supported media formats
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
- * .jpg
38
- * .dng
39
- * .heic
40
- * .png
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
- ### So how do I use it?
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
- #### πŸ“· Auto-import from a digital camera (Linux)
60
+ Why?
61
+ ----
47
62
 
48
- Customize the provided [sample systemd service][]
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
- ```sh
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
- > Note: The provided systemd service makes the following
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
- [sample systemd service]: blob/master/examples/share/systemd/user/photein-dcim.service
70
- [rbenv]: https://github.com/rbenv/rbenv
69
+ 2. enforces a clean, consistent, **user-visible directory & filename scheme**
71
70
 
72
- #### πŸ“± Auto-import from an Android phone
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
- Use [Syncthing][] to sync photos from your phone to a staging directory on
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
- [Syncthing]: https://syncthing.net/
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
- $ git clone https://github.com/rlue/photein
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=/media/ricoh_gr/DCIM \ # pull photos & videos from here
96
- --dest=/home/rlue/Pictures # and deposit them here (in per-year subdirectories)
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
- Dependencies
102
- ------------
122
+ #### Supported media formats
103
123
 
104
- * [ExifTool][]
105
- * [MediaInfo][]
106
- * ImageMagick (for `--optimize-for=web` option)
107
- * OptiPNG (for `--optimize-for=web` option)
108
- * ffmpeg (for `--optimize-for={web,desktop}` options)
109
- * lsof (for `--safe` option)
124
+ * .jpg
125
+ * .dng
126
+ * .heic
127
+ * .png
128
+ * .mp4
129
+ * .mov
110
130
 
111
- [ExifTool]: https://exiftool.org/
112
- [MediaInfo]: https://mediaarea.net/MediaInfo
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Photein
4
- VERSION = '0.0.1'
4
+ VERSION = '0.0.2'
5
5
  end
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.1
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-20 00:00:00.000000000 Z
11
+ date: 2021-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mediainfo