audio-trimmer 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/audio_trimmer.rb +7 -4
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd71fca88dd4fdf4bbd20c0b72f425c4d88bdadd
4
- data.tar.gz: 1817b2c5a3549199f79ceeef8fd53710ba8117b3
3
+ metadata.gz: c0721ddf5fe7fa3de9caad8c076c0c736629eace
4
+ data.tar.gz: c6846c36da7ce0ae635c06bff9d780356b6a096c
5
5
  SHA512:
6
- metadata.gz: 37382804c1cb572b85f917f67eed80f3e193a1391bd5c9b0e50aefcdbf95cf77447f841a7b5ebec0fc3a5bbef6006be2e7266d36d1805f37ef856c08dd7ade93
7
- data.tar.gz: 4da5befb6d9b3fce9cffaac51b566228540102e9e6b86405081c086202f052219b5ccfebb2c22404ad8738b74bc460d8826e669c40c2e87b594bf761a2ccf568
6
+ metadata.gz: 86187c87e472e88057db1acf71bcb0e441ff3c8d63e4896a3152ed6c0c4a8ef32ef954d4eb9a31c171738d2bfdb0638fd0cc3be8561dd33c23cf80bd3e4f0c0f
7
+ data.tar.gz: ee612e9298816da4e971587f8373d59792d467d4cb78373c4dd819794754011513879c1604e5a748c62d3a576e9812bfe51c8d41f73c8e7843cd75a69461716c
@@ -6,16 +6,19 @@ class AudioTrimmer
6
6
  attr_accessor :input
7
7
 
8
8
  def initialize(params = {})
9
- @input = params.fetch(:input, "")
9
+ input = params.fetch(:input, "")
10
10
  input_length = 0
11
- if @input.empty?
11
+ if input.empty?
12
12
  raise "please specify input filepath"
13
+ else
14
+ @input = File.expand_path(input)
13
15
  end
14
16
  end
15
17
 
16
18
  def trim(start: 0, finish: get_length(@input), output: @input)
17
- unless File.exist?(File.expand_path(@input)) or File.exist?(File.expand_path(output)) then raise "bad filepath" end
18
- `sox #{@input} #{output} trim #{start} #{finish}`
19
+ unless File.exist?(@input) or File.exist?(output) then raise "bad filepath" end
20
+ `sox #{@input} #{output} trim #{start} =#{finish}`
21
+ return "trim success"
19
22
  end
20
23
 
21
24
  def get_length file_path
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: audio-trimmer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Brigden