discid 1.4.0 → 1.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGES.md +8 -0
- data/README.md +4 -5
- data/lib/discid/disc.rb +4 -4
- data/lib/discid/track.rb +3 -2
- data/lib/discid/version.rb +2 -2
- data/test/test_discid.rb +4 -3
- data/test/test_track.rb +12 -9
- metadata +8 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3b7eeb3a5b61f7c5a9068287a395c0b8f1981049ee7bc48c0de3eef2f35f36c5
|
4
|
+
data.tar.gz: a45eeb079ec088cbb3bc2fbd045a051e23cfcd4f25151c6349830373b928fc12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a12087cd902fcd32bb2ceb4846c305e4ae76187578bd0c47d88e73a7d037ecbb954dc046dcf690f4b0ba852998a1d21d3068208efb18f16e3ca1923f607bc47
|
7
|
+
data.tar.gz: d0c24a5f783f66cbcb886e158108d4c44c91f47ec0faab8e180f7d7f76531205564b6f5a680ebcca70a0cafd7f5861b87b93694f85ee65af6f6bf6d90985a599
|
data/CHANGES.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 1.5.0 (2023-12-27)
|
4
|
+
* Added {DiscId::Track#to_h} for consistency with standard library. A backward
|
5
|
+
compatible alias {DiscId::Track#to_hash} is still available.
|
6
|
+
* Removed support for Ruby 1.8
|
7
|
+
|
8
|
+
## 1.4.1 (2021-09-23)
|
9
|
+
* Fix Ruby 3 compatibility if {DiscId.tracks} gets called with a block
|
10
|
+
|
3
11
|
## 1.4.0 (2019-05-06)
|
4
12
|
* Fixed {DiscId.put} handling of first_track being > 1
|
5
13
|
* Added {DiscId.parse} to parse a TOC string
|
data/README.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# Ruby bindings for MusicBrainz libdiscid
|
2
|
-
[![Build Status](https://travis-ci.org/phw/ruby-discid.svg?branch=master)](https://travis-ci.org/phw/ruby-discid)
|
3
|
-
[![Code Climate](https://codeclimate.com/github/phw/ruby-discid.png)](https://codeclimate.com/github/phw/ruby-discid)
|
4
|
-
[![Code Climate](https://codeclimate.com/github/phw/ruby-discid/coverage.png)](https://codeclimate.com/github/phw/ruby-discid)
|
5
2
|
[![Gem Version](https://badge.fury.io/rb/discid.svg)](http://badge.fury.io/rb/discid)
|
3
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/50e356f4260a127af75b/maintainability)](https://codeclimate.com/github/phw/ruby-discid/maintainability)
|
4
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/50e356f4260a127af75b/test_coverage)](https://codeclimate.com/github/phw/ruby-discid/test_coverage)
|
6
5
|
|
7
6
|
## About
|
8
7
|
ruby-discid provides Ruby bindings for the MusicBrainz DiscID library [libdiscid](http://musicbrainz.org/doc/libdiscid).
|
@@ -15,7 +14,7 @@ ruby-discid will just return a default value. The version required for a feature
|
|
15
14
|
is documented in the [API documentation](http://www.rubydoc.info/github/phw/ruby-discid/master).
|
16
15
|
|
17
16
|
## Requirements
|
18
|
-
* Ruby >=
|
17
|
+
* Ruby >= 2.0
|
19
18
|
* RubyGems >= 1.3.6
|
20
19
|
* Ruby-FFI >= 1.6.0
|
21
20
|
* libdiscid >= 0.1.0
|
@@ -112,7 +111,7 @@ Please report any issues on the
|
|
112
111
|
[issue tracker](https://github.com/phw/ruby-discid/issues).
|
113
112
|
|
114
113
|
## License
|
115
|
-
ruby-discid Copyright (c) 2007-
|
114
|
+
ruby-discid Copyright (c) 2007-2023 by Philipp Wolfer <ph.wolfer@gmail.com>
|
116
115
|
|
117
116
|
ruby-discid is free software: you can redistribute it and/or modify
|
118
117
|
it under the terms of the GNU Lesser General Public License as published by
|
data/lib/discid/disc.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2013-2014 Philipp Wolfer
|
1
|
+
# Copyright (C) 2013-2014, 2021 Philipp Wolfer
|
2
2
|
#
|
3
3
|
# This program is free software: you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU Lesser General Public License as published by
|
@@ -197,12 +197,12 @@ module DiscId
|
|
197
197
|
# instead iterates over the block calling the block with one argument.
|
198
198
|
# @yieldreturn [nil]
|
199
199
|
# @return [Array<Track>] Array of {Track} objects.
|
200
|
-
def tracks
|
200
|
+
def tracks(&block)
|
201
201
|
if @read
|
202
202
|
read_tracks if @tracks.nil?
|
203
203
|
|
204
|
-
if
|
205
|
-
@tracks.each(&
|
204
|
+
if block
|
205
|
+
@tracks.each(&block)
|
206
206
|
return nil
|
207
207
|
else
|
208
208
|
return @tracks
|
data/lib/discid/track.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2008
|
1
|
+
# Copyright (C) 2008-2023 Philipp Wolfer
|
2
2
|
#
|
3
3
|
# This program is free software: you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU Lesser General Public License as published by
|
@@ -117,7 +117,7 @@ module DiscId
|
|
117
117
|
# Converts the Track into a Hash.
|
118
118
|
#
|
119
119
|
# @return [Hash]
|
120
|
-
def
|
120
|
+
def to_h
|
121
121
|
{
|
122
122
|
:number => number,
|
123
123
|
:sectors => sectors,
|
@@ -130,5 +130,6 @@ module DiscId
|
|
130
130
|
}
|
131
131
|
end
|
132
132
|
|
133
|
+
alias_method :to_hash, :to_h
|
133
134
|
end
|
134
135
|
end
|
data/lib/discid/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (C) 2013 Philipp Wolfer
|
1
|
+
# Copyright (C) 2013-2023 Philipp Wolfer
|
2
2
|
#
|
3
3
|
# This program is free software: you can redistribute it and/or modify
|
4
4
|
# it under the terms of the GNU Lesser General Public License as published by
|
@@ -16,5 +16,5 @@
|
|
16
16
|
#
|
17
17
|
module DiscId
|
18
18
|
# The version of ruby-discid.
|
19
|
-
VERSION = "1.
|
19
|
+
VERSION = "1.5.0"
|
20
20
|
end
|
data/test/test_discid.rb
CHANGED
@@ -63,15 +63,16 @@ class TestDiscId < Test::Unit::TestCase
|
|
63
63
|
disc = DiscId.put(3, @fiction_sectors,
|
64
64
|
[150, 18901, 39738, 59557, 79152, 100126,
|
65
65
|
124833, 147278, 166336, 182560])
|
66
|
+
assert_equal "ByBKvJM1hBL7XtvsPyYtIjlX0Bw-", disc.id
|
66
67
|
assert_equal 3, disc.first_track_number
|
67
68
|
assert_equal 12, disc.last_track_number
|
68
69
|
assert_equal 10, disc.tracks.size
|
69
70
|
end
|
70
71
|
|
71
72
|
def test_put_invalid_track_count
|
72
|
-
assert_raise(DiscId::DiscError)
|
73
|
-
|
74
|
-
|
73
|
+
assert_raise(DiscId::DiscError) do
|
74
|
+
DiscId.put(1, @fiction_sectors, Array.new(101) {|i| i + 150 })
|
75
|
+
end
|
75
76
|
end
|
76
77
|
|
77
78
|
# Test the tracks method and TrackInfo objects
|
data/test/test_track.rb
CHANGED
@@ -43,17 +43,20 @@ class TestTrack < Test::Unit::TestCase
|
|
43
43
|
|
44
44
|
def test_to_hash
|
45
45
|
track = DiscId::Track.new @number, @offset, @length, @isrc
|
46
|
-
hash = track.to_hash
|
47
46
|
|
48
|
-
|
49
|
-
|
50
|
-
assert_equal track.sectors, hash[:sectors]
|
51
|
-
assert_equal track.isrc, hash[:isrc]
|
47
|
+
for f in %i(to_h to_hash) do
|
48
|
+
hash = track.send(f)
|
52
49
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
50
|
+
assert_equal track.number, hash[:number]
|
51
|
+
assert_equal track.offset, hash[:offset]
|
52
|
+
assert_equal track.sectors, hash[:sectors]
|
53
|
+
assert_equal track.isrc, hash[:isrc]
|
54
|
+
|
55
|
+
assert_equal track.end_sector, hash[:end_sector]
|
56
|
+
assert_equal track.seconds, hash[:seconds]
|
57
|
+
assert_equal track.start_time, hash[:start_time]
|
58
|
+
assert_equal track.end_time, hash[:end_time]
|
59
|
+
end
|
57
60
|
end
|
58
61
|
|
59
62
|
def test_selector_access
|
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.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Philipp Wolfer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ffi
|
@@ -98,16 +98,16 @@ dependencies:
|
|
98
98
|
name: simplecov
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - "
|
101
|
+
- - "<"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
103
|
+
version: '0.18'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - "
|
108
|
+
- - "<"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
110
|
+
version: '0.18'
|
111
111
|
description: ruby-discid provides Ruby bindings for the MusicBrainz DiscID library
|
112
112
|
libdiscid. It allows calculating DiscIDs (MusicBrainz and freedb) for Audio CDs.
|
113
113
|
Additionally the library can extract the MCN/UPC/EAN and the ISRCs from disc.
|
@@ -150,7 +150,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
150
150
|
requirements:
|
151
151
|
- - ">="
|
152
152
|
- !ruby/object:Gem::Version
|
153
|
-
version:
|
153
|
+
version: '2.0'
|
154
154
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
155
|
requirements:
|
156
156
|
- - ">="
|
@@ -158,8 +158,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
158
|
version: 1.3.6
|
159
159
|
requirements:
|
160
160
|
- libdiscid >= 0.1.0
|
161
|
-
|
162
|
-
rubygems_version: 2.6.14.4
|
161
|
+
rubygems_version: 3.5.3
|
163
162
|
signing_key:
|
164
163
|
specification_version: 4
|
165
164
|
summary: Ruby bindings for libdiscid
|