media_archiver 0.0.7.4 → 0.0.8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 04b93847882efe374b7a866c5fe23e9ce04cd51f
4
- data.tar.gz: 2ea2780d6d0d30f6b7ff4b2c81b155278e41a3ea
2
+ SHA256:
3
+ metadata.gz: 4ce1ac4f12983d0c6f200c195060e3eadcf5c67c8424252ad14778e8f6e203fb
4
+ data.tar.gz: 0051bff8d6092cd485e1cc550c45ed2b2edf1c4283cf16fcee93b1841f4969f9
5
5
  SHA512:
6
- metadata.gz: 2060edd130553c3f20bf9e336c51b769482079e09c4e9d091351b80395de2cff130b7b02374c5a7d9f97116d2dc11b5cf09596431540df1cd4378cbe9852eee9
7
- data.tar.gz: 53ea5eb281e05d2c53d1d4bd953092d533c0e84ec9f8e6cfd2c66ea6ee1ea24c3ff4f5c4f1f6ac4ac89f5217315d84dcfbb30859d26bfaa4dd1599fbf582c03d
6
+ metadata.gz: 1dc96376262ba1c526251e0ee12ffddd88bff6abcbcf03de9feb7ec8b26d88329d42903390384c32f53640beb2b2c3b4c6ed9e03caaaaddd0770d08e1796f8c5
7
+ data.tar.gz: 040bdfec4572c487e91a475cfacced57e797be7622b8197ea80b0de7aa81bed1fc2d31bfad5f8e3d544751f8fcc6d375a39d9e5651e175d1aedd96b96029c281
@@ -0,0 +1,17 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ This file was created recently as I didn't document previous changes correctly. I'll try to backport stuff and as I do I'll remove this warning, but in the meantime I'm keeping this for context.
6
+ Also, this process is new to me in terms of taking charge of writting it so I'll make all the necessary newbie mistakes, don't bear with me, point them out!
7
+
8
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
9
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
10
+
11
+
12
+ ## [0.0.8.0] - 2019-02-17
13
+ ### Added
14
+ - `CHANGELOG` file
15
+ ### Changed
16
+ - `copy` command now takes paths as an array, this allows for proper handling of shell expansion of a glob pattern [@dramalho](https://github.com/dramalho).
17
+
@@ -4,42 +4,45 @@ require 'yaml'
4
4
 
5
5
  module MediaArchiver
6
6
  class CLI < Thor
7
- package_name "MediaArchiver"
8
- map "-R" => :recursive
9
- map "-O" => :output_dir
10
- map "-C" => :configuration_file
7
+ package_name 'MediaArchiver'
8
+ map '-R' => :recursive
9
+ map '-O' => :output_dir
10
+ map '-C' => :configuration_file
11
11
 
12
- DEFAULT_OUTPUT_TEMPLATE = ':DateTimeOriginal/:Make/:Model'
12
+ DEFAULT_OUTPUT_TEMPLATE = ':DateTimeOriginal/:Make/:Model'.freeze
13
13
 
14
- desc 'copy [DIR]', 'Scans a folder and archives media files'
14
+ desc 'copy [PATH]', 'Scans a folder and archives media files'
15
15
  method_option :output_dir, aliases: :o, desc: 'Output folder where the files should be copied into'
16
- method_option :recursive, aliases: :r, type: :boolean, default: true, desc: "Recursivelly scan input folder"
16
+ method_option :recursive, aliases: :r, type: :boolean, default: true, desc: 'Recursivelly scan input folder'
17
17
  method_option :output_template
18
18
  method_option :configuration_file, aliases: :c
19
19
  method_option :overwrite_extensions, type: :array
20
- def copy(path = Dir.pwd)
20
+ def copy(*paths)
21
21
  config = configurations(options)
22
22
 
23
- path = File.expand_path(path)
23
+ paths.each do |path|
24
+ path = File.expand_path(path)
24
25
 
25
- MediaFileUtils.new(path).each(config[:recursive]) do |file|
26
- dest = output_path(file, config[:output_dir], config[:output_template])
27
- FileUtils.mkdir_p(File.dirname(dest))
26
+ MediaFileUtils.new(path).each(config[:recursive]) do |file|
27
+ dest = output_path(file, config[:output_dir], config[:output_template])
28
28
 
29
- output = ["File: #{dest}"]
30
- output << if File.exist?(dest)
31
- if config[:overwrite_extensions].empty? || !config[:overwrite_extensions].include?(dest.split('.').last.downcase)
32
- '[SKIP]'
29
+ FileUtils.mkdir_p(File.dirname(dest))
30
+
31
+ output = ["File: #{dest}"]
32
+ output << if File.exist?(dest)
33
+ if config[:overwrite_extensions].empty? || !config[:overwrite_extensions].include?(dest.split('.').last.downcase)
34
+ '[SKIP]'
35
+ else
36
+ FileUtils.cp(file.path, dest)
37
+ '[OVERWRITE]'
38
+ end
33
39
  else
34
40
  FileUtils.cp(file.path, dest)
35
- '[OVERWRITE]'
41
+ '[OK]'
36
42
  end
37
- else
38
- FileUtils.cp(file.path, dest)
39
- '[OK]'
40
- end
41
43
 
42
- puts output.join(' ')
44
+ puts output.join(' ')
45
+ end
43
46
  end
44
47
  end
45
48
 
@@ -59,12 +62,10 @@ module MediaArchiver
59
62
  end
60
63
 
61
64
  def system_configurations
62
- config_file = [
63
- File.expand_path(Dir.pwd),
64
- Dir.home
65
- ].map { |path| File.join(path, '.media_archiver_conf.yml') }
66
- .keep_if { |f| File.file? f }
67
- .first
65
+ config_file = system_configuration_file_paths
66
+ .map { |path| File.join(path, '.media_archiver_conf.yml') }
67
+ .keep_if { |f| File.file? f }
68
+ .first
68
69
 
69
70
  return {} unless config_file
70
71
 
@@ -83,7 +84,7 @@ module MediaArchiver
83
84
  value = file.exif_tags[key.to_s.downcase]
84
85
  value = value.to_date.to_s if value.is_a?(Time)
85
86
 
86
- value || "Unknown"
87
+ value || 'Unknown'
87
88
  else
88
89
  key
89
90
  end
@@ -106,5 +107,12 @@ module MediaArchiver
106
107
  def symbolize_keys!(hash)
107
108
  hash.each_with_object({}) { |(k, v), acc| acc[k.to_sym] = v }
108
109
  end
110
+
111
+ def system_configuration_file_paths
112
+ [
113
+ File.expand_path(Dir.pwd),
114
+ Dir.home
115
+ ]
116
+ end
109
117
  end
110
118
  end
@@ -1,3 +1,3 @@
1
1
  module MediaArchiver
2
- VERSION = "0.0.7.4"
2
+ VERSION = '0.0.8.0'.freeze
3
3
  end
@@ -21,9 +21,9 @@ Gem::Specification.new do |spec|
21
21
  spec.require_paths = ['lib']
22
22
 
23
23
  spec.add_development_dependency 'bundler', '~> 1'
24
- spec.add_development_dependency 'rake', '~> 11'
25
24
  spec.add_development_dependency 'byebug', '~> 9'
25
+ spec.add_development_dependency 'rake', '~> 11'
26
26
 
27
- spec.add_dependency 'mini_exiftool', '~> 2.7'
27
+ spec.add_dependency 'mini_exiftool', '~> 2.9'
28
28
  spec.add_dependency 'thor', '~> 0'
29
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: media_archiver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7.4
4
+ version: 0.0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Ramalho
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-07-04 00:00:00.000000000 Z
11
+ date: 2019-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -25,47 +25,47 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1'
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: byebug
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '11'
33
+ version: '9'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '11'
40
+ version: '9'
41
41
  - !ruby/object:Gem::Dependency
42
- name: byebug
42
+ name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '9'
47
+ version: '11'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '9'
54
+ version: '11'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: mini_exiftool
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '2.7'
61
+ version: '2.9'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '2.7'
68
+ version: '2.9'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: thor
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -92,6 +92,7 @@ extensions: []
92
92
  extra_rdoc_files: []
93
93
  files:
94
94
  - ".gitignore"
95
+ - CHANGELOG.md
95
96
  - Gemfile
96
97
  - LICENSE.txt
97
98
  - README.md
@@ -122,8 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
123
  - !ruby/object:Gem::Version
123
124
  version: '0'
124
125
  requirements: []
125
- rubyforge_project:
126
- rubygems_version: 2.6.11
126
+ rubygems_version: 3.0.1
127
127
  signing_key:
128
128
  specification_version: 4
129
129
  summary: Utility to organize media files based on metadata