apple_music_library 0.12.0 → 0.13.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bd3e0f399519af81aa6cbcfe2b93ac6e1b46aed6c3bae8a3e7ececb38da228fa
4
- data.tar.gz: 513c9a28c7ee88d54f4eac8775b8b521ea5809cd58f9e5dca88218c3cdddb69b
3
+ metadata.gz: 50f3e5425e1ef5cd751ab85f45593aaa1bca9122e886d6f12780dfb503db5ad6
4
+ data.tar.gz: d817e40ffb7df005b3169b7ef9ac8e49a917312313bec4fcca7b31c91ac4ad1b
5
5
  SHA512:
6
- metadata.gz: cae55ca54cc8b379482da24e8d11f67c4b53c3d7735ac2e14d85930e3be5e4cc5fbef6e4b369799fd97d28941545093af5d39078a18010625d0550effa9cfbec
7
- data.tar.gz: c8cd1e2cd3800896d2f76e7fd0576199f03f962fe5db1957758be9208f790a3222a9cfd2632de49e56bb8898ea7a184d5eba88a5c262234598e82aad1de33df7
6
+ metadata.gz: 7db558674bc78b1fc102be423492132f28fc6922b88204a7a702474f8a7161e1541a648f75496ceb4721c320b1bb5e850e62562b8a00d8d74aaf95d8f37776bd
7
+ data.tar.gz: 2d14b9da9c7f61cfeefa4e96a1d43ca7f3831135a187e2a39b60f832896209eff9b2d23c818e9ef0f5c24b458ba1a6a27f185aad33df6e6b86fd7e3a26191af3
data/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  ## [Unreleased]
4
4
  - Ability to print out playlist folder hierarchy
5
5
 
6
+ ## 0.13.2 - 2022-03-16
7
+ ### Fixed
8
+ - Fixed bug where tracks with empty artist names would throw an exception
9
+
10
+ ## 0.13.1 - 2022-03-16
11
+ ### Fixed
12
+ - Now strips leading/trailing whitespace from artist and track names
13
+
14
+ ## 0.13.0 - 2022-03-26
15
+ ### Added
16
+ - Added handling for system verses user-created playlists
17
+
6
18
  ## 0.12.0 - 2022-03-26
7
19
  ### Added
8
20
  - Added handling for smart versus regular playlists
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- apple_music_library (0.12.0)
4
+ apple_music_library (0.13.2)
5
5
  facets (~> 3.1)
6
6
  plist (~> 3.6)
7
7
 
data/README.md CHANGED
@@ -49,6 +49,7 @@ library.playlists(:smart).each do |playlist|
49
49
  end
50
50
 
51
51
  # List all regular (not 'smart') playlists
52
+ # This filter also excludes apple-created playlists (e.g. the 'Library' and 'Downloaded' playlists)
52
53
  library.playlists(:regular).each do |playlist|
53
54
  puts playlist.name
54
55
  end
@@ -6,7 +6,7 @@ module AppleMusicLibrary
6
6
  @@artists = {}
7
7
 
8
8
  def initialize(name)
9
- @name = name
9
+ @name = name&.strip
10
10
  @albums = []
11
11
  @tracks = []
12
12
  end
@@ -8,16 +8,25 @@ module AppleMusicLibrary
8
8
 
9
9
  @@playlists = {}
10
10
 
11
- ATTRIBUTES = ['Name',
12
- 'Description',
13
- 'Playlist ID',
14
- 'Playlist Persistent ID',
15
- 'Parent Persistent ID',
16
- 'All Items',
17
- 'Smart Info',
18
- 'Smart Criteria',
19
- 'Playlist Items',
20
- 'Folder']
11
+ ATTRIBUTES = [
12
+ 'Name',
13
+ 'Description',
14
+ 'Playlist ID',
15
+ 'Playlist Persistent ID',
16
+ 'Parent Persistent ID',
17
+ 'All Items',
18
+ 'Smart Info',
19
+ 'Smart Criteria',
20
+ 'Playlist Items',
21
+ 'Folder'
22
+ ]
23
+
24
+ SYSTEM_PLAYLISTS = [
25
+ 'Downloaded',
26
+ 'Library',
27
+ 'Music',
28
+ 'Recently Played'
29
+ ]
21
30
 
22
31
  def initialize(info)
23
32
  @info = info
@@ -42,7 +51,11 @@ module AppleMusicLibrary
42
51
  end
43
52
 
44
53
  def self.regular
45
- @@playlists.values.select{|p| !p.smart?}
54
+ @@playlists.values.select{|p| !p.smart? and !p.system?}
55
+ end
56
+
57
+ def self.system
58
+ @@playlists.values.select{|p| p.system?}
46
59
  end
47
60
 
48
61
  def self.find_by_name(playlist_name)
@@ -71,6 +84,10 @@ module AppleMusicLibrary
71
84
  smart_info.present?
72
85
  end
73
86
 
87
+ def system?
88
+ SYSTEM_PLAYLISTS.include?(name)
89
+ end
90
+
74
91
  def token
75
92
  :playlist
76
93
  end
@@ -2,7 +2,7 @@ require 'facets'
2
2
 
3
3
  module AppleMusicLibrary
4
4
  class Track
5
- attr_reader :artist, :album, :genre
5
+ attr_reader :artist, :album, :genre, :info
6
6
 
7
7
  # 'Artist', The #artist, #album, and #genre methods return objects rather than strings and have methods like #artist_name to retrieve the strings.
8
8
  # 'Album',
@@ -105,7 +105,7 @@ module AppleMusicLibrary
105
105
 
106
106
  ATTRIBUTES.each do |track_attribute|
107
107
  define_method(track_attribute.to_s.snakecase) do
108
- @info[track_attribute]
108
+ @info[track_attribute].class.name == 'String' ? @info[track_attribute].strip : @info[track_attribute]
109
109
  end
110
110
  end
111
111
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AppleMusicLibrary
4
- VERSION = "0.12.0"
4
+ VERSION = "0.13.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apple_music_library
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Gehman