ruby-audioinfo 0.5.4 → 0.5.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b256c5022fe62915d11bd43fa0cafeb3614903e26b20e46905b83c209ab7af0e
4
- data.tar.gz: 2f93f159c9acc9e19d17401b697172a9a95b30e63843c9283846fd7ab9c1527e
3
+ metadata.gz: 74f9fc4a57204013fea05e2d88e3fbec568b833a5aa7627e345d740b6601a685
4
+ data.tar.gz: 2f7d5b623dcf6a04dc6a203cb4c4e115057625dbb7d5b910b6632a94d591e37d
5
5
  SHA512:
6
- metadata.gz: d44d229a4b38d7346458a0615ca2fe25543e002395f5d0b3e5b43feaba97058c1a2adc8e91966492bc3c0bf4070c70b74adf0038c089e8e23a531012e2a8cb07
7
- data.tar.gz: 3725e8f79bc843c5ccfe6c7ed0f86fcbfd9aac129f5134ea58992a9af92a4b3ffbc90cb957862cccfa88ca70fcc917c78e8336597291ba0ac118e27db83882da
6
+ metadata.gz: b27b66d77f3e02a1892ace15d6daf124f048c0c2fb3b2864f085bd0557020b6787d5ba295dfba5b7e793822ddb153814f9b213a8fdd2c1cc0ab4a550c562fc54
7
+ data.tar.gz: 2f7e0694eccc686992e16ab9fed24dc573529906a945322bb05411d627a2734b041ea2f6da9c3543e5af78bcd41c6765184245d0c526509f720c22dad202fac6
@@ -32,7 +32,7 @@ jobs:
32
32
  ruby-version: ${{ matrix.ruby }}
33
33
  bundler-cache: true
34
34
  - name: Install dependencies
35
- run: sudo apt install ffmpeg
35
+ run: sudo apt install ffmpeg faad
36
36
  - name: Install Gems
37
37
  run: bundle install
38
38
  - name: Run tests
data/.gitignore CHANGED
@@ -1 +1,7 @@
1
- coverage
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /tmp/
@@ -53,17 +53,17 @@ Metrics/ClassLength:
53
53
  # Offense count: 4
54
54
  # Configuration parameters: IgnoredMethods.
55
55
  Metrics/CyclomaticComplexity:
56
- Max: 28
56
+ Max: 29
57
57
 
58
58
  # Offense count: 8
59
59
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
60
60
  Metrics/MethodLength:
61
- Max: 116
61
+ Max: 117
62
62
 
63
63
  # Offense count: 4
64
64
  # Configuration parameters: IgnoredMethods.
65
65
  Metrics/PerceivedComplexity:
66
- Max: 23
66
+ Max: 24
67
67
 
68
68
  # Offense count: 6
69
69
  # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ruby-audioinfo (0.5.4)
4
+ ruby-audioinfo (0.5.5)
5
5
  apetag (>= 1.1.4)
6
6
  flacinfo-rb (>= 0.4)
7
7
  moumar-wmainfo-rb (>= 0.7)
@@ -149,10 +149,12 @@ class AudioInfo
149
149
  @length = @info.SECS
150
150
  mapping = MUSICBRAINZ_FIELDS.invert
151
151
 
152
- faad_info(filename).match(/^MusicBrainz (.+)$/) do
153
- name, value = Regexp.last_match(1).split(/: /, 2)
152
+ faad_info(filename).scan(/^MusicBrainz (.+): (.+)$/) do |match|
153
+ name, value = match
154
154
  key = mapping[name]
155
- @musicbrainz_infos[key] = value
155
+ next unless key
156
+
157
+ @musicbrainz_infos[key] = value.strip.gsub("\u0000", '')
156
158
  end
157
159
 
158
160
  when 'flac'
@@ -375,29 +377,21 @@ class AudioInfo
375
377
  rescue ApeTagError
376
378
  end
377
379
 
378
- def faad_info(file)
379
- stdout, stdout_w = IO.pipe
380
- stderr, stderr_w = IO.pipe
381
-
382
- fork do
383
- stdout.close
384
- stderr.close
385
- $stdout.reopen(stdout_w)
386
- $stderr.reopen(stderr_w)
387
- exec 'faad', '-i', file
388
- end
380
+ def faad_info(path)
381
+ require 'open3'
389
382
 
390
- stdout_w.close
391
- stderr_w.close
392
- pid, status = Process.wait2
383
+ output = ''
384
+ status = nil
393
385
 
394
- out = stdout.read.chomp
395
- stdout.close
396
- err = stderr.read.chomp
397
- stderr.close
386
+ begin
387
+ Open3.popen3('faad', '-i', path) do |_stdin, _stdout, stderr, wait_thr|
388
+ output = stderr.read.chomp
389
+ status = wait_thr.value
390
+ end
391
+ rescue StandardError
392
+ end
398
393
 
399
- # Return the stderr because faad prints info on that fd...
400
- status.exitstatus.zero? ? err : ''
394
+ status&.exitstatus&.zero? ? output : ''
401
395
  end
402
396
 
403
397
  def shell_escape(s)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class AudioInfo
4
- VERSION = '0.5.4'
4
+ VERSION = '0.5.5'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-audioinfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guillaume Pierronnet
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-12-30 00:00:00.000000000 Z
12
+ date: 2021-01-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: apetag