id3_tags 0.0.7 → 0.0.8

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
  SHA1:
3
- metadata.gz: 47c65eb98ce9c196c9b27ea05f6ee43d8c05b642
4
- data.tar.gz: 43acbbeb44bbf09ec5b561c733a757440cf1fd9c
3
+ metadata.gz: 802c7ffb439a67bb25e01809ad5388b80e607fdd
4
+ data.tar.gz: 8eafdba8abc7a6df7667285360e7e5d363c4ef71
5
5
  SHA512:
6
- metadata.gz: 44280faeef3584969085430b880a14b6ae6c9f3f15e7d418ef19da70d6f4ac60ca5386b3058975b48bb17682125a0bc69ce52bb52141d38e887cd81b879875af
7
- data.tar.gz: 637c0cc815f89d47d2e49c8718063a57b453f9dca3c6c85df94aadd57739f58c25b0bbfacec93a1fe0ff6add25362500ea88c10360f725cd6174ea2198c39139
6
+ metadata.gz: d02baad053437c9b1a22498f074e1b7d22501d721189a8b407a2d8a7b99956def9b2e30349387c13f7e4143f5682d96abcb4cdf0155b0876e6b74bcc42b353a0
7
+ data.tar.gz: e61c8bc9e55d4dc446ab9ed24f555519da65b94db4bb0818962263f509b549b62116b232306dee508ad5d7cbd2914496a8095f9364e7815228adfa8fb1149d9b
@@ -23,7 +23,8 @@ module Id3Tags
23
23
  TagLib::MP4::Item.from_bool content
24
24
  when :pair
25
25
  return unless content[:number]
26
- TagLib::MP4::Item.from_int_pair content.values_at(:number, :count)
26
+ pair = content.values_at :number, :count
27
+ TagLib::MP4::Item.from_int_pair int_pair_for(pair)
27
28
  when :image
28
29
  return unless content[:data]
29
30
  mime_type = case content[:mime_type]
@@ -35,5 +36,21 @@ module Id3Tags
35
36
  TagLib::MP4::Item.from_cover_art_list [cover_art]
36
37
  end
37
38
  end
39
+
40
+ # Return a *valid* int pair to build a TagLib::MP4::Item object
41
+ #
42
+ # @param [Array] pair an array of two elements
43
+ # @return [Array] a valid pair to use in TagLib::MP4::Item.from_int_pair
44
+ #
45
+ # @example int_pair_for([1, 2)] #=> [1, 2]
46
+ # @example int_pair_for([0, nil)] #=> [0, 0]
47
+ #
48
+ # @note This function helps writing tags with pairs that only have one
49
+ # value set. A common case is tracks with a *track number* and
50
+ # without a *track count*. This information is stored in M4A files
51
+ # by setting the *track count* to 0 (and not to 'nil').
52
+ def int_pair_for(pair)
53
+ pair.map{|n| n || 0}
54
+ end
38
55
  end
39
56
  end
@@ -1,3 +1,3 @@
1
1
  module Id3Tags
2
- VERSION = '0.0.7'
2
+ VERSION = '0.0.8'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: id3_tags
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Baccigalupo