discid 1.3.1 → 1.3.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.
- checksums.yaml +5 -5
- data/CHANGES.md +4 -1
- data/lib/discid/disc.rb +2 -2
- data/lib/discid/lib.rb +15 -8
- data/lib/discid/version.rb +1 -1
- data/test/test_disc.rb +6 -0
- data/test/test_lib.rb +40 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fa1e17690165aeec4fbcbba04e78b7e24ceda6f44b409149d682e8a24b83692b
|
4
|
+
data.tar.gz: c8b61ae0fef04a93105e9e2d120fcc2b67281086696f22a6f3ee8f5c67395c76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 854bd221c4e17c2828a7ede9586f797715ef138f94fa5d039eae227f72e133913db01541e7f7f9f984dbd51dcf8f14c914b7a1b9752b4dc69400e55bca71b5f8
|
7
|
+
data.tar.gz: b4a832781ed273f892a6268cd2a79e2318619b4536e6c49a4b267f10537b9bbaf89d3b1cea64e141496f7b22ee42093f5be48cacd7c06a740da7d07a9fbbc1cb
|
data/CHANGES.md
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.3.2 (2017-12-19)
|
4
|
+
* Fixed call to {DiscId::Disc#toc_string} with native implementation
|
5
|
+
|
3
6
|
## 1.3.1 (2017-02-16)
|
4
|
-
* codeclimate-test-reporter is no longer a development
|
7
|
+
* codeclimate-test-reporter is no longer a development dependency
|
5
8
|
|
6
9
|
## 1.3.0 (2016-02-19)
|
7
10
|
* Add support for {DiscId::Disc#toc_string}. Will use the implementation from
|
data/lib/discid/disc.rb
CHANGED
@@ -145,13 +145,13 @@ module DiscId
|
|
145
145
|
# @return [String] The TOC string or `nil` if no ID was yet read.
|
146
146
|
def toc_string
|
147
147
|
return nil if not @read
|
148
|
-
result = Lib.get_toc_string
|
148
|
+
result = Lib.get_toc_string @handle
|
149
149
|
if not result
|
150
150
|
# probably an old version of libdiscid (< 0.6.0)
|
151
151
|
# gather toc string from submission_url
|
152
152
|
match = /toc=([0-9+]+)/.match self.submission_url
|
153
153
|
if match
|
154
|
-
result = match[1].
|
154
|
+
result = match[1].tr("+", " ")
|
155
155
|
else
|
156
156
|
raise "can't get toc string from submission url"
|
157
157
|
end
|
data/lib/discid/lib.rb
CHANGED
@@ -35,7 +35,7 @@ module DiscId
|
|
35
35
|
rescue FFI::NotFoundError
|
36
36
|
attach_function :legacy_read, :discid_read, [:pointer, :string], :int
|
37
37
|
|
38
|
-
def self.read(handle, device,
|
38
|
+
def self.read(handle, device, _features)
|
39
39
|
legacy_read(handle, device)
|
40
40
|
end
|
41
41
|
end
|
@@ -73,7 +73,7 @@ module DiscId
|
|
73
73
|
begin
|
74
74
|
attach_function :get_mcn, :discid_get_mcn, [:pointer], :string
|
75
75
|
rescue FFI::NotFoundError
|
76
|
-
def self.get_mcn(
|
76
|
+
def self.get_mcn(_handle)
|
77
77
|
return nil
|
78
78
|
end
|
79
79
|
end
|
@@ -81,7 +81,7 @@ module DiscId
|
|
81
81
|
begin
|
82
82
|
attach_function :get_track_isrc, :discid_get_track_isrc, [:pointer, :int], :string
|
83
83
|
rescue FFI::NotFoundError
|
84
|
-
def self.get_track_isrc(
|
84
|
+
def self.get_track_isrc(_handle, _track)
|
85
85
|
return nil
|
86
86
|
end
|
87
87
|
end
|
@@ -109,17 +109,24 @@ module DiscId
|
|
109
109
|
end
|
110
110
|
|
111
111
|
def self.features_to_int(features)
|
112
|
-
|
112
|
+
feature_flags = 0
|
113
113
|
features.each do |feature|
|
114
114
|
if feature.respond_to? :to_sym
|
115
115
|
feature = feature.to_sym
|
116
|
-
|
117
|
-
self::Features.symbols.include?(feature) and
|
118
|
-
self.has_feature(feature)
|
116
|
+
feature_flags = self.add_feature_to_flags(feature_flags, feature)
|
119
117
|
end
|
120
118
|
end
|
121
119
|
|
122
|
-
return
|
120
|
+
return feature_flags
|
121
|
+
end
|
122
|
+
|
123
|
+
private
|
124
|
+
|
125
|
+
def self.add_feature_to_flags(flags, feature)
|
126
|
+
flags |= self::Features[feature] if
|
127
|
+
self::Features.symbols.include?(feature) and
|
128
|
+
self.has_feature(feature)
|
129
|
+
return flags
|
123
130
|
end
|
124
131
|
end
|
125
132
|
end
|
data/lib/discid/version.rb
CHANGED
data/test/test_disc.rb
CHANGED
@@ -85,4 +85,10 @@ class TestDisc < Test::Unit::TestCase
|
|
85
85
|
assert_equal @fiction_lengths, disc.tracks.map{|t| t.sectors}
|
86
86
|
end
|
87
87
|
|
88
|
+
def test_toc_string
|
89
|
+
disc = DiscId.put(@fiction_first_track, @fiction_sectors, @fiction_offsets)
|
90
|
+
expected_toc = '1 10 206535 150 18901 39738 59557 79152 100126 124833 147278 166336 182560'
|
91
|
+
assert_equal expected_toc, disc.toc_string
|
92
|
+
end
|
93
|
+
|
88
94
|
end
|
data/test/test_lib.rb
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# Copyright (C) 2013-2014 Philipp Wolfer
|
2
|
+
#
|
3
|
+
# This program is free software: you can redistribute it and/or modify
|
4
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
5
|
+
# the Free Software Foundation, either version 3 of the License, or
|
6
|
+
# (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This program is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
11
|
+
# GNU Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public License
|
14
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
15
|
+
|
16
|
+
require_relative 'helper'
|
17
|
+
require 'test/unit'
|
18
|
+
require 'discid/lib'
|
19
|
+
|
20
|
+
class TestTrack < Test::Unit::TestCase
|
21
|
+
def test_features_to_int
|
22
|
+
assert_equal 1, DiscId::Lib.features_to_int([:read])
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_features_to_int_no_features
|
26
|
+
assert_equal 0, DiscId::Lib.features_to_int([])
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_features_to_int_as_strings
|
30
|
+
assert_equal 1, DiscId::Lib.features_to_int(['read'])
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_features_to_int_ignores_unknown
|
34
|
+
assert_equal 1, DiscId::Lib.features_to_int([:read, :fake])
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_has_feature
|
38
|
+
assert_equal 1, DiscId::Lib.has_feature(:read)
|
39
|
+
end
|
40
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: discid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philipp Wolfer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- test/helper.rb
|
134
134
|
- test/test_disc.rb
|
135
135
|
- test/test_discid.rb
|
136
|
+
- test/test_lib.rb
|
136
137
|
- test/test_track.rb
|
137
138
|
homepage: https://github.com/phw/ruby-discid
|
138
139
|
licenses:
|
@@ -156,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
156
157
|
requirements:
|
157
158
|
- libdiscid >= 0.1.0
|
158
159
|
rubyforge_project:
|
159
|
-
rubygems_version: 2.
|
160
|
+
rubygems_version: 2.7.3
|
160
161
|
signing_key:
|
161
162
|
specification_version: 4
|
162
163
|
summary: Ruby bindings for libdiscid
|
@@ -164,4 +165,5 @@ test_files:
|
|
164
165
|
- test/helper.rb
|
165
166
|
- test/test_disc.rb
|
166
167
|
- test/test_discid.rb
|
168
|
+
- test/test_lib.rb
|
167
169
|
- test/test_track.rb
|