apple_music_library 0.13.2 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 50f3e5425e1ef5cd751ab85f45593aaa1bca9122e886d6f12780dfb503db5ad6
4
- data.tar.gz: d817e40ffb7df005b3169b7ef9ac8e49a917312313bec4fcca7b31c91ac4ad1b
3
+ metadata.gz: 702e772f48f00a2a330d975bd5fa2b819fe3722168842cddc7cb49017cc7f05c
4
+ data.tar.gz: 8d153ea65affd199ab2df4e1f05784323c5fd4307391439ba6d7ed9af988a780
5
5
  SHA512:
6
- metadata.gz: 7db558674bc78b1fc102be423492132f28fc6922b88204a7a702474f8a7161e1541a648f75496ceb4721c320b1bb5e850e62562b8a00d8d74aaf95d8f37776bd
7
- data.tar.gz: 2d14b9da9c7f61cfeefa4e96a1d43ca7f3831135a187e2a39b60f832896209eff9b2d23c818e9ef0f5c24b458ba1a6a27f185aad33df6e6b86fd7e3a26191af3
6
+ metadata.gz: c29ec02ca2fe5b18121f991fd6850799ec7916c395047eae8dbbe89c75ca823982224d352299ed4aee81d9e1ddc70000a6fe7ca926e97e70ee9a0c6d6944d033
7
+ data.tar.gz: ef204ee8dc66c2018df611bc5a54ad26029697745c1621a22dd056629c993e1f5eef72a4de4664040f9e005cbf232282b72c97de7b9de81a5d12ffb0319f747e
data/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
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
+
6
10
  ## 0.13.2 - 2022-03-16
7
11
  ### Fixed
8
12
  - Fixed bug where tracks with empty artist names would throw an exception
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- apple_music_library (0.13.2)
4
+ apple_music_library (0.14.0)
5
5
  facets (~> 3.1)
6
6
  plist (~> 3.6)
7
7
 
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
@@ -91,6 +91,14 @@ module AppleMusicLibrary
91
91
  Decade.report
92
92
  end
93
93
 
94
+ def centuries
95
+ @centuries ||= Century.all
96
+ end
97
+
98
+ def centuries_report
99
+ Century.report
100
+ end
101
+
94
102
  def valid?
95
103
  has_tracks?
96
104
  end
@@ -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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AppleMusicLibrary
4
- VERSION = "0.13.2"
4
+ VERSION = "0.14.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.13.2
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-26 00:00:00.000000000 Z
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