youpy-scissor 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/Rakefile +1 -1
  2. data/lib/scissor.rb +4 -7
  3. metadata +2 -2
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.3"
20
+ VERS = "0.0.4"
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
@@ -43,7 +43,7 @@ class Scissor
43
43
  next
44
44
  end
45
45
 
46
- if (start + fragment.duration) >= remain
46
+ if (start + remain) <= fragment.duration
47
47
  new_mp3.add_fragment(Fragment.new(
48
48
  fragment.filename,
49
49
  fragment.start + start,
@@ -51,11 +51,11 @@ class Scissor
51
51
 
52
52
  break
53
53
  else
54
- remain = remain - fragment.duration
54
+ remain = remain - (fragment.duration - start)
55
55
  new_mp3.add_fragment(Fragment.new(
56
56
  fragment.filename,
57
57
  fragment.start + start,
58
- fragment.duration))
58
+ fragment.duration - start))
59
59
 
60
60
  start = 0
61
61
  end
@@ -130,7 +130,6 @@ class Scissor
130
130
  outfile = tmpdir + '/' + index.to_s + '.mp3'
131
131
  outfiles << outfile
132
132
  cmd = "ffmpeg -i \"#{fragment.filename}\" -ss #{fragment.start} -t #{fragment.duration} #{outfile}"
133
- puts cmd
134
133
  system cmd
135
134
  end
136
135
 
@@ -140,19 +139,17 @@ class Scissor
140
139
  # concat mp3 files
141
140
  outfile = tmpdir + '/concat.mp3'
142
141
  cmd = "mp3wrap \"#{outfile}\" #{outfiles.join(' ')}"
143
- puts cmd
144
142
  system cmd
145
143
 
146
144
  # fix duration and rename
147
145
  infile = tmpdir + '/concat_MP3WRAP.mp3'
148
146
  cmd = "ffmpeg -i \"#{infile}\" -acodec copy \"#{filename}\""
149
- puts cmd
150
147
  system cmd
151
148
  end
152
149
 
153
150
  rm_rf tmpdir
154
151
 
155
- open(filename)
152
+ self.class.new(filename)
156
153
  end
157
154
 
158
155
  class Fragment
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.3
4
+ version: 0.0.4
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-30 00:00:00 -07:00
12
+ date: 2009-03-31 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency