mm_tool 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eb195a344b506ce9706580970d5e8db8843bf53b537161d63577dc84577089dc
4
- data.tar.gz: b06f0eff5f6b0aeddd08b5ac1792d9cdf0869df5babab29fb771f9d3fac28e9d
3
+ metadata.gz: 437af0237de0f684c70ebc8d7f6db4432e0b6196e4c3e787f3e2bf4507cfcd10
4
+ data.tar.gz: 3a28861a1398fa974570d1909a8d45105e0fc2d8cf7e1251e19feb8a7fbb3494
5
5
  SHA512:
6
- metadata.gz: a68290286f7db0bbcf5a0440c22ad3a213224439530c73280e70426fc52601a2d52d9c9dac278c7558de9b06317b8e284aae78ca6031b7b74f56f3b699c5823c
7
- data.tar.gz: 769b79d23c56d70d9bbf4fa857629bad1376e332e7b6c87280a86d7d21dd0c54fe029c222a000dd7861c7aa764988372f81fc4e2dc754de3110bd79dd8a0bcb6
6
+ metadata.gz: 8070cef42b5cb9617bc467cce28591e08c52c36bb0c2edcf546a605028fa3b34f1dd0ca3d19fa8fed0f58e1b22ef59d1c21fd5059b1a192a7861b7ec0e1de6f2
7
+ data.tar.gz: c6920b52041cc3318470595e73beb2ecf54f69d5b639f92c44e736d0b18c801a5e7b8f09dbd45e010dc1142744670341baa054fc7ba25f4db4e1d205f66fcba3
data/README.md CHANGED
@@ -5,7 +5,12 @@ mm_tool, a multimedia tool
5
5
 
6
6
  # About
7
7
 
8
- tbd
8
+ Handles lots of media files with ffpmeg as a batch. Useful for cleaning, consolidating,
9
+ remuxing, and re-encoding media libraries.
10
+
11
+ # Installation
12
+
13
+ `gem install mm_tool` should do the trick.
9
14
 
10
15
 
11
16
  # Change log
@@ -13,3 +18,11 @@ tbd
13
18
  - 0.1.0
14
19
 
15
20
  - Initial release.
21
+
22
+ - 0.1.1
23
+
24
+ - Fix to gemspec.
25
+
26
+ - 0.1.2
27
+
28
+ - Current WIP.
@@ -53,12 +53,10 @@ module MmTool
53
53
  <<~HEREDOC
54
54
  #!/bin/sh
55
55
 
56
- # Check this file, make any changes, and save it. It will be executed as soon
57
- # as you close it. By default, this script will exit per the exit command
58
- # below. Please further confirm that you wish to proceed with the proposed
59
- # actions by commenting or removing the line below.
60
-
61
- exit 1
56
+ # Check this file, make any changes, and save it. Execute it directly,
57
+ # or execute it with the sh command if it's not executable.
58
+
59
+ set -e
62
60
 
63
61
  HEREDOC
64
62
  end
@@ -97,15 +95,15 @@ module MmTool
97
95
  else
98
96
  @file_count[:processed] = @file_count[:processed] + 1
99
97
  movie = MmMovie.new(with_file: file_name)
100
- a = movie.interesting?
98
+ a = movie.interesting? # already interesting if low-quality, but separate quality check made for logic, below.
101
99
  b = MmMovieIgnoreList.shared_ignore_list.include?(file_name)
102
- c = movie.low_quality?
100
+ c = movie.meets_minimum_quality?
103
101
  s = @defaults[:scan_type]&.to_sym
104
102
 
105
- if (s == :normal && a && !b && !c) ||
103
+ if (s == :normal && a && !b && c) ||
106
104
  (s == :all && !b) ||
107
105
  (s == :flagged && b) ||
108
- (s == :quality && c ) ||
106
+ (s == :quality && !c ) ||
109
107
  (s == :force)
110
108
 
