Class: Spotify::Music::Importer::SpotifyLibrary
- Inherits:
-
Object
- Object
- Spotify::Music::Importer::SpotifyLibrary
- Defined in:
- lib/spotify/music/importer/spotify_library.rb
Instance Method Summary collapse
- #find_and_add_to_library(record, results, index) ⇒ Object
-
#initialize(client) ⇒ SpotifyLibrary
constructor
A new instance of SpotifyLibrary.
- #missing ⇒ Object
Constructor Details
#initialize(client) ⇒ SpotifyLibrary
Returns a new instance of SpotifyLibrary.
6 7 8 9 |
# File 'lib/spotify/music/importer/spotify_library.rb', line 6 def initialize(client) @client = client @missing = [] end |
Instance Method Details
#find_and_add_to_library(record, results, index) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/spotify/music/importer/spotify_library.rb', line 11 def find_and_add_to_library(record, results, index) match = CollectionMatch.new(record, results) if results.found_match? print "[#{index+1}] " if match.full_match print results.to_s.green add_to_library(results.id) elsif match.name_match print results.to_s.yellow add_to_library(results.id) elsif match.album_match print results.to_s.colorize(:orange) add_to_library(results.id) puts "Collection Record: #{record}" else print results add_to_library(results.id) puts "Collection Record: #{record}" end else puts "not found - #{record}".red @missing << record end end |
#missing ⇒ Object
37 38 39 |
# File 'lib/spotify/music/importer/spotify_library.rb', line 37 def missing @missing end |