Package: lightsout
Lights out! Guerrilla radio! Turn that s*** up!- Rage Against the MachineLights Out is a tool to convert radio station online playlists into Spotify playlists.UsageYou can install Lights Out using pip:$ pip install lightsoutBefore you can use Lights Out for the first time, you’ll need to register an
application with Spotify. To do this, visitthe Spotify Developer portaland provide some application details. In return, you’ll get two credentials:
aSPOTIFY_CLIENT_IDand aSPOTIFY_CLIENT_SECRET.Then, create a file called.lightsoutrcin your home directory. This file
should contain your two Spotify credentials:SPOTIFY_CLIENT_ID='<your credentials here>'
SPOTIFY_CLIENT_SECRET='<your credentials here>'Substitute your own credentials as appropriate.Then, you can run Lights Out:$ lightsout -u <your Spotify username>Substitute your own spotify username as appropriate.If this is the first time you have run Lights Out, you’ll be redirected to
a browser, prompted to log into your Spotify account, and authorize your
application. This will redirect to thelocalhost:8888URL you specified
as the redirect URL for your application. Your browser won’t be able to load
this page - but that’s OK - all you need is the URL. Copy the URL, and
paste it into the console window where Lights Out is running.Once you’ve done this, Lights Out will pull down the data for the playlist,
search Spotify for tracks matching the songs on the playlist, and construct a
Spotify playlist for those songs.OptionsThere are a number of options you can also pass tolightsout:You can specify a station other thandoublejusing the-soption:$ lightsout -u <your Spotify username> -s triplejSee--helpfor the list of available channelsYou can specify the starting date/time for the playlist search with the-doption. If you specified:$ lightsout -u <your Spotify username> -d '2016-05-01T10:30:00+0800'the search would be for 10:30 AM, May 1 2016, AWST.You can specify the size of the playlist window. By default, searches will be for 24 hours,
but you can specify any length in hours with the-loption. For example:$ lightsout -u <your Spotify username> -l 4would generate a 4 hour playlist.You can specify that you want to append to an existing playlist using the-poption:$ lightsout -u <your Spotify username> -p 7wkac9khk9ssablyH9kRsCYou can find the list of existing playlists by specifyingLISTas the playlist:$ lightsout -u <your Spotify username> -p LISTIf you want to maintain a perpetual playlist (a playlist that is replaced,
rather than appended to), you can specify that playlist using the-Poption:$ lightsout -u <your Spotify username> -p 7wkac9khk9ssablyH9kRsCIf you want to update a perpetual playlist, butnotappend to an existing
playlist, you can specify-pNONEin addition to-P:$ lightsout -u <your Spotify username> -p NONE -P 7wkac9khk9ssablyH9kRsCExtending Lights OutLights out currently has support for the following stations:ABC AustraliaDouble JTriple JUnearthedABC ClassicABC Classic 2ABC JazzABC CountryABC ExtraTo add a new station station, you need to add a single function tolightsout/backends.py. This function takes two arguments: a start
datetime and an end datetime. The function must return a list of
dictionaries, each dictionary describing a single track:[
    {'track': 'Paranoid Android', 'artist': 'Radiohead', 'album': 'OK Computer'},
    {'track': 'mogwai fear satan', 'artist': 'Mogwai', 'album': 'Young Team'},
    {'track': 'Brennisteinn', 'artist': 'Sigur Rós', 'album': 'Kveikur'},
    ...
]