youpy-scissor 0.0.17 → 0.0.18
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/Rakefile +1 -1
- data/lib/scissor.rb +6 -0
- data/lib/scissor/chunk.rb +6 -7
- data/lib/scissor/sound_file.rb +2 -2
- metadata +2 -2
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -17,7 +17,7 @@ DESCRIPTION = "utility to chop sound 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.18"
|
21
21
|
|
22
22
|
REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
|
23
23
|
CLEAN.include ['**/.*.sw?', '*.gem', '.config']
|
data/lib/scissor.rb
CHANGED
data/lib/scissor/chunk.rb
CHANGED
@@ -2,7 +2,6 @@ require 'digest/md5'
|
|
2
2
|
require 'pathname'
|
3
3
|
require 'open4'
|
4
4
|
require 'logger'
|
5
|
-
require 'bigdecimal'
|
6
5
|
|
7
6
|
module Scissor
|
8
7
|
class Chunk
|
@@ -43,15 +42,14 @@ module Scissor
|
|
43
42
|
end
|
44
43
|
|
45
44
|
def duration
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
end.to_s).round(3).to_f
|
45
|
+
@fragments.inject(0) do |memo, fragment|
|
46
|
+
memo += fragment.duration
|
47
|
+
end
|
50
48
|
end
|
51
49
|
|
52
50
|
def slice(start, length)
|
53
51
|
if start + length > duration
|
54
|
-
|
52
|
+
length = duration - start
|
55
53
|
end
|
56
54
|
|
57
55
|
new_instance = self.class.new
|
@@ -123,7 +121,7 @@ module Scissor
|
|
123
121
|
remain = filled_duration
|
124
122
|
new_instance = self.class.new
|
125
123
|
|
126
|
-
while filled_duration > new_instance.duration
|
124
|
+
while !remain.zero? && filled_duration > new_instance.duration
|
127
125
|
if remain < duration
|
128
126
|
added = slice(0, remain)
|
129
127
|
else
|
@@ -134,6 +132,7 @@ module Scissor
|
|
134
132
|
remain -= added.duration
|
135
133
|
end
|
136
134
|
|
135
|
+
|
137
136
|
new_instance
|
138
137
|
end
|
139
138
|
|
data/lib/scissor/sound_file.rb
CHANGED
@@ -4,7 +4,7 @@ require 'riff/reader'
|
|
4
4
|
|
5
5
|
module Scissor
|
6
6
|
class SoundFile
|
7
|
-
|
7
|
+
SUPPORTED_FORMATS = %w/mp3 wav/
|
8
8
|
|
9
9
|
class Error < StandardError; end
|
10
10
|
class UnknownFormat < Error; end
|
@@ -13,7 +13,7 @@ module Scissor
|
|
13
13
|
@filename = Pathname.new(filename)
|
14
14
|
@ext = @filename.extname.sub(/^\./, '').downcase
|
15
15
|
|
16
|
-
unless
|
16
|
+
unless SUPPORTED_FORMATS.include?(@ext)
|
17
17
|
raise UnknownFormat
|
18
18
|
end
|
19
19
|
end
|
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.18
|
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-
|
12
|
+
date: 2009-07-03 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|