mm_tool 0.1.12 → 0.1.13
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 +4 -4
- data/LICENSE.md +1 -1
- data/README.md +51 -0
- data/lib/mm_tool/application_main.rb +4 -1
- data/lib/mm_tool/mm_movie.rb +41 -9
- data/lib/mm_tool/mm_movie_stream.rb +20 -0
- data/lib/mm_tool/mm_tool_cli.rb +2 -2
- data/lib/mm_tool/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d69efe53e6d0c00bc51cf406efdede9770fcb34c7b0aefb576cb9065d26a94d
|
4
|
+
data.tar.gz: dd6b5aa461fe6c5327ebef47a9448b2eefadb1ae76c5bb39f21af4e633df2d2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1eaa1923e61797b431fa7c508d7c68d09301134fec695c59e19bb3093e44b8a0f972c0856d17b7f1c5a4a311d1c41512394d4951c668b2155a5f3b04c9ce191
|
7
|
+
data.tar.gz: f41098c3dbbd7525829ab2bce37991d3fb461c0d2b22c0980b73e5741481daa06194d04c229b0c744705cd7488a722bf8e47bfc6289d74b3ee23681b460173a9
|
data/LICENSE.md
CHANGED
data/README.md
CHANGED
@@ -42,3 +42,54 @@ remuxing, and re-encoding media libraries.
|
|
42
42
|
- 0.1.4
|
43
43
|
|
44
44
|
- Hot fix.
|
45
|
+
|
46
|
+
- 0.1.5
|
47
|
+
|
48
|
+
- Updated for Ruby 2.7 compatibility.
|
49
|
+
|
50
|
+
- 0.1.6
|
51
|
+
|
52
|
+
- Make ffmpeg output less verbose.
|
53
|
+
- Don't do "slow" video conversions.
|
54
|
+
|
55
|
+
- 0.1.7
|
56
|
+
|
57
|
+
- Added `shell_commands` user default, so that we can suppress the printing of
|
58
|
+
the shell commands, such as when summarizing the work already performed.
|
59
|
+
|
60
|
+
- 0.1.8
|
61
|
+
|
62
|
+
- Fix single quoting.
|
63
|
+
|
64
|
+
- 0.1.9
|
65
|
+
|
66
|
+
- Add different encoder support.
|
67
|
+
|
68
|
+
- 0.1.10
|
69
|
+
|
70
|
+
- Fix underscore issue.
|
71
|
+
|
72
|
+
|
73
|
+
- 0.1.11
|
74
|
+
|
75
|
+
- Add force (re-encode) option.
|
76
|
+
|
77
|
+
- 0.1.12
|
78
|
+
|
79
|
+
- Fix preference, shorten string.
|
80
|
+
|
81
|
+
- 0.1.13
|
82
|
+
|
83
|
+
- Put the name of the temporary file at the end of output, so we don't have to scroll all the way to the top
|
84
|
+
to find out what it is.
|
85
|
+
|
86
|
+
- Plant a flag when we've touched a file.
|
87
|
+
|
88
|
+
- For whole file:
|
89
|
+
- MM_TOOL_ENCODED=true|false Set to true if any part of the file was transcoded.
|
90
|
+
- MM_TOOL_WRITTEN=true|false Set to true if the file was written by mm_tool, for example, possibly
|
91
|
+
nothing was transcoded, but streams were dropped or added. If EVERY stream
|
92
|
+
is copy ONLY, then we don't apply this.
|
93
|
+
|
94
|
+
- For streams:
|
95
|
+
- MM_TOOL_ENCODED_STREAM=true|false Set to true if the stream is transcoded.
|
@@ -180,7 +180,10 @@ module MmTool
|
|
180
180
|
exit 1
|
181
181
|
end
|
182
182
|
|
183
|
-
|
183
|
+
unless @defaults[:shell_commands]
|
184
|
+
output("Transcode File Location: #{tempfile&.path}") if @tempfile
|
185
|
+
output("#{File.basename($0)} processed #{@file_count[:processed]} files and displayed data for #{@file_count[:displayed]} of them.")
|
186
|
+
end
|
184
187
|
|
185
188
|
ensure
|
186
189
|
if @tempfile
|
data/lib/mm_tool/mm_movie.rb
CHANGED
@@ -69,6 +69,20 @@ module MmTool
|
|
69
69
|
@format_metadata&.dig(:tags, :title)
|
70
70
|
end
|
71
71
|
|
72
|
+
#------------------------------------------------------------
|
73
|
+
# Get the file-level 'MM_TOOL_ENCODED' metadata.
|
74
|
+
#------------------------------------------------------------
|
75
|
+
def format_mm_tool_encoded
|
76
|
+
@format_metadata&.dig(:tags, :MM_TOOL_ENCODED)&.downcase == 'true'
|
77
|
+
end
|
78
|
+
|
79
|
+
#------------------------------------------------------------
|
80
|
+
# Get the file-level 'MM_TOOL_WRITTEN' metadata.
|
81
|
+
#------------------------------------------------------------
|
82
|
+
def format_mm_tool_written
|
83
|
+
@format_metadata&.dig(:tags, :MM_TOOL_WRITTEN)&.downcase == 'true'
|
84
|
+
end
|
85
|
+
|
72
86
|
#------------------------------------------------------------
|
73
87
|
# Indicates whether any of the streams are of a lower
|
74
88
|
# quality than desired by the user.
|
@@ -93,16 +107,28 @@ module MmTool
|
|
93
107
|
@streams.count {|stream| stream.interesting?} > 0 || format_title
|
94
108
|
end
|
95
109
|
|
110
|
+
#------------------------------------------------------------
|
111
|
+
# Indicates whether any of the streams are to be modified
|
112
|
+
# in any form.
|
113
|
+
#------------------------------------------------------------
|
114
|
+
def modify_streams?
|
115
|
+
number_of_copy_only = @streams.count {|stream| stream.copy_only?}
|
116
|
+
number_of_streams = @streams.count
|
117
|
+
number_of_streams > number_of_copy_only
|
118
|
+
# result = @streams.count {|stream| stream.copy_only?} < @streams.count
|
119
|
+
# result
|
120
|
+
end
|
121
|
+
|
96
122
|
#------------------------------------------------------------
|
97
123
|
# Get the rendered text of the format_table.
|
98
124
|
#------------------------------------------------------------
|
99
125
|
def format_table
|
100
126
|
unless @format_table
|
101
127
|
@format_table = format_table_datasource.render(:basic) do |renderer|
|
102
|
-
renderer.column_widths = [10,10,10,
|
128
|
+
renderer.column_widths = [10,10,10,12,10,123]
|
103
129
|
renderer.multiline = true
|
104
130
|
renderer.padding = [0,1]
|
105
|
-
renderer.width =
|
131
|
+
renderer.width = 192
|
106
132
|
end
|
107
133
|
end
|
108
134
|
@format_table
|
@@ -115,11 +141,11 @@ module MmTool
|
|
115
141
|
def stream_table
|
116
142
|
unless @stream_table
|
117
143
|
@stream_table = stream_table_datasource.render(:unicode) do |renderer|
|
118
|
-
renderer.alignments = [:center, :left, :left, :right, :right, :left, :left, :left, :left]
|
119
|
-
renderer.column_widths = [5,10,10,5,10,5,23,50,35]
|
144
|
+
renderer.alignments = [:center, :left, :left, :right, :right, :left, :left, :left, :left, :left]
|
145
|
+
renderer.column_widths = [5,10,10,5,10,5,23,50,8,35]
|
120
146
|
renderer.multiline = true
|
121
147
|
renderer.padding = [0,1]
|
122
|
-
renderer.width =
|
148
|
+
renderer.width = 192
|
123
149
|
end # do
|
124
150
|
end
|
125
151
|
@stream_table
|
@@ -153,6 +179,11 @@ module MmTool
|
|
153
179
|
stream.instruction_metadata.each { |instruction| command << " #{instruction}" }
|
154
180
|
end
|
155
181
|
|
182
|
+
if @defaults[:containers_preferred][0].downcase == 'mkv'
|
183
|
+
command << " -metadata MM_TOOL_ENCODED=\"true\" \\" if @streams.count {|stream| stream.transcode?} > 0
|
184
|
+
command << " -metadata MM_TOOL_WRITTEN=\"true\" \\" if modify_streams?
|
185
|
+
end
|
186
|
+
|
156
187
|
command << " -metadata title=\"#{format_title}\" \\" if format_title
|
157
188
|
command << " \"#{output_path}\""
|
158
189
|
command.join("\n")
|
@@ -207,8 +238,8 @@ module MmTool
|
|
207
238
|
#------------------------------------------------------------
|
208
239
|
def format_table_datasource
|
209
240
|
unless @format_table
|
210
|
-
@format_table = TTY::Table.new(header:
|
211
|
-
@format_table << [format_duration, format_size, format_bitrate, format_title]
|
241
|
+
@format_table = TTY::Table.new(header: ['Duration:', 'Size:', 'Bitrate:', 'mm_encoded:', 'mm_wrote:', 'Title:'])
|
242
|
+
@format_table << [format_duration, format_size, format_bitrate, format_mm_tool_encoded, format_mm_tool_written, format_title]
|
212
243
|
end
|
213
244
|
@format_table
|
214
245
|
end
|
@@ -220,8 +251,8 @@ module MmTool
|
|
220
251
|
def stream_table_datasource
|
221
252
|
unless @table
|
222
253
|
# Ensure that when we add the headers, they specifically are left-aligned.
|
223
|
-
headers =
|
224
|
-
|
254
|
+
headers = ['index', 'codec', 'type', 'w/#', 'h/layout', 'lang', 'disposition', 'title', 'touched?', 'action(s)']
|
255
|
+
.map { |header| {:value => header, :alignment => :left} }
|
225
256
|
|
226
257
|
@table = TTY::Table.new(header: headers)
|
227
258
|
|
@@ -235,6 +266,7 @@ module MmTool
|
|
235
266
|
row << stream.language
|
236
267
|
row << stream.dispositions
|
237
268
|
row << stream.title
|
269
|
+
row << stream.mm_tool_encoded_stream
|
238
270
|
row << stream.action_label
|
239
271
|
@table << row
|
240
272
|
end
|
@@ -119,6 +119,14 @@ module MmTool
|
|
119
119
|
lang
|
120
120
|
end
|
121
121
|
|
122
|
+
#------------------------------------------------------------
|
123
|
+
# Property - returns the metadata indicating whether or not
|
124
|
+
# mm_tool has previously encoded this stream.
|
125
|
+
#------------------------------------------------------------
|
126
|
+
def mm_tool_encoded_stream
|
127
|
+
@data&.dig(:tags, :MM_TOOL_ENCODED_STREAM)&.downcase == 'true'
|
128
|
+
end
|
129
|
+
|
122
130
|
#------------------------------------------------------------
|
123
131
|
# Property - returns the title of the stream, or nil.
|
124
132
|
#------------------------------------------------------------
|
@@ -213,6 +221,13 @@ module MmTool
|
|
213
221
|
actions.include?(:copy)
|
214
222
|
end
|
215
223
|
|
224
|
+
#------------------------------------------------------------
|
225
|
+
# Property - Is the stream copy only? No other modifications?
|
226
|
+
#------------------------------------------------------------
|
227
|
+
def copy_only?
|
228
|
+
(actions - [:copy, :interesting]).empty?
|
229
|
+
end
|
230
|
+
|
216
231
|
#------------------------------------------------------------
|
217
232
|
# Property - stream action includes :transcode?
|
218
233
|
#------------------------------------------------------------
|
@@ -324,6 +339,11 @@ module MmTool
|
|
324
339
|
result = []
|
325
340
|
result << "-metadata:s:#{output_specifier} language=#{lang} \\" if set_language?
|
326
341
|
result << "-metadata:s:#{output_specifier} title=\"#{title}\" \\" if title && ! @defaults[:ignore_titles]
|
342
|
+
|
343
|
+
if @defaults[:containers_preferred][0].downcase == 'mkv'
|
344
|
+
result << "-metadata:s:#{output_specifier} MM_TOOL_ENCODED_STREAM=\"true\" \\" if @actions.include?(:transcode)
|
345
|
+
end
|
346
|
+
|
327
347
|
result
|
328
348
|
end
|
329
349
|
|
data/lib/mm_tool/mm_tool_cli.rb
CHANGED
@@ -204,7 +204,7 @@ module MmTool
|
|
204
204
|
|
205
205
|
when '--no-transcode'
|
206
206
|
@defaults[:transcode] = false
|
207
|
-
@
|
207
|
+
@application.tempfile = nil
|
208
208
|
|
209
209
|
when '--ignore-files'
|
210
210
|
@defaults[:ignore_files] = true
|
@@ -306,7 +306,7 @@ module MmTool
|
|
306
306
|
OutputHelper.print_error_and_exit("Error: option #{C.bold(args[0])} was specified, but I don't know what that means.")
|
307
307
|
end
|
308
308
|
|
309
|
-
# Otherwise, check for existence of the path, and
|
309
|
+
# Otherwise, check for existence of the path, and proceed or warn.
|
310
310
|
path = File.expand_path(args[0])
|
311
311
|
if File.exist?(path)
|
312
312
|
@application.run(path)
|
data/lib/mm_tool/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jim Derry
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tty-table
|
@@ -185,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
185
185
|
- !ruby/object:Gem::Version
|
186
186
|
version: '0'
|
187
187
|
requirements: []
|
188
|
-
rubygems_version: 3.
|
188
|
+
rubygems_version: 3.5.3
|
189
189
|
signing_key:
|
190
190
|
specification_version: 4
|
191
191
|
summary: Curate your movie files.
|