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 +4 -4
- data/README.md +14 -1
- data/lib/mm_tool/application_main.rb +8 -10
- data/lib/mm_tool/mm_movie.rb +14 -2
- data/lib/mm_tool/mm_movie_ignore_list.rb +2 -2
- data/lib/mm_tool/mm_movie_stream.rb +7 -8
- data/lib/mm_tool/mm_tool_cli.rb +1 -0
- data/lib/mm_tool/version.rb +1 -1
- data/mm_tool.gemspec +5 -5
- metadata +16 -20
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 437af0237de0f684c70ebc8d7f6db4432e0b6196e4c3e787f3e2bf4507cfcd10
|
4
|
+
data.tar.gz: 3a28861a1398fa974570d1909a8d45105e0fc2d8cf7e1251e19feb8a7fbb3494
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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.
|
57
|
-
#
|
58
|
-
|
59
|
-
|
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.
|
100
|
+
c = movie.meets_minimum_quality?
|
103
101
|
s = @defaults[:scan_type]&.to_sym
|
104
102
|
|
105
|
-
if (s == :normal && a && !b &&
|
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
|
data/lib/mm_tool/mm_movie.rb
CHANGED
@@ -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
|
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
|
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
|
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
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
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
|
#------------------------------------------------------------
|
data/lib/mm_tool/mm_tool_cli.rb
CHANGED
data/lib/mm_tool/version.rb
CHANGED
data/mm_tool.gemspec
CHANGED
@@ -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"
|
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.
|
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-
|
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:
|
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:
|
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: '
|
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: '
|
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.
|
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: []
|
data/bin/console
DELETED
@@ -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__)
|