class Song
- Song
- Reference
- Object
Defined in:
glue/song.crConstructors
Instance Method Summary
- #filename : String
-
#grab_it(url : String | Nil = nil, flags = {} of String => String)
Find, downloads, and tags the mp3 song that this class represents.
-
#organize_it
Will organize the song into the user's provided music directory in the user's provided structure Must be called AFTER the song has been downloaded.
-
#provide_client_keys(client_id : String, client_secret : String) : self
Provide spotify client keys.
-
#provide_metadata(metadata : JSON::Any) : self
Provide metadata so that it doesn't have to find it.
-
#provide_spotify(spotify : SpotifySearcher) : self
Provide an already authenticated
SpotifySearcher
class.
Constructor Detail
Instance Method Detail
Find, downloads, and tags the mp3 song that this class represents. Optionally takes a youtube URL to download from
Song.new("Bohemian Rhapsody", "Queen").grab_it
Will organize the song into the user's provided music directory in the user's provided structure Must be called AFTER the song has been downloaded.
s = Song.new("Bohemian Rhapsody", "Queen").grab_it
s.organize_it()
# With
# directory_pattern = "{artist}/{album}"
# filename_pattern = "{track_number} - {title}"
# Mp3 will be moved to
# /home/cooper/Music/Queen/A Night At The Opera/1 - Bohemian Rhapsody.mp3
Provide spotify client keys. Must be called if provide_metadata and provide_spotify are not called.
Song.new(...).provide_client_keys("XXXXXXXXXX", "XXXXXXXXX").grab_it
Provide metadata so that it doesn't have to find it. Useful for overwriting metadata. Must be called if provide_client_keys and provide_spotify are not called.
Song.new(...).provide_metadata(...).grab_it
Provide an already authenticated SpotifySearcher
class. Useful to avoid
authenticating over and over again. Must be called if provide_metadata and
provide_client_keys are not called.
Song.new(...).provide_spotify(SpotifySearcher.new
.authenticate("XXXXXXXXXX", "XXXXXXXXXXX")).grab_it