youpy-scissor 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/{README → README.rdoc} +6 -3
- data/Rakefile +5 -5
- data/lib/scissor.rb +14 -3
- metadata +5 -5
data/{README → README.rdoc}
RENAMED
@@ -18,16 +18,19 @@ utility to chop mp3 files
|
|
18
18
|
== Synopsis
|
19
19
|
|
20
20
|
foo = Scissor.new('foo.mp3')
|
21
|
-
|
21
|
+
bar = Scissor.new('bar.mp3')
|
22
22
|
|
23
23
|
# concat
|
24
24
|
(foo + bar).to_file('foobar.mp3')
|
25
25
|
|
26
26
|
# slice + concat
|
27
|
-
(foo.slice(10, 1) + bar.slice(2,3)).to_file('slicefoobar.mp3')
|
27
|
+
(foo.slice(10, 1) + bar.slice(2, 3)).to_file('slicefoobar.mp3')
|
28
28
|
|
29
29
|
# slice + concat + loop
|
30
|
-
((foo.slice(10, 1) + bar.slice(2,3)) *
|
30
|
+
((foo.slice(10, 1) + bar.slice(2, 3)) * 4).to_file('slicefoobarloop.mp3')
|
31
|
+
|
32
|
+
# split
|
33
|
+
(Scissor.new('sequence.mp3') / 16).to_file('split.mp3')
|
31
34
|
|
32
35
|
== Copyright
|
33
36
|
|
data/Rakefile
CHANGED
@@ -17,7 +17,7 @@ DESCRIPTION = "utility to chop mp3 files"
|
|
17
17
|
RUBYFORGE_PROJECT = "scissor"
|
18
18
|
HOMEPATH = "http://#{RUBYFORGE_PROJECT}.rubyforge.org"
|
19
19
|
BIN_FILES = %w( )
|
20
|
-
VERS = "0.0.
|
20
|
+
VERS = "0.0.2"
|
21
21
|
|
22
22
|
REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
|
23
23
|
CLEAN.include ['**/.*.sw?', '*.gem', '.config']
|
@@ -26,7 +26,7 @@ RDOC_OPTS = [
|
|
26
26
|
"--charset", "utf-8",
|
27
27
|
"--opname", "index.html",
|
28
28
|
"--line-numbers",
|
29
|
-
"--main", "README",
|
29
|
+
"--main", "README.rdoc",
|
30
30
|
"--inline-source",
|
31
31
|
]
|
32
32
|
|
@@ -44,7 +44,7 @@ spec = Gem::Specification.new do |s|
|
|
44
44
|
s.version = VERS
|
45
45
|
s.platform = Gem::Platform::RUBY
|
46
46
|
s.has_rdoc = true
|
47
|
-
s.extra_rdoc_files = ["README", "ChangeLog"]
|
47
|
+
s.extra_rdoc_files = ["README.rdoc", "ChangeLog"]
|
48
48
|
s.rdoc_options += RDOC_OPTS + ['--exclude', '^(examples|extras)/']
|
49
49
|
s.summary = DESCRIPTION
|
50
50
|
s.description = DESCRIPTION
|
@@ -60,7 +60,7 @@ spec = Gem::Specification.new do |s|
|
|
60
60
|
s.add_dependency('ruby-mp3info')
|
61
61
|
#s.required_ruby_version = '>= 1.8.2'
|
62
62
|
|
63
|
-
s.files = %w(README ChangeLog Rakefile) +
|
63
|
+
s.files = %w(README.rdoc ChangeLog Rakefile) +
|
64
64
|
Dir.glob("{bin,doc,test,lib,templates,generator,extras,website,script}/**/*") +
|
65
65
|
Dir.glob("ext/**/*.{h,c,rb}") +
|
66
66
|
Dir.glob("examples/**/*.rb") +
|
@@ -93,7 +93,7 @@ Rake::RDocTask.new do |rdoc|
|
|
93
93
|
if ENV['DOC_FILES']
|
94
94
|
rdoc.rdoc_files.include(ENV['DOC_FILES'].split(/,\s*/))
|
95
95
|
else
|
96
|
-
rdoc.rdoc_files.include('README', 'ChangeLog')
|
96
|
+
rdoc.rdoc_files.include('README.rdoc', 'ChangeLog')
|
97
97
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
98
98
|
rdoc.rdoc_files.include('ext/**/*.c')
|
99
99
|
end
|
data/lib/scissor.rb
CHANGED
@@ -91,6 +91,17 @@ class Scissor
|
|
91
91
|
self
|
92
92
|
end
|
93
93
|
|
94
|
+
def /(count)
|
95
|
+
splitted_duration = duration / count.to_f
|
96
|
+
results = []
|
97
|
+
|
98
|
+
count.times do |i|
|
99
|
+
results << slice(i, splitted_duration)
|
100
|
+
end
|
101
|
+
|
102
|
+
results
|
103
|
+
end
|
104
|
+
|
94
105
|
def to_file(filename)
|
95
106
|
outfiles = []
|
96
107
|
tmpdir = '/tmp/scissor-' + $$.to_s
|
@@ -100,16 +111,16 @@ class Scissor
|
|
100
111
|
@fragments.each_with_index do |fragment, index|
|
101
112
|
outfile = tmpdir + '/' + index.to_s + '.mp3'
|
102
113
|
outfiles << outfile
|
103
|
-
cmd = "ffmpeg -i #{fragment.filename} -ss #{fragment.start} -t #{fragment.duration} #{outfile}"
|
114
|
+
cmd = "ffmpeg -i \"#{fragment.filename}\" -ss #{fragment.start} -t #{fragment.duration} #{outfile}"
|
104
115
|
system cmd
|
105
116
|
end
|
106
117
|
|
107
118
|
# concat mp3 files
|
108
|
-
cmd = "mp3wrap #{filename} #{outfiles.join(' ')}"
|
119
|
+
cmd = "mp3wrap \"#{filename}\" #{outfiles.join(' ')}"
|
109
120
|
system cmd
|
110
121
|
|
111
122
|
# fix duration and rename
|
112
|
-
cmd = "ffmpeg -i #{filename.sub(/\.mp3$/, '_MP3WRAP.mp3')} -acodec copy #{filename}"
|
123
|
+
cmd = "ffmpeg -i \"#{filename.sub(/\.mp3$/, '_MP3WRAP.mp3')}\" -acodec copy \"#{filename}\""
|
113
124
|
system cmd
|
114
125
|
|
115
126
|
rm_rf tmpdir
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: youpy-scissor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- youpy
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-03-
|
12
|
+
date: 2009-03-30 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -29,10 +29,10 @@ executables: []
|
|
29
29
|
extensions: []
|
30
30
|
|
31
31
|
extra_rdoc_files:
|
32
|
-
- README
|
32
|
+
- README.rdoc
|
33
33
|
- ChangeLog
|
34
34
|
files:
|
35
|
-
- README
|
35
|
+
- README.rdoc
|
36
36
|
- ChangeLog
|
37
37
|
- Rakefile
|
38
38
|
- lib/scissor.rb
|
@@ -48,7 +48,7 @@ rdoc_options:
|
|
48
48
|
- index.html
|
49
49
|
- --line-numbers
|
50
50
|
- --main
|
51
|
-
- README
|
51
|
+
- README.rdoc
|
52
52
|
- --inline-source
|
53
53
|
- --exclude
|
54
54
|
- ^(examples|extras)/
|