soxi-wrapper 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b20b67f843afb37dc17ccbdfbc24e2dfaba81f1
4
- data.tar.gz: e8b5c64012091b28c546dcc6da35a7b4aaff7fce
3
+ metadata.gz: 99a5138606244f09e6a7ef674243dcc4a587b2c2
4
+ data.tar.gz: d30988df5ed0e999921b14c7a52b9baa9b152329
5
5
  SHA512:
6
- metadata.gz: 276c59679bfec7b7f0391665dd6b572563d72518a550faa23b8fa6e701473acde96eac39e335121f703bed2a3d26a82b65aa9ae0072aa6e5389048f9b329934d
7
- data.tar.gz: 180ebd8307f4587ea9fc717368bb747916e745db962ffbf8a1bc36851c6ab90283ce9d5093c3923b63c86ba1b436126a9ab1abe554e9ba912d63e38dfc287f32
6
+ metadata.gz: 812d9182809ac412a74bc63a659e4b6c931635e603c5c4a7c0f2d802077b96a2c5ea271e8746029a31b7ed249a5faa3e2799a165cfb4afa251638369fab72118
7
+ data.tar.gz: 6fe70c5f37bd92bc70808fe6b6a39a85072b61343eaf7362d6c65ee6850b69b700940cf34c4889b16bf677696a4227539ee670525d01d2a39458c1fd47718257
data/README.md CHANGED
@@ -1,10 +1,12 @@
1
1
  # Soxi::Wrapper
2
2
 
3
- TODO: Write a gem description
3
+ This very simple wrapper has been abandonned. We haven't used it in years.
4
+
5
+ We have upgraded this to ensure we don't publish unsafe code (based on work by @tomekr on https://github.com/ArnsboMedia/soxi-wrapper/pull/1)
4
6
 
5
7
  ## Installation
6
8
 
7
- Add this line to your application's Gemfile:
9
+ If you must:
8
10
 
9
11
  gem 'soxi-wrapper'
10
12
 
@@ -16,14 +18,6 @@ Or install it yourself as:
16
18
 
17
19
  $ gem install soxi-wrapper
18
20
 
19
- ## Usage
20
-
21
- TODO: Write usage instructions here
22
-
23
21
  ## Contributing
24
22
 
25
- 1. Fork it
26
- 2. Create your feature branch (`git checkout -b my-new-feature`)
27
- 3. Commit your changes (`git commit -am 'Add some feature'`)
28
- 4. Push to the branch (`git push origin my-new-feature`)
29
- 5. Create new Pull Request
23
+ We have abandonned this.
@@ -0,0 +1,6 @@
1
+ module Soxi
2
+ module Wrapper
3
+ class FileMissingError < StandardError
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Soxi
2
+ module Wrapper
3
+ class SoxiMissingError < StandardError
4
+ end
5
+ end
6
+ end
@@ -1,11 +1,16 @@
1
- require "soxi/wrapper/version"
2
- require "soxi/wrapper/file"
1
+ require 'soxi/wrapper/version'
2
+ require 'soxi/wrapper/file'
3
+ require 'soxi/soxi_missing_error'
4
+ require 'soxi/file_missing_error'
3
5
 
4
6
  module Soxi
5
7
  module Wrapper
6
- def self.file filename
7
- raise 'soxi not installed' unless soxi_exists?
8
- File.new filename
8
+ def self.file(filename)
9
+ raise SoxiMissingError('Need soxi in path') unless soxi_exists?
10
+ unless ::File.exist?(filename)
11
+ raise FileMissingError("File: #{filename} does not exist")
12
+ end
13
+ Soxi::Wrapper::File.new filename
9
14
  end
10
15
 
11
16
  def self.soxi_exists?
@@ -1,3 +1,6 @@
1
+ require 'open3'
2
+ require "soxi/wrapper/soxi_failed_error"
3
+
1
4
  module Soxi
2
5
  module Wrapper
3
6
  class File
@@ -43,17 +46,28 @@ module Soxi
43
46
  end
44
47
 
45
48
  def comments
46
- @comments ||= run('a', false)
49
+ @comments ||= run_multiline('a')
47
50
  end
48
51
 
49
52
  private
50
53
 
51
- def run option, remove_newlines=true
52
- val = `soxi -#{option} #{filename}`
53
- if remove_newlines
54
- return val.gsub(/\n/,'')
55
- end
56
- val
54
+ def run_multiline(option)
55
+ run_soxi(option)
56
+ end
57
+
58
+ def run(option)
59
+ run_soxi(option).delete("\n")
60
+ end
61
+
62
+ def run_soxi(option)
63
+ val, std_err, status = Open3.capture3('soxi', "-#{option}", filename)
64
+ return val if status.success?
65
+ raise SoxiFailedError.new(
66
+ std_err: std_err,
67
+ std_out: val,
68
+ option: option,
69
+ filename: filename
70
+ )
57
71
  end
58
72
  end
59
73
  end
@@ -0,0 +1,16 @@
1
+ module Soxi
2
+ module Wrapper
3
+ class SoxiFailedError < StandardError
4
+ attr_reader :std_err, :std_out, :option, :filename
5
+ def initialize(std_err: nil,
6
+ std_out: nil,
7
+ option: nil,
8
+ filename: nil)
9
+ @std_err = std_err
10
+ @std_out = std_out
11
+ @option = option
12
+ @filename = filename
13
+ end
14
+ end
15
+ end
16
+ end
@@ -1,5 +1,5 @@
1
1
  module Soxi
2
2
  module Wrapper
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soxi-wrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claus Witt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-11 00:00:00.000000000 Z
11
+ date: 2018-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: yarjuf
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description: Wrapper class for calling soxi on files on command line
@@ -73,13 +73,16 @@ executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
75
75
  files:
76
- - .gitignore
76
+ - ".gitignore"
77
77
  - Gemfile
78
78
  - LICENSE.txt
79
79
  - README.md
80
80
  - Rakefile
81
+ - lib/soxi/file_missing_error.rb
82
+ - lib/soxi/soxi_missing_error.rb
81
83
  - lib/soxi/wrapper.rb
82
84
  - lib/soxi/wrapper/file.rb
85
+ - lib/soxi/wrapper/soxi_failed_error.rb
83
86
  - lib/soxi/wrapper/version.rb
84
87
  - soxi-wrapper.gemspec
85
88
  homepage: ''
@@ -92,17 +95,17 @@ require_paths:
92
95
  - lib
93
96
  required_ruby_version: !ruby/object:Gem::Requirement
94
97
  requirements:
95
- - - '>='
98
+ - - ">="
96
99
  - !ruby/object:Gem::Version
97
100
  version: '0'
98
101
  required_rubygems_version: !ruby/object:Gem::Requirement
99
102
  requirements:
100
- - - '>='
103
+ - - ">="
101
104
  - !ruby/object:Gem::Version
102
105
  version: '0'
103
106
  requirements: []
104
107
  rubyforge_project:
105
- rubygems_version: 2.0.7
108
+ rubygems_version: 2.6.11
106
109
  signing_key:
107
110
  specification_version: 4
108
111
  summary: Use to get information about audio files