Project

wimp

0.0
No commit activity in last 3 years
No release in over 3 years
Ruby bindings for WiMP
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.5
>= 0
>= 0
>= 0
= 1.8.0

Runtime

>= 0
>= 0
>= 0
 Project Readme

WiMP

Ruby bindings for WiMP. The library uses WiMPs internal RPC API. Take a look at the FAQ for frequently asked questions and how to port this library to any language using thrift.

Installation

$ gem install wimp

Usage

Keep in mind that you need premium acount for this to work.

WiMP.configure do |config|
  config.username = "email@example.com"
  config.password = "my-password"
end

WiMP::Track

Search

tracks = WiMP::Track.search(query, {
  limit: 10
})

WiMP::Playlist

Note that you can only read and update your own playlists, not someone else's.

Find a playlist

playlist = WiMP::Playlist.find(uuid)

Create a playlist

playlist = WiMP::Playlist.create(title)

Add tracks to playlist

status = playlist.add_tracks(tracks, {
  start_position: 1
})

Add tracks to playlist using Track#id

status = playlist.add_tracks_by_id(track_ids, {
  start_position: 1
})

Remove tracks from playlist

status = playlist.remove_tracks_by_indices(tracks)

Containers

WiMP::Track

  • title String
  • album_id Integer
  • duration Integer
  • id Integer
  • popularity Integer
  • artist WiMP::SimpleArtist
  • url String

WiMP::Playlist

  • count Integer
  • url String
  • tracks Array< WiMP::Track >
  • uuid String
  • id Integer

WiMP::SimpleArtist

  • id Integer
  • name String
  • url String

FAQ

Can I port this library to language X?

Probably. WiMP uses thrift behind the scene, which means that code for C++, C#, Erlang, Haskell, Java, Objective C/Cocoa, OCaml, Perl, PHP, Python, and Squeak can be generated. Take a look at the resources/thrift folder and the Rakefile file for more information on how this could be done.

Here is a good thrift tutorial that explains the basics.

Can I stream music using this library?

The WiMP API has support for streaming, but I've chosen not to include those methods.

Where is the rest of the implementation?

Take a look at the lib/gen folder for more, undocumented code. Code exists for all 50 some methods in the thrift directory, but only a few are ported to a Ruby-friendly syntax and documented above. You're more than welcome to help me migrate all these methods.

Some methods from the offical API isn't ported to thrift. You'll find a list of these in the resources/skipped-methods.md file.

I'm get an Thrift::ApplicationException error, why?

The Thrift::ApplicationException error indicates that the returning data from WiMP isn't what we think it is. It's usually caused by invalid data being passed to thrift.

In other words; check the data being passed from this library. Is it correct?

Notes

  1. Not all methods existing in the offical API are documented above, but the code for all of them exists. Navigate the lib folder for more information.
  2. The first request to the API will be slower than the rest. That's because a session is created.
  3. None of the credentials in this project are my own. They're only created to be used in the specs. They might therefore already be expired when you read this.
  4. This library has been created for educational purposes. You shouldn't use it without first consulting WiMP.

Contributing

  1. Fork it ( http://github.com/oleander/wimp-rb/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request