scissor 0.2.1 → 0.2.2

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.
Files changed (4) hide show
  1. data/README.rdoc +8 -1
  2. data/Rakefile +1 -1
  3. data/lib/scissor/chunk.rb +5 -18
  4. metadata +2 -2
data/README.rdoc CHANGED
@@ -36,9 +36,16 @@ supported file format:
36
36
 
37
37
  === instantiate
38
38
 
39
+ ==== from file
40
+
39
41
  foo = Scissor('foo.mp3')
40
42
  bar = Scissor('bar.wav')
41
-
43
+
44
+ ==== from URL
45
+
46
+ foo = Scissor('http://example.com/foo.mp3')
47
+ bar = Scissor('http://example.org/bar.wav')
48
+
42
49
  === concat
43
50
 
44
51
  foo + bar > 'foobar.mp3'
data/Rakefile CHANGED
@@ -18,7 +18,7 @@ DESCRIPTION = "utility to chop sound files"
18
18
  RUBYFORGE_PROJECT = "scissor"
19
19
  HOMEPATH = "http://github.com/youpy/scissor"
20
20
  BIN_FILES = %w( )
21
- VERS = "0.2.1"
21
+ VERS = "0.2.2"
22
22
 
23
23
  REV = File.read(".svn/entries")[/committed-rev="(d+)"/, 1] rescue nil
24
24
  CLEAN.include ['**/.*.sw?', '*.gem', '.config']
data/lib/scissor/chunk.rb CHANGED
@@ -109,9 +109,8 @@ module Scissor
109
109
  def loop(count)
110
110
  orig_fragments = @fragments.clone
111
111
  new_instance = Scissor()
112
- new_instance.add_fragments(orig_fragments)
113
112
 
114
- (count - 1).times do
113
+ count.times do
115
114
  new_instance.add_fragments(orig_fragments)
116
115
  end
117
116
 
@@ -134,26 +133,14 @@ module Scissor
134
133
  alias / split
135
134
 
136
135
  def fill(filled_duration)
137
- if @fragments.empty?
136
+ if duration.zero?
138
137
  raise EmptyFragment
139
138
  end
140
139
 
141
- remain = filled_duration
142
- new_instance = self.class.new
143
-
144
- while !remain.zero? && filled_duration > new_instance.duration
145
- if remain < duration
146
- added = slice(0, remain)
147
- else
148
- added = self
149
- end
140
+ loop_count = (filled_duration / duration).to_i
141
+ remain = filled_duration % duration
150
142
 
151
- new_instance += added
152
- remain -= added.duration
153
- end
154
-
155
-
156
- new_instance
143
+ loop(loop_count) + slice(0, remain)
157
144
  end
158
145
 
159
146
  def replace(start, length, replaced)
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 2
8
- - 1
9
- version: 0.2.1
8
+ - 2
9
+ version: 0.2.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - youpy