111
109
  @file_count[:displayed] = @file_count[:displayed] + 1
@@ -58,10 +58,19 @@ module MmTool
58
58
  # Indicates whether any of the streams are of a lower
59
59
  # quality than desired by the user.
60
60
  #------------------------------------------------------------
61
- def low_quality?
61
+ def has_low_quality_streams?
62
62
  @streams.count {|stream| stream.low_quality?} > 0
63
63
  end
64
64
 
65
+ #------------------------------------------------------------
66
+ # Indicates whether or not a file has at least one high-
67
+ # quality video stream and high-quality audio stream.
68
+ #------------------------------------------------------------
69
+ def meets_minimum_quality?
70
+ @streams.count {|stream| stream.codec_type == 'audio' && !stream.low_quality? } > 0 &&
71
+ @streams.count {|stream| stream.codec_type == 'video' && !stream.low_quality? } > 0
72
+ end
73
+
65
74
  #------------------------------------------------------------
66
75
  # Indicates whether any of the streams are interesting.
67
76
  #------------------------------------------------------------
@@ -122,7 +131,10 @@ module MmTool
122
131
  @streams.each {|stream| command << " #{stream.instruction_map}" if stream.instruction_map }
123
132
  @streams.each {|stream| command << " #{stream.instruction_action}" if stream.instruction_action }
124
133
  @streams.each {|stream| command << " #{stream.instruction_disposition}" if stream.instruction_disposition }
125
- @streams.each {|stream| command << " #{stream.instruction_metadata}" if stream.instruction_metadata }
134
+ @streams.each do |stream|
135
+ stream.instruction_metadata.each { |instruction| command << " #{instruction}" }
136
+ end
137
+
126
138
  command << " -metadata title=\"#{format_title}\" \\" if format_title
127
139
  command << " \"#{output_path}\""
128
140
  command.join("\n")
@@ -52,7 +52,7 @@ module MmTool
52
52
  def add(path:)
53
53
  new_list = @ignore_list |= [path]
54
54
  @ignore_list = new_list.sort
55
- File.open(file_path, 'w') { |file| file.write(@ignore_list.to_yaml) }
55
+ File.open(file_path, 'w') { |file| file.write(@ignore_list.to_yaml(options = {:line_width => -1})) }
56
56
  end
57
57
 
58
58
  #------------------------------------------------------------
@@ -60,7 +60,7 @@ module MmTool
60
60
  #------------------------------------------------------------
61
61
  def remove(path:)
62
62
  @ignore_list.delete(path)
63
- File.open(file_path, 'w') { |file| file.write(@ignore_list.to_yaml) }
63
+ File.open(file_path, 'w') { |file| file.write(@ignore_list.to_yaml(options = {:line_width => -1})) }
64
64
  end
65
65
 
66
66
  end # class
@@ -309,22 +309,21 @@ module MmTool
309
309
  end
310
310
 
311
311
  #------------------------------------------------------------
312
- # Property - returns an instruction for setting the metadata
312
+ # Property - returns instructions for setting the metadata
313
313
  # of the stream, if necessary.
314
314
  #------------------------------------------------------------
315
315
  def instruction_metadata
316
+ return [] if @actions.include?(:drop)
317
+
316
318
  # We only want to set fixed_lang if options allow us to fix the language,
317
319
  # and we want to set subtitle language from the filename, if applicable.
318
320
  fixed_lang = @defaults[:fix_undefined_language] ? @defaults[:undefined_language] : nil
319
321
  lang = subtitle_file_language ? subtitle_file_language : fixed_lang
320
- set_language = set_language? ? "language=#{lang} " : nil
321
- set_title = title && ! @defaults[:ignore_titles] ? "title=\"#{title}\" " : nil
322
322
 
323
- if set_language || set_title
324
- "-metadata:s:#{output_specifier} #{set_language}#{set_title}\\"
325
- else
326
- nil
327
- end
323
+ result = []
324
+ result << "-metadata:s:#{output_specifier} language=#{lang} \\" if set_language?
325
+ result << "-metadata:s:#{output_specifier} title=\"#{title}\" \\" if title && ! @defaults[:ignore_titles]
326
+ result
328
327
  end
329
328
 
330
329
  #------------------------------------------------------------
@@ -173,6 +173,7 @@ module MmTool
173
173
 
174
174
  when '--version'
175
175
  puts "#{File.basename $0}, version #{MmTool::VERSION}"
176
+ exit 0
176
177
 
177
178
  when '--'
178
179
  break
@@ -1,3 +1,3 @@
1
1
  module MmTool
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
@@ -30,21 +30,21 @@ Gem::Specification.new do |spec|
30
30
 
31
31
 
32
32
  # Specify which files should be added to the gem when it is released.
33
- spec.files = `git ls-files`.split("\n")
33
+ spec.files = `git ls-files`.split("\n").reject { |f| f == 'bin/setup' || f == 'bin/console'}
34
34
  spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
35
35
 
36
36
  spec.bindir = 'bin'
37
- spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
37
+ spec.executables = `git ls-files -- bin/*`.split("\n").reject { |f| f == 'bin/setup' || f == 'bin/console'}.map{ |f| File.basename(f) }
38
38
  spec.require_paths = ['lib']
39
39
 
40
40
 
41
41
  # Additional dependencies
42
- spec.add_runtime_dependency 'tty'
42
+ spec.add_runtime_dependency 'tty', "~>0.10"
43
43
  spec.add_runtime_dependency 'streamio-ffmpeg'
44
44
  spec.add_runtime_dependency 'bytesize'
45
45
 
46
46
  # Development dependencies
47
- spec.add_development_dependency "bundler", "~> 1.17"
48
- spec.add_development_dependency "rake", "~> 10.0"
47
+ spec.add_development_dependency "bundler", "~> 1.17.3"
48
+ spec.add_development_dependency "rake"
49
49
  spec.add_development_dependency 'git'
50
50
  end
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mm_tool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Derry
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-14 00:00:00.000000000 Z
11
+ date: 2020-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: tty
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: '0.10'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: '0.10'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: streamio-ffmpeg
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,28 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.17'
61
+ version: 1.17.3
62
62
  type: :development
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: '1.17'
68
+ version: 1.17.3
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '10.0'
75
+ version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '10.0'
82
+ version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: git
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -98,9 +98,7 @@ description: A tool for curating your movie files.
98
98
  email:
99
99
  - balthisar@gmail.com
100
100
  executables:
101
- - console
102
101
  - mm_tool
103
- - setup
104
102
  extensions: []
105
103
  extra_rdoc_files: []
106
104
  files:
@@ -112,9 +110,7 @@ files:
112
110
  - README.md
113
111
  - Rakefile
114
112
  - Truth Tables.xlsx
115
- - bin/console
116
113
  - bin/mm_tool
117
- - bin/setup
118
114
  - lib/mm_tool.rb
119
115
  - lib/mm_tool/application_main.rb
120
116
  - lib/mm_tool/mm_movie.rb
@@ -133,7 +129,7 @@ metadata:
133
129
  allowed_push_host: https://rubygems.org
134
130
  homepage_uri: https://github.com/balthisar/mm_tool
135
131
  source_code_uri: https://github.com/balthisar/mm_tool
136
- post_install_message:
132
+ post_install_message:
137
133
  rdoc_options: []
138
134
  require_paths:
139
135
  - lib
@@ -148,8 +144,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
144
  - !ruby/object:Gem::Version
149
145
  version: '0'
150
146
  requirements: []
151
- rubygems_version: 3.0.6
152
- signing_key:
147
+ rubygems_version: 3.1.2
148
+ signing_key:
153
149
  specification_version: 4
154
150
  summary: Curate your movie files.
155
151
  test_files: []
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "mm_tool"
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 DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here