Python Rainwave Client
This is a Python client library for Rainwave. The source is available at https://github.com/williamjacksn/python-rainwave-client.
Installation
Install using pip
:
pip install python-rainwave-client
Getting Started
Begin by importing the library and instantiating a RainwaveClient
object:
>>> from rainwaveclient import RainwaveClient
>>> rw = RainwaveClient()
Obtain your Rainwave User ID and API key from https://rainwave.cc/keys/ and set
them in the RainwaveClient
object:
>>> rw.user_id = 5049
>>> rw.key = 'abcde12345'
>>> rw
RainwaveClient(user_id=5049, key='abcde12345')
From the RainwaveClient
object you can get a list of channels
operating on the network:
>>> rw.channels
[<RainwaveChannel [Game]>, <RainwaveChannel [OCRemix]>, <RainwaveChannel [Covers]>, <RainwaveChannel [Chiptunes]>, <RainwaveChannel [All]>]
>>> ocr = rw.channels[1]
>>> ocr.key
'ocremix'
>>> ocr.url
'https://rainwave.cc/ocremix/'
>>> ocr.mp3_stream
'http://ocrstream.rainwave.cc:8000/ocremix.mp3?5049:abcde12345'
See what is currently playing:
>>> ocr.schedule_current.songs[0]
<RainwaveCandidate [OCRemix // Final Fantasy VII: Voices of the Lifestream // Black Wing Metamorphosis // bLiNd, Fishy, Jillian Aversa, Sixto Sounds, Steffan Andrews, Suzumebachi, tefnek]>
>>> # or ocr.schedule_current.song
Give the currently playing song a rating and mark it as a favourite:
>>> ocr.schedule_current.songs[0].rating = 4.5
>>> ocr.schedule_current.songs[0].fave = True
See what songs are in the current election:
>>> ocr.schedule_next[0].candidates
[<RainwaveCandidate [OCRemix // Castlevania II: Simon's Quest // Simon's Symphony // Jovette Rivera]>,
<RainwaveCandidate [OCRemix // Sonic the Hedgehog: The Sound of Speed // Final Progression // Jewbei]>,
<RainwaveCandidate [OCRemix // Friday the 13th // Panic at Camp Crystal // Ghetto Lee Lewis]>]
Vote for Final Progression:
>>> ocr.schedule_next[0].candidates[1].vote()