Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oleander/wimp-rb
Ruby bindings for WiMP
https://github.com/oleander/wimp-rb
Last synced: about 2 months ago
JSON representation
Ruby bindings for WiMP
- Host: GitHub
- URL: https://github.com/oleander/wimp-rb
- Owner: oleander
- License: mit
- Created: 2014-03-17T21:52:41.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-03-18T22:02:53.000Z (almost 11 years ago)
- Last Synced: 2024-10-29T02:48:59.613Z (2 months ago)
- Language: Ruby
- Size: 327 KB
- Stars: 7
- Watchers: 5
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# WiMP
Ruby bindings for [WiMP](http://wimpmusic.com). The library uses WiMPs
internal RPC API. Take a look at the [FAQ](#faq) for frequently asked
questions and how to port this library to any language using
[thrift](http://thrift.apache.org/).## Installation
```
$ gem install wimp
```## Usage
Keep in mind that you need premium acount for this to work.
``` ruby
WiMP.configure do |config|
config.username = "[email protected]"
config.password = "my-password"
end
```### WiMP::Track
#### Search
``` ruby
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
``` ruby
playlist = WiMP::Playlist.find(uuid)
```#### Create a playlist
``` ruby
playlist = WiMP::Playlist.create(title)
```#### Add tracks to playlist
``` ruby
status = playlist.add_tracks(tracks, {
start_position: 1
})
```#### Add tracks to playlist using Track#id
``` ruby
status = playlist.add_tracks_by_id(track_ids, {
start_position: 1
})
```#### Remove tracks from playlist
``` ruby
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](http://thrift.apache.org/) 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](http://diwakergupta.github.io/thrift-missing-guide/)
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