media_archiver 0.0.7.4 → 0.1.0.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: 0bc7914076c82e83671f9da307e6413778ab336dc0fac5ff37c821cfcba45483
4
+ data.tar.gz: 0b7348949bf4f630eb3aefdf70a826ae27ea83e80c3e35f6aac7c629554ebe98
5
5
  SHA512:
6
- metadata.gz: 2060edd130553c3f20bf9e336c51b769482079e09c4e9d091351b80395de2cff130b7b02374c5a7d9f97116d2dc11b5cf09596431540df1cd4378cbe9852eee9
7
- data.tar.gz: 53ea5eb281e05d2c53d1d4bd953092d533c0e84ec9f8e6cfd2c66ea6ee1ea24c3ff4f5c4f1f6ac4ac89f5217315d84dcfbb30859d26bfaa4dd1599fbf582c03d
6
+ metadata.gz: f8e11dc5459ff6d7f54bde0c4d45bf56c7af7650d8cd0f445ef18aac4d32e86b64fb4752c77d499e690635f48cc523774eeb931b5fb7210375015c6b7236dbd5
7
+ data.tar.gz: a7b8d045a070ca6f0361d622b3e844726c935e81186675b4ca14f0696f5b209d186d3213e92f49b2ba321e11071714d782671fd0fa4bf943dbdd756af8e7d1b4
data/CHANGELOG.md ADDED
@@ -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.1.0.0'.freeze
3
3
  end
@@ -20,10 +20,9 @@ Gem::Specification.new do |spec|
20
20
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
21
  spec.require_paths = ['lib']
22
22
 
23
- spec.add_development_dependency 'bundler', '~> 1'
24
- spec.add_development_dependency 'rake', '~> 11'
25
- spec.add_development_dependency 'byebug', '~> 9'
23
+ spec.add_development_dependency 'bundler', '~> 2'
24
+ spec.add_development_dependency 'rake', '~> 13'
26
25
 
27
- spec.add_dependency 'mini_exiftool', '~> 2.7'
28
- spec.add_dependency 'thor', '~> 0'
26
+ spec.add_dependency 'mini_exiftool', '~> 2.14'
27
+ spec.add_dependency 'thor', '~> 1.3'
29
28
  end
metadata CHANGED
@@ -1,14 +1,13 @@
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.1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Ramalho
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2017-07-04 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -16,70 +15,56 @@ dependencies:
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '1'
18
+ version: '2'
20
19
  type: :development
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: '1'
25
+ version: '2'
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: rake
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - "~>"
32
31
  - !ruby/object:Gem::Version
33
- version: '11'
32
+ version: '13'
34
33
  type: :development
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - "~>"
39
38
  - !ruby/object:Gem::Version
40
- version: '11'
41
- - !ruby/object:Gem::Dependency
42
- name: byebug
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '9'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '9'
39
+ version: '13'
55
40
  - !ruby/object:Gem::Dependency
56
41
  name: mini_exiftool
57
42
  requirement: !ruby/object:Gem::Requirement
58
43
  requirements:
59
44
  - - "~>"
60
45
  - !ruby/object:Gem::Version
61
- version: '2.7'
46
+ version: '2.14'
62
47
  type: :runtime
63
48
  prerelease: false
64
49
  version_requirements: !ruby/object:Gem::Requirement
65
50
  requirements:
66
51
  - - "~>"
67
52
  - !ruby/object:Gem::Version
68
- version: '2.7'
53
+ version: '2.14'
69
54
  - !ruby/object:Gem::Dependency
70
55
  name: thor
71
56
  requirement: !ruby/object:Gem::Requirement
72
57
  requirements:
73
58
  - - "~>"
74
59
  - !ruby/object:Gem::Version
75
- version: '0'
60
+ version: '1.3'
76
61
  type: :runtime
77
62
  prerelease: false
78
63
  version_requirements: !ruby/object:Gem::Requirement
79
64
  requirements:
80
65
  - - "~>"
81
66
  - !ruby/object:Gem::Version
82
- version: '0'
67
+ version: '1.3'
83
68
  description: |-
84
69
  Utility that scans a given location for media files and,
85
70
  based on Exif information and a set of rules copies the files over to
@@ -92,6 +77,7 @@ extensions: []
92
77
  extra_rdoc_files: []
93
78
  files:
94
79
  - ".gitignore"
80
+ - CHANGELOG.md
95
81
  - Gemfile
96
82
  - LICENSE.txt
97
83
  - README.md
@@ -107,7 +93,6 @@ homepage: https://github.com/dramalho/media_archiver
107
93
  licenses:
108
94
  - MIT
109
95
  metadata: {}
110
- post_install_message:
111
96
  rdoc_options: []
112
97
  require_paths:
113
98
  - lib
@@ -122,9 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
107
  - !ruby/object:Gem::Version
123
108
  version: '0'
124
109
  requirements: []
125
- rubyforge_project:
126
- rubygems_version: 2.6.11
127
- signing_key:
110
+ rubygems_version: 3.6.9
128
111
  specification_version: 4
129
112
  summary: Utility to organize media files based on metadata
130
113
  test_files: []