flickarr 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: c1a4f5663fb2b4656993bc7d505a4351f0eb6462be9c7be9c93e1a3f8bea1b50
4
+ data.tar.gz: 984db8707cff6d63685b8e137722a092feeeb453da838750c796c0d17c0564b1
5
+ SHA512:
6
+ metadata.gz: f5b54f40b7baf2e8fba73a1113ff85756721684e45194e5f86ee6af51131b7d89d3ec089d4d01be212546f37ac4d35d76a53f7dc2535fa522d35f1cb1c516543
7
+ data.tar.gz: 72a742302f25405933445a910e1f52d5dc21f47bcf6ecaade46b2f724b144f7d78e1e7e4d933bf6cc25b73118fe9e904864d214d4c648439c3fa37f495329803
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,13 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2026-03-20 01:20:48 UTC using RuboCop version 1.85.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ RSpec/ExpectActual:
12
+ Exclude:
13
+ - "spec/flickarr_spec.rb"
data/CHANGELOG.md ADDED
@@ -0,0 +1,42 @@
1
+ ## [Unreleased]
2
+
3
+ ### Commands
4
+ - `flickarr init` — create config directory and stub config file
5
+ - `flickarr auth` — authenticate with Flickr via OAuth
6
+ - `flickarr config` / `flickarr config <key>` — show configuration
7
+ - `flickarr config:set key=value` — set configuration values
8
+ - `flickarr export` / `flickarr export:posts` — export all posts (photos + videos)
9
+ - `flickarr export URL` — export a single post by Flickr URL
10
+ - `flickarr export:photos` — export only photos
11
+ - `flickarr export:videos` — export only videos
12
+ - `flickarr export:sets` / `flickarr export:albums` — export photosets/albums
13
+ - `flickarr export:collections` — export collections (groups of albums)
14
+ - `flickarr export:profile` — export Flickr profile (avatar, metadata, social links)
15
+ - `flickarr status` — show archive summary with local/upstream counts
16
+ - `flickarr open` — open archive folder in Finder
17
+ - `flickarr path` — print archive path (for scripting)
18
+ - `flickarr errors` — print path to _errors.log
19
+ - `flickarr help` / `-h` / `--help` — show help
20
+
21
+ ### Features
22
+ - Post/Photo/Video model hierarchy with delegated media behavior
23
+ - Full metadata sidecars (JSON + YAML) with EXIF, geo, tags, license, owner, sizes, URLs
24
+ - License model mapping Flickr IDs to human-readable names and Creative Commons URLs
25
+ - Profile data merged from people.getInfo and profile.getProfile
26
+ - Video support with poster frame download
27
+ - Fallback to smaller video sizes when original is unavailable on CDN
28
+ - Rate limiter (1 req/sec) on all Flickr API calls
29
+ - Resume state: saves last page per media type, resumes on next run
30
+ - Fast skip: checks file existence from list data before per-post API calls
31
+ - Graceful Ctrl+C: saves progress and exits cleanly
32
+ - Failed exports logged to _errors.log with post URL and timestamp
33
+ - `--limit N` counts actual downloads, not skips
34
+ - `--overwrite` to re-download existing files; default skips them
35
+ - `--overwrite` on `status` busts cached upstream totals
36
+ - Smart URL routing: `export URL` auto-detects post, set/album, collection, or profile URLs
37
+ - Single post/set/collection export by URL
38
+ - Client with query object API: `client.photo(id:).info`, `client.profile(user_id:).info`
39
+
40
+ ## [0.1.0] - 2026-03-19
41
+
42
+ - Initial release
@@ -0,0 +1,10 @@
1
+ # Code of Conduct
2
+
3
+ "flickarr" follows [The Ruby Community Conduct Guideline](https://www.ruby-lang.org/en/conduct) in all "collaborative space", which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.):
4
+
5
+ * Participants will be tolerant of opposing views.
6
+ * Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
7
+ * When interpreting the words and actions of others, participants should always assume good intentions.
8
+ * Behaviour which can be reasonably considered harassment will not be tolerated.
9
+
10
+ If you have any concerns about behaviour within this project, please contact us at ["veganstraightedge@gmail.com"](mailto:"veganstraightedge@gmail.com").
data/HELP.txt ADDED
@@ -0,0 +1,50 @@
1
+ Export and archive your Flickr library
2
+
3
+ USAGE
4
+ flickarr command [options]
5
+ flickarr command:subcommand [options]
6
+
7
+ EXAMPLES
8
+ flickarr export
9
+ flickarr export https://flickr.com/veganstraightedge/3513998015
10
+ flickarr export https://flickr.com/veganstraightedge/3513998015 --overwrite
11
+
12
+ flickarr export --limit 5
13
+ flickarr export:photos --limit 7
14
+ flickarr export:videos --limit 3
15
+
16
+ ARGUMENTS
17
+ URL URL of single item to download from Flickr
18
+
19
+ FLAGS
20
+ --limit N Stop after N downloads
21
+ --overwrite Re-download and overwrite existing files
22
+
23
+ COMMANDS:
24
+ init Create config directory and stub config file
25
+ auth Authenticate with Flickr
26
+ config Show current configuration
27
+ config <key> Show a single config value
28
+ config:set Set configuration values (key=value)
29
+
30
+ open Open archive folder in Finder
31
+ path Print archive path (for scripting)
32
+ status Show archive summary
33
+ errors Print path to _errors.log
34
+
35
+ export Export all posts
36
+ export <URL> Export a single post by URL
37
+ export:photo <URL> Export a single post by URL
38
+ export:video <URL> Export a single post by URL
39
+
40
+ export:posts Export all posts (photos + videos)
41
+ export:photos Export only photos
42
+ export:videos Export only videos
43
+
44
+ export:sets Export all photosets with references to posts
45
+ export:sets <URL> Export a single photoset with references to posts
46
+ export:albums Export all albums with references to posts
47
+ export:albums <URL> Export a single album with references to posts
48
+ export:collections Export all collections (groups of albums)
49
+ export:collections <URL> Export a single collection (groups of albums) with references to albums
50
+ export:profile Export Flickr profile to archive
data/HOWTO.md ADDED
@@ -0,0 +1,260 @@
1
+ # How to use Flickarr
2
+
3
+ A step-by-step guide to exporting your Flickr library.
4
+
5
+ ## 1. Check your Ruby version
6
+
7
+ Flickarr requires Ruby 4.0 or newer.
8
+
9
+ ```sh
10
+ ruby -v
11
+ ```
12
+
13
+ If you need to install or update Ruby, see https://ruby-lang.org/en/downloads
14
+
15
+ ## 2. Install Flickarr
16
+
17
+ ```sh
18
+ gem install flickarr
19
+ ```
20
+
21
+ ## 3. Create a Flickr API app
22
+
23
+ You need your own Flickr API key and secret. Flickarr uses these to authenticate with the Flickr API on your behalf.
24
+
25
+ 1. Go to https://www.flickr.com/services/apps/create/
26
+ 2. Click "Apply for a Non-Commercial Key"
27
+ 3. Fill in the form:
28
+ - **Application Name**: anything you want (e.g. "Flickarr Export")
29
+ - **Description**: anything (e.g. "Personal archive export")
30
+ 4. Submit the form
31
+ 5. Copy your **Key** and **Secret** from the confirmation page
32
+
33
+ <!-- TODO: screenshot of Flickr API key creation page -->
34
+ <!-- TODO: screenshot of Flickr API key and secret confirmation page -->
35
+
36
+ ## 4. Initialize Flickarr
37
+
38
+ This creates a config file at `~/.flickarr/config.yml`.
39
+
40
+ ```sh
41
+ flickarr init
42
+ ```
43
+
44
+ By default, your archive will be saved to `~/Pictures/Flickarr/`. After you authenticate, a subfolder with your Flickr username is created automatically (e.g. `~/Pictures/Flickarr/veganstraightedge/`).
45
+
46
+ To use a different base location:
47
+
48
+ ```sh
49
+ flickarr init /path/to/your/archive
50
+ ```
51
+
52
+ ## 5. Save your API credentials
53
+
54
+ ```sh
55
+ flickarr config:set api_key=YOUR_KEY shared_secret=YOUR_SECRET
56
+ ```
57
+
58
+ Verify they're saved:
59
+
60
+ ```sh
61
+ flickarr config
62
+ ```
63
+
64
+ ## 6. Authenticate with Flickr
65
+
66
+ ```sh
67
+ flickarr auth
68
+ ```
69
+
70
+ This starts the OAuth flow:
71
+
72
+ 1. Flickarr prints a URL — open it in your browser
73
+ 2. Flickr asks you to authorize the app — click "OK, I'll Authorize It"
74
+ 3. Flickr shows you a verification code (9 digits, like `888-675-309`)
75
+ 4. Copy that code
76
+ 5. Paste the code back into your terminal
77
+
78
+ <!-- TODO: screenshot of Flickr OAuth authorization page -->
79
+ <!-- TODO: screenshot of Flickr verification code page -->
80
+
81
+ After authenticating, your access tokens, username, and user ID are saved to the config file. You only need to do this once.
82
+
83
+ ## 7. Export your profile
84
+
85
+ ```sh
86
+ flickarr export:profile
87
+ ```
88
+
89
+ This downloads your profile metadata (JSON + YAML), avatar image, and account info to `~/Pictures/Flickarr/username/Profile/`.
90
+
91
+ ## 8. Export your photos and videos
92
+
93
+ Export everything:
94
+
95
+ ```sh
96
+ flickarr export
97
+ ```
98
+
99
+ This paginates through your entire Flickr timeline (most recent first) and downloads each photo/video with full metadata sidecars. It respects Flickr's rate limit (1 request per second).
100
+
101
+ For a large library, this will take a while. You can:
102
+
103
+ - **Limit** how many to download in one run: `flickarr export --limit 100`
104
+ - **Interrupt** with Ctrl+C — progress is saved and the next run picks up where you left off
105
+ - **Resume** — just run `flickarr export` again; already-downloaded files are skipped instantly
106
+
107
+ Export only photos or only videos:
108
+
109
+ ```sh
110
+ flickarr export:photos
111
+ flickarr export:videos
112
+ ```
113
+
114
+ Export a single item by its Flickr URL — `export` auto-detects the URL type (post, album, collection, or profile):
115
+
116
+ ```sh
117
+ flickarr export https://flickr.com/photos/USERNAME/3513998015
118
+ flickarr export https://flickr.com/photos/USERNAME/sets/72157718538273371/
119
+ flickarr export https://flickr.com/photos/USERNAME/albums/72157718538273371/
120
+ flickarr export https://flickr.com/photos/USERNAME/collections/72157666222057746/
121
+ flickarr export https://flickr.com/photos/USERNAME/
122
+ ```
123
+
124
+ ## 9. Export your albums and collections
125
+
126
+ Albums (sets) are exported as folders of reference files that point to your downloaded photos/videos:
127
+
128
+ ```sh
129
+ flickarr export:sets
130
+ # or
131
+ flickarr export:albums
132
+ ```
133
+
134
+ Export a single album by URL:
135
+
136
+ ```sh
137
+ flickarr export:sets https://www.flickr.com/photos/USERNAME/sets/72157718538273371/
138
+ ```
139
+
140
+ Collections (groups of albums) work the same way:
141
+
142
+ ```sh
143
+ flickarr export:collections
144
+ ```
145
+
146
+ Export a single collection by URL:
147
+
148
+ ```sh
149
+ flickarr export:collections https://www.flickr.com/photos/USERNAME/collections/72157666222057746/
150
+ ```
151
+
152
+ ## 10. Check your progress
153
+
154
+ ```sh
155
+ flickarr status
156
+ ```
157
+
158
+ Shows a summary of your archive: how many photos, videos, sets, and collections are downloaded vs. total available.
159
+
160
+ The upstream totals are fetched from Flickr on first run and cached in your config file. To refresh them:
161
+
162
+ ```sh
163
+ flickarr status --overwrite
164
+ ```
165
+
166
+ ## 11. Utility commands
167
+
168
+ Open your archive folder in Finder:
169
+
170
+ ```sh
171
+ flickarr open
172
+ ```
173
+
174
+ Print the archive path (useful for scripting):
175
+
176
+ ```sh
177
+ flickarr path
178
+ ```
179
+
180
+ Check the error log for any failed downloads:
181
+
182
+ ```sh
183
+ flickarr errors
184
+ cat $(flickarr errors)
185
+ ```
186
+
187
+ ## Re-downloading
188
+
189
+ By default, Flickarr skips files that already exist. To force a re-download:
190
+
191
+ ```sh
192
+ flickarr export --overwrite
193
+ flickarr export URL --overwrite
194
+ flickarr export:profile --overwrite
195
+ flickarr export:sets --overwrite
196
+ ```
197
+
198
+ ## Archive structure
199
+
200
+ ```
201
+ ~/Pictures/Flickarr/username/
202
+ _errors.log # log of any failed downloads
203
+
204
+ Profile/
205
+ avatar.jpg
206
+ profile.json
207
+ profile.yaml
208
+
209
+ 2016/
210
+ 11/
211
+ 12/
212
+ 12345678901_oh-no-photo.jpg # original size photo
213
+ 12345678901_oh-no-photo.json # full metadata (EXIF, geo, tags, license, etc.)
214
+ 12345678901_oh-no-photo.yaml # same metadata in YAML
215
+ 13/
216
+ 98765432101_cubs-win-video.mp4 # original video (or best available)
217
+ 98765432101_cubs-win-video.jpg # poster frame
218
+ 98765432101_cubs-win-video.json
219
+ 98765432101_cubs-win-video.yaml
220
+
221
+ Sets/
222
+ 72157718538273371_vacation-photos/
223
+ set.json # set metadata (title, description, dates)
224
+ set.yaml
225
+ photos.json # ordered list of photo references with file paths
226
+ photos.yaml
227
+
228
+ Collections/
229
+ 375727-72157666222057746_travel/
230
+ collection.json # collection metadata
231
+ collection.yaml
232
+ sets.json # references to sets in this collection
233
+ sets.yaml
234
+ ```
235
+
236
+ ## Metadata sidecar contents
237
+
238
+ Each photo/video sidecar includes:
239
+
240
+ - **Camera**: make, model, and full EXIF data
241
+ - **Dates**: taken, uploaded, last updated
242
+ - **Description**: post description/caption
243
+ - **Geo/Location**: latitude, longitude, locality, region, country
244
+ - **License**: ID, human-readable name, and Creative Commons URL
245
+ - **Owner**: username, real name, NSID
246
+ - **Sizes**: all available sizes with dimensions and URLs
247
+ - **Tags**: full tag list
248
+ - **URLs**: Flickr page URL
249
+ - **Views**: view count
250
+ - **Visibility**: public, friends, family
251
+
252
+ ## Troubleshooting
253
+
254
+ **"Not authenticated" error**: Run `flickarr auth` to complete the OAuth flow.
255
+
256
+ **Video download 404**: Some older videos may not have their original resolution available on Flickr's CDN. Flickarr automatically falls back to the next best available size. If all sizes fail, the error is logged to `_errors.log`.
257
+
258
+ **Rate limiting**: Flickarr respects Flickr's 1 request/second rate limit. If you see rate limit errors, just wait and try again.
259
+
260
+ **Resuming after interruption**: Flickarr saves your progress after each page. Just run the same export command again to resume.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Shane Becker
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,109 @@
1
+ # Flickarr
2
+
3
+ Export an archive of your Flickr library — photos, videos, metadata, tags, albums, collections, and profile.
4
+
5
+ ## What you get
6
+
7
+ ```
8
+ ~/Pictures/Flickarr/username/
9
+ Profile/
10
+ avatar.jpg
11
+ profile.json
12
+ profile.yaml
13
+ 2016/
14
+ 11/
15
+ 02/
16
+ 12345678901_cubs-win-photo.jpg
17
+ 12345678901_cubs-win-photo.json
18
+ 12345678901_cubs-win-photo.yaml
19
+ Sets/
20
+ 72157718538273371_vacation-photos/
21
+ set.json
22
+ set.yaml
23
+ photos.json
24
+ photos.yaml
25
+ Collections/
26
+ 375727-72157666222057746_travel/
27
+ collection.json
28
+ collection.yaml
29
+ sets.json
30
+ sets.yaml
31
+ ```
32
+
33
+ Photos and videos are organized by date taken (`YYYY/MM/DD`). Each media file has JSON and YAML sidecar files with full metadata: EXIF, geo/location, tags, license, owner, sizes, and more.
34
+
35
+ Sets and collections are folders of reference files that point to the downloaded media.
36
+
37
+ ## Installation
38
+
39
+ ```sh
40
+ gem install flickarr
41
+ ```
42
+
43
+ ## Quick start
44
+
45
+ ```sh
46
+ flickarr init
47
+ flickarr config:set api_key=YOUR_KEY shared_secret=YOUR_SECRET
48
+ flickarr auth
49
+ flickarr export
50
+ ```
51
+
52
+ See [HOWTO.md](HOWTO.md) for detailed setup instructions.
53
+
54
+ ## Usage
55
+
56
+ ```sh
57
+ # Export everything
58
+ flickarr export
59
+
60
+ # Export a single post by URL
61
+ flickarr export https://www.flickr.com/photos/username/12345678901
62
+
63
+ # Export only photos or only videos
64
+ flickarr export:photos
65
+ flickarr export:videos
66
+
67
+ # Export with a limit
68
+ flickarr export --limit 10
69
+
70
+ # Re-download existing files
71
+ flickarr export --overwrite
72
+
73
+ # Export albums, sets, collections, profile
74
+ flickarr export:sets
75
+ flickarr export:albums
76
+ flickarr export:collections
77
+ flickarr export:profile
78
+
79
+ # Utility commands
80
+ flickarr status
81
+ flickarr open
82
+ flickarr path
83
+ flickarr config
84
+ flickarr errors
85
+ ```
86
+
87
+ Run `flickarr help` for the full command reference.
88
+
89
+ ## Requirements
90
+
91
+ - Ruby >= 4.0
92
+ - A [Flickr API key](https://flickr.com/services/apps/create)
93
+
94
+ ## Development
95
+
96
+ ```sh
97
+ git clone https://github.com/veganstraightedge/flickarr.git
98
+ cd flickarr
99
+ bin/setup
100
+ bundle exec rake spec
101
+ ```
102
+
103
+ ## Contributing
104
+
105
+ Bug reports and pull requests are welcome on GitHub at https://github.com/veganstraightedge/flickarr.
106
+
107
+ ## License
108
+
109
+ MIT License. See [LICENSE.txt](LICENSE.txt).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ require 'rubocop/rake_task'
7
+
8
+ RuboCop::RakeTask.new
9
+
10
+ task default: %i[spec rubocop]
data/TODO.md ADDED
@@ -0,0 +1,6 @@
1
+ # Flickarr TODO
2
+
3
+ ## Features
4
+
5
+ - [ ] Retry on transient network failures (5xx, timeouts)
6
+ - [ ] Verify downloaded file integrity (checksum or size check)
data/exe/flickarr ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'flickarr'
4
+
5
+ Flickarr::CLI.new(ARGV).run
@@ -0,0 +1,43 @@
1
+ module Flickarr
2
+ class Auth
3
+ def initialize config, config_path: CLI::DEFAULT_CONFIG_PATH
4
+ @config = config
5
+ @config_path = config_path
6
+ @client = Client.new(config)
7
+ end
8
+
9
+ def authenticated?
10
+ !@config.access_token.nil? && !@config.access_secret.nil?
11
+ end
12
+
13
+ def authenticate
14
+ flickr = @client.flickr
15
+
16
+ request_token = flickr.get_request_token
17
+ auth_url = flickr.get_authorize_url request_token['oauth_token'], perms: 'read'
18
+
19
+ puts 'Open this URL in your browser to authorize Flickarr:'
20
+ puts auth_url
21
+
22
+ verifier = prompt_for_verifier
23
+
24
+ flickr.get_access_token request_token['oauth_token'], request_token['oauth_token_secret'], verifier
25
+
26
+ login = flickr.test.login
27
+
28
+ @config.access_token = flickr.access_token
29
+ @config.access_secret = flickr.access_secret
30
+ @config.user_nsid = login.id
31
+ @config.username = login.username
32
+
33
+ @config.save @config_path
34
+
35
+ puts "Authenticated as #{@config.username}"
36
+ end
37
+
38
+ def prompt_for_verifier
39
+ print 'Enter the verification code: '
40
+ $stdin.gets.strip
41
+ end
42
+ end
43
+ end