apple_music_library 0.8.0 → 0.9.0

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: 5c00fde335b53ca8bacdd13bdbce297b0bea1a7f5f4453f4c42bbe9c867b6c02
4
- data.tar.gz: cec158953268525e8142c5a51960d0b79584e646c4e16def0fb2e71cd66b2b7e
3
+ metadata.gz: d57d33d85a24895e93ca386313d43fe9dd28c6a48bec21fbb4348ec3b168a177
4
+ data.tar.gz: d3d0b25dbd54fa23f03cea03b46729224d9b1054da276060a62cac40ab0016e3
5
5
  SHA512:
6
- metadata.gz: debab2473712160521d5bc793b65e3febd984620f53d060e3864285bcb906119b074d645c678fcb4e865ea23ae90b6005eff4ccc89c26a3cfb0d91b556f26199
7
- data.tar.gz: 47e7b6381f4d94afda90441cdd975fed9ba6afc6ff09de115e0cd0a1144b0bd9b3582cec0f5f736d394308d6537b5f3e31bba407cde5496b7ace6b5cc59ee6b6
6
+ metadata.gz: 319fb967951a32d12f0d871c32d40b56a2c4d674bbb8966de6bf6b592da5b5ed0af41f9443caf2b7b222345ded89264af85bdf75694856a8ed7e37162ab706f1
7
+ data.tar.gz: 148f0638affc3d19f1c96619e732280966574885fce0c66acc69e083d0cd569200e2a8535f75f96e8ef06b75fdee07b6f0ca82befd0ab8a4bcf914b86af2fff5
data/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  ## [Unreleased]
4
4
  - Ability to print out playlist folder hierarchy
5
5
 
6
+ ## 0.9.0 - 2022-03-15
7
+ ### Added
8
+ - Ability to get genres associated with an artist
9
+
6
10
  ## 0.8.0 - 2022-03-13
7
11
  ### Added
8
12
  - Ability to sort artists by track count and album count
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- apple_music_library (0.8.0)
4
+ apple_music_library (0.9.0)
5
5
  facets (~> 3.1)
6
6
  plist (~> 3.6)
7
7
 
data/README.md CHANGED
@@ -44,10 +44,15 @@ playlist.tracks.each do |track|
44
44
  puts track.name
45
45
  end
46
46
 
47
- # Count tracks by artist
47
+ # Count tracks by an artist
48
48
  artist = library.artist('XTC')
49
49
  puts artist.tracks.count
50
50
 
51
+ # List genres associated with the artist
52
+ artist.genres.each do |genre|
53
+ puts genre.name
54
+ end
55
+
51
56
  # Get favorite tracks by this artist
52
57
  favorite_tracks = artist.tracks.select{|t| t.loved? || t.star_rating > 3}
53
58
 
@@ -68,8 +73,9 @@ end
68
73
 
69
74
  # Display track counts per genre
70
75
  library.genres.each do |genre|
71
- puts "#{genre.tracks.count} #{genre.name}"
76
+ puts "#{genre.track_count} #{genre.name}"
72
77
  end
78
+
73
79
  ```
74
80
  All stored attributes are available via snake_cased methods on `Track` and `Playlist`. However, note that `#artist`, `#album`, and `#genre` are special cases, returning Ruby objects rather than their associated string values. Methods to return the string versions of these track attributes are provided as `track.artist_name`, `track.album_name`, and `track.genre_name`.
75
81
 
@@ -73,6 +73,10 @@ module AppleMusicLibrary
73
73
  tracks.map(&:play_count).sum
74
74
  end
75
75
 
76
+ def genres
77
+ @genres ||= tracks.map(&:genre).uniq
78
+ end
79
+
76
80
  protected
77
81
 
78
82
  def self.sorted_set(sort_by_method, limit)
@@ -29,6 +29,10 @@ module AppleMusicLibrary
29
29
  @tracks << track
30
30
  end
31
31
 
32
+ def track_count
33
+ @track_count ||= tracks.count
34
+ end
35
+
32
36
  def star_rating
33
37
  return nil if rated_tracks.empty?
34
38
  rated_tracks.map(&:star_rating).sum / rated_tracks.size
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AppleMusicLibrary
4
- VERSION = "0.8.0"
4
+ VERSION = "0.9.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apple_music_library
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Gehman
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-13 00:00:00.000000000 Z
11
+ date: 2022-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: awesome_print
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  - !ruby/object:Gem::Version
158
158
  version: '0'
159
159
  requirements: []
160
- rubygems_version: 3.3.3
160
+ rubygems_version: 3.3.9
161
161
  signing_key:
162
162
  specification_version: 4
163
163
  summary: Provides a Ruby interface to the information stored in an Apple Music (formerly