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 +4 -4
- data/CHANGELOG.md +12 -0
- data/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/lib/apple_music_library/artist.rb +1 -1
- data/lib/apple_music_library/playlist.rb +28 -11
- data/lib/apple_music_library/track.rb +2 -2
- data/lib/apple_music_library/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50f3e5425e1ef5cd751ab85f45593aaa1bca9122e886d6f12780dfb503db5ad6
|
4
|
+
data.tar.gz: d817e40ffb7df005b3169b7ef9ac8e49a917312313bec4fcca7b31c91ac4ad1b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
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
|
@@ -8,16 +8,25 @@ module AppleMusicLibrary
|
|
8
8
|
|
9
9
|
@@playlists = {}
|
10
10
|
|
11
|
-
ATTRIBUTES = [
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
|