apple_music_library 0.5.0 → 0.6.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 +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/README.md +6 -1
- data/apple_music_library.gemspec +1 -1
- data/lib/apple_music_library/artist.rb +12 -0
- data/lib/apple_music_library/library.rb +2 -2
- data/lib/apple_music_library/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63c39fb0820781890a73912185de50cd207af719b59d25a022626374f1ab8eac
|
4
|
+
data.tar.gz: 99d363ef519977c4b2786684e539289a58cf76503e397c34c7060f42a02c52aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8f45294602867c1de2a10ad3dbe1d88ad02508dc6060712c0cdb436e032c93ea5eb35f69eb0a9e9f1c5dae98089666d8928919f140b668d1c8980b11a7ec517
|
7
|
+
data.tar.gz: d0724a89d0d22c4be3a65550253284e176102e3c2c2f085ace60418516ba333ed7ebbdc25fda382ee18303d47bf29eeef256b533b231c733813f473c3c28a3a5
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
## [Unreleased]
|
4
4
|
- Ability to print out playlist folder hierarchy
|
5
5
|
|
6
|
+
## 0.6.0 - 2022-03-11
|
7
|
+
### Added
|
8
|
+
- Ability to sort list top artists by play count
|
9
|
+
|
6
10
|
## 0.5.0 - 2022-03-11
|
7
11
|
### Added
|
8
12
|
- Basic functionality for track ratings via the #rating, #star_rating, and #loved
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -44,9 +44,14 @@ end
|
|
44
44
|
artist = library.artist('XTC')
|
45
45
|
puts artist.tracks.count
|
46
46
|
|
47
|
-
# Get favorite tracks by this
|
47
|
+
# Get favorite tracks by this artist
|
48
48
|
favorite_tracks = artist.tracks.select{|t| t.loved? || t.star_rating > 3}
|
49
49
|
|
50
|
+
# List out the most played artists
|
51
|
+
library.artists(:most_played).each do |artist|
|
52
|
+
puts "#{artist.play_count} :: #{artist.name}"
|
53
|
+
end
|
54
|
+
|
50
55
|
# Display track counts per genre
|
51
56
|
library.genres.each do |genre|
|
52
57
|
puts "#{genre.tracks.count} #{genre.name}"
|
data/apple_music_library.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
|
19
19
|
spec.metadata["homepage_uri"] = spec.homepage
|
20
20
|
spec.metadata["source_code_uri"] = "https://github.com/pugetive/apple_music_library"
|
21
|
-
|
21
|
+
spec.metadata["changelog_uri"] = "https://github.com/pugetive/apple_music_library/blob/main/CHANGELOG.md"
|
22
22
|
|
23
23
|
# Specify which files should be added to the gem when it is released.
|
24
24
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -15,6 +15,14 @@ module AppleMusicLibrary
|
|
15
15
|
@@artists.values
|
16
16
|
end
|
17
17
|
|
18
|
+
def self.most_played(limit = 20)
|
19
|
+
if limit.nil?
|
20
|
+
self.all.sort_by(&:play_count).reverse
|
21
|
+
else
|
22
|
+
self.all.sort_by(&:play_count).reverse.take(limit)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
18
26
|
def self.find_or_create(name)
|
19
27
|
if @@artists[name]
|
20
28
|
return @@artists[name]
|
@@ -49,5 +57,9 @@ module AppleMusicLibrary
|
|
49
57
|
@tracks
|
50
58
|
end
|
51
59
|
|
60
|
+
def play_count
|
61
|
+
tracks.map(&:play_count).sum
|
62
|
+
end
|
63
|
+
|
52
64
|
end
|
53
65
|
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.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todd Gehman
|
@@ -140,6 +140,7 @@ licenses:
|
|
140
140
|
metadata:
|
141
141
|
homepage_uri: https://github.com/pugetive/apple_music_library
|
142
142
|
source_code_uri: https://github.com/pugetive/apple_music_library
|
143
|
+
changelog_uri: https://github.com/pugetive/apple_music_library/blob/main/CHANGELOG.md
|
143
144
|
post_install_message:
|
144
145
|
rdoc_options: []
|
145
146
|
require_paths:
|