Is there any working example how to modify user playlists from command line?

I'm trying to write a simple script that will make a playlist and add all tracks by specific artist (from all albums) to this playlist.

For my code I'm using ruby and rspotify library, and it should be generally something like:

 

 

playlist = RSpotify::User.find('depesz').playlists.select { |x| x.name == "F.O.O.L" }

albums = RSpotify::Artist.search('F.O.O.L').first.albums(limit: 33)

playlist.add_tracks!( albums.first.tracks )

 

 

 but I'm getting errors related to oAuth.

I tried to understand it, but I can't. Examples I found require setting webserver, and some app, which I don't need - I just want to be able to write a tool that does things to my playlists.

Does anyone in here have a working example of what I need to do to get my script to work?

I guess my problem is not understanding the oAuth and how to use it in non-web environment, but perhaps it is something that can be worked around, and I just can't figure out how?

Child Item
Child Item
Child Item

Accepted answers

All comments

Child Item
Child Item