Sha256: 5944374256e8753654a871827d7978705e5bc43992891f7e978f981c836b482a
Contents?: true
Size: 649 Bytes
Versions: 2
Compression:
Stored size: 649 Bytes
Contents
require "rspotify" module SpotifyOsxController class Search def initialize (parameters = {}) @track = parameters[:track] @artist = parameters[:artist] @album = parameters[:album] @query = construct_query @results = run_query end def any? @results.any? end def first @results.first end private def run_query () if !@track RSpotify::Album.search @query else RSpotify::Track.search @query end end def construct_query query = "" query += "artist:#{@artist} " if @artist query += "track:#{@track} " if @track query += "album:#{@album}" if @album query end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
spotify_osx_controller-2.0.3 | lib/spotify_osx_controller/search.rb |
spotify_osx_controller-2.0.2 | lib/spotify_osx_controller/search.rb |