apple_music_library 0.13.0 → 0.14.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 +12 -0
- data/Gemfile.lock +1 -1
- data/README.md +7 -0
- data/lib/apple_music_library/artist.rb +1 -1
- data/lib/apple_music_library/century.rb +25 -0
- data/lib/apple_music_library/library.rb +8 -0
- data/lib/apple_music_library/track.rb +5 -2
- data/lib/apple_music_library/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 702e772f48f00a2a330d975bd5fa2b819fe3722168842cddc7cb49017cc7f05c
|
4
|
+
data.tar.gz: 8d153ea65affd199ab2df4e1f05784323c5fd4307391439ba6d7ed9af988a780
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c29ec02ca2fe5b18121f991fd6850799ec7916c395047eae8dbbe89c75ca823982224d352299ed4aee81d9e1ddc70000a6fe7ca926e97e70ee9a0c6d6944d033
|
7
|
+
data.tar.gz: ef204ee8dc66c2018df611bc5a54ad26029697745c1621a22dd056629c993e1f5eef72a4de4664040f9e005cbf232282b72c97de7b9de81a5d12ffb0319f747e
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,18 @@
|
|
3
3
|
## [Unreleased]
|
4
4
|
- Ability to print out playlist folder hierarchy
|
5
5
|
|
6
|
+
## 0.14.0 - 2022-04-03
|
7
|
+
### Added
|
8
|
+
- Added Century model to retrieve track and album info per century (useful if you set classical pieces to their year of authorship rather than year of release)
|
9
|
+
|
10
|
+
## 0.13.2 - 2022-03-16
|
11
|
+
### Fixed
|
12
|
+
- Fixed bug where tracks with empty artist names would throw an exception
|
13
|
+
|
14
|
+
## 0.13.1 - 2022-03-16
|
15
|
+
### Fixed
|
16
|
+
- Now strips leading/trailing whitespace from artist and track names
|
17
|
+
|
6
18
|
## 0.13.0 - 2022-03-26
|
7
19
|
### Added
|
8
20
|
- Added handling for system verses user-created playlists
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -112,6 +112,13 @@ end
|
|
112
112
|
library.decades_report
|
113
113
|
|
114
114
|
|
115
|
+
# Print a report on all centuries in the library
|
116
|
+
# This is a personal edge case for people who, like me, set the year of any classical piece to the year it was written
|
117
|
+
# rather than the year of hte recording.
|
118
|
+
# 1800's - 336 tracks on 10 albums
|
119
|
+
# 1900's - 816 tracks on 16 albums
|
120
|
+
library.decades_report
|
121
|
+
|
115
122
|
|
116
123
|
```
|
117
124
|
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`.
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require_relative 'track_collection'
|
2
|
+
|
3
|
+
module AppleMusicLibrary
|
4
|
+
class Century < TrackCollection
|
5
|
+
|
6
|
+
def self.report
|
7
|
+
self.all.sort_by{|c| c.name}.each do |century|
|
8
|
+
puts "#{century.name} - #{century.track_count} tracks on #{century.album_count} albums"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.find_or_create_for(century_name)
|
13
|
+
century_start_year = century_name.to_i - (century_name.to_i % 100)
|
14
|
+
century_stop_year = century_start_year + 99
|
15
|
+
century_name = "#{century_start_year}'s"
|
16
|
+
|
17
|
+
self.find_or_create(century_name)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.token
|
21
|
+
:century
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
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',
|
@@ -49,6 +49,9 @@ module AppleMusicLibrary
|
|
49
49
|
|
50
50
|
@decade = Decade.find_or_create_for(year_name)
|
51
51
|
@decade.add_track(self)
|
52
|
+
|
53
|
+
@century = Century.find_or_create_for(year_name)
|
54
|
+
@century.add_track(self)
|
52
55
|
end
|
53
56
|
|
54
57
|
@artist.add_track(self)
|
@@ -105,7 +108,7 @@ module AppleMusicLibrary
|
|
105
108
|
|
106
109
|
ATTRIBUTES.each do |track_attribute|
|
107
110
|
define_method(track_attribute.to_s.snakecase) do
|
108
|
-
@info[track_attribute]
|
111
|
+
@info[track_attribute].class.name == 'String' ? @info[track_attribute].strip : @info[track_attribute]
|
109
112
|
end
|
110
113
|
end
|
111
114
|
|
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.
|
4
|
+
version: 0.14.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
|
11
|
+
date: 2022-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: awesome_print
|
@@ -126,6 +126,7 @@ files:
|
|
126
126
|
- lib/apple_music_library.rb
|
127
127
|
- lib/apple_music_library/album.rb
|
128
128
|
- lib/apple_music_library/artist.rb
|
129
|
+
- lib/apple_music_library/century.rb
|
129
130
|
- lib/apple_music_library/decade.rb
|
130
131
|
- lib/apple_music_library/genre.rb
|
131
132
|
- lib/apple_music_library/library.rb
|