imagebackup 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.travis.yml +6 -0
- data/Gemfile +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +29 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/imagebackup.gemspec +31 -0
- data/lib/imagebackup.rb +24 -0
- data/lib/imagebackup/version.rb +3 -0
- metadata +71 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fd0e7ca138aacdb7f82e68b6845178c71cb3bd9e03d8bc05b372926551cb0559
|
4
|
+
data.tar.gz: 9ab674efe9f757717d7b41a8e409aa7c5a1b8b8f4658b692037481d9f5b3afab
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1043f49b4ee2c606fdb591a7c281940d988cb64be0b4f1e3080905b04db91b2f4edcd37d3d083af45ed270abc9bac7e8a65f2339b1dcb706cdfe45593f48b942
|
7
|
+
data.tar.gz: fadeb0cc976e8bcab244941a309836e7995da2c84c0ac7fd9f5dd31a1da4414d28626b616eee20b472d07007f5f949288c462dd03131488f89b91a5a8859c72b
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 adrian-sal-kennedy
|
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,29 @@
|
|
1
|
+
# ImageBackup
|
2
|
+
|
3
|
+
## Keep your photos and videos organized by date.
|
4
|
+
|
5
|
+
### A simple terminal app to crawl a folder (usually a camera card's DCIM folder) for pictures and videos, and pop them in dated folders to your destination folder of choice. Uses exif data when available, creation_time, or the file's own creation date if nothing better is present.
|
6
|
+
|
7
|
+
|
8
|
+
## Dependencies:
|
9
|
+
|
10
|
+
- **Ruby**, plus gems:
|
11
|
+
- exiv2
|
12
|
+
- ffmpeg-video-info
|
13
|
+
- Ruby modules:
|
14
|
+
- fileutils.rb
|
15
|
+
|
16
|
+
|
17
|
+
## Usage:
|
18
|
+
|
19
|
+
```bash
|
20
|
+
$ cd /media/username/EOS_DIGITAL/DCIM
|
21
|
+
$ imagebackup ~/Photos/raw
|
22
|
+
```
|
23
|
+
This will search all files within the DCIM folder, check them with either exiv2 (for stills) or ffprobe (for videos) and retrieve their creation dates.
|
24
|
+
It will then copy them to a folder of the form ```~/Photos/raw/<yyyy>-<mm>-<dd>```
|
25
|
+
If it's unable to find metadata in a file it will look at the file's creation time attribute, which is less reliable but usually ok.
|
26
|
+
|
27
|
+
|
28
|
+
## Options:
|
29
|
+
-m will move (deleting the original), which is probably not a good idea in most cases but still useful at times.
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "imagebackup"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/imagebackup.gemspec
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require_relative 'lib/imagebackup/version'
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "imagebackup"
|
5
|
+
spec.version = Imagebackup::VERSION
|
6
|
+
spec.authors = ["adrian-sal-kennedy"]
|
7
|
+
spec.email = ["adrian.sal.kennedy@gmail.com"]
|
8
|
+
|
9
|
+
spec.summary = %q{A simple CLI app to backup all pics and vids from current folder to a destination in yyyy-mm-dd folders.}
|
10
|
+
spec.description = %q{Uses Exiv2 and ffprobe to find creation dates for media types it finds.}
|
11
|
+
spec.homepage = "https://github.com/adrian-sal-kennedy/imagebackup"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
14
|
+
|
15
|
+
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
# spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here."
|
19
|
+
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
24
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
25
|
+
end
|
26
|
+
spec.bindir = "exe"
|
27
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
|
+
spec.require_paths = ["lib"]
|
29
|
+
|
30
|
+
spec.add_dependency 'exiv2' 'ffmpeg-video-info'
|
31
|
+
end
|
data/lib/imagebackup.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require_relative 'imagebackup/version'
|
3
|
+
|
4
|
+
require 'exiv2'
|
5
|
+
|
6
|
+
file_types = [
|
7
|
+
'**/*.CR2',
|
8
|
+
'**/*.DNG',
|
9
|
+
'**/*.MOV',
|
10
|
+
'**/*.MP4'
|
11
|
+
]
|
12
|
+
|
13
|
+
Dir.glob(file_types).each do |f|
|
14
|
+
puts "#{Dir.pwd}/#{f}"
|
15
|
+
file = "#{Dir.pwd}/#{f}"
|
16
|
+
image = Exiv2::ImageFactory.open(file)
|
17
|
+
image.read_metadata
|
18
|
+
# p image.iptc_data.each do |k,v|
|
19
|
+
# puts "#{k} = #{v}\n"
|
20
|
+
# end
|
21
|
+
# p date = image.exif_data.member?("Exif.Image.DateTime")
|
22
|
+
p date = image.exif_data.find { |v| v[0] == 'Exif.Image.DateTime' }
|
23
|
+
gets
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: imagebackup
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- adrian-sal-kennedy
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-03-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: exiv2ffmpeg-video-info
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Uses Exiv2 and ffprobe to find creation dates for media types it finds.
|
28
|
+
email:
|
29
|
+
- adrian.sal.kennedy@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".gitignore"
|
35
|
+
- ".rspec"
|
36
|
+
- ".travis.yml"
|
37
|
+
- Gemfile
|
38
|
+
- LICENSE.txt
|
39
|
+
- README.md
|
40
|
+
- Rakefile
|
41
|
+
- bin/console
|
42
|
+
- bin/setup
|
43
|
+
- imagebackup.gemspec
|
44
|
+
- lib/imagebackup.rb
|
45
|
+
- lib/imagebackup/version.rb
|
46
|
+
homepage: https://github.com/adrian-sal-kennedy/imagebackup
|
47
|
+
licenses:
|
48
|
+
- MIT
|
49
|
+
metadata:
|
50
|
+
homepage_uri: https://github.com/adrian-sal-kennedy/imagebackup
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 2.3.0
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
requirements: []
|
66
|
+
rubygems_version: 3.1.2
|
67
|
+
signing_key:
|
68
|
+
specification_version: 4
|
69
|
+
summary: A simple CLI app to backup all pics and vids from current folder to a destination
|
70
|
+
in yyyy-mm-dd folders.
|
71
|
+
test_files: []
|