kaki-utils 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kaki/utils.rb +18 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 81f03f7dddfeb7e6a8a1bcb0a57ae9aff06223a1e4eb296500a75dfa8918c467
|
4
|
+
data.tar.gz: cb7bccdddb87cf1864c1b0ecad7d47e869759f5f945f0fa1336d7fa11866be74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 97ec306405102bbd7d6362ea78a2a76a1870c583041754d0bda295d0f0a5819b1a625d92f8e679f71274c907d32bb8394718071e1c4e4983a21a58a9b048af6a
|
7
|
+
data.tar.gz: 2ed2cedd1d6711f44050f1bf6dc74c9f8f5ccef5f46ee0abcc14c2316139c29cc78494b13282f3d32e776ffcfe323c4790024a0cc41a68683db2cf2750be0863
|
data/lib/kaki/utils.rb
CHANGED
@@ -162,4 +162,22 @@ module Utils
|
|
162
162
|
%x(ffmpeg -i #{url} -movflags faststart -c copy -bsf:a aac_adtstoasc #{fname})
|
163
163
|
end
|
164
164
|
module_function :m3u8
|
165
|
+
|
166
|
+
|
167
|
+
#連番ファイル名を sort 順になるように変更する
|
168
|
+
def modify_serial_numbers(dir = Dir.pwd)
|
169
|
+
Dir.chdir(dir)
|
170
|
+
files = Dir.glob("*").select {|fn| File.file?(fn)}
|
171
|
+
data = files.map do |fn|
|
172
|
+
m = /^(.*?\D*?)(\d+)(\..+)$/.match(fn)
|
173
|
+
next unless m
|
174
|
+
[fn, m[1], m[2].to_i, m[3]]
|
175
|
+
end.compact
|
176
|
+
num_length = data.map {|d| d[2].to_s.length}.max
|
177
|
+
data1 = data.map {|d| [d[0], d[1] + ("%0#{num_length}d" % d[2]) + d[3]]}
|
178
|
+
|
179
|
+
Dir.mkdir("new_folder")
|
180
|
+
data1.each {|be, af| FileUtils.cp(be, "new_folder/#{af}")}
|
181
|
+
end
|
182
|
+
module_function :modify_serial_numbers
|
165
183
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kaki-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- obelisk
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fastimage
|