⚠️ spotify no longer allows third-party logins via credentials⚠️
⚠️ this project is non-functional until further notice⚠️
create an issue if you want to see this project's functionality restored via access token logins, as otherwise it will remain low on my priority list
spotifm streams your spotify music over the internet using icecast2 and spawns a rest api
note: spotifm only works with spotify premium accounts
there is an included:
- irc bot which can be used to control the radio through irc commands
- discord bot which streams the radio to a voice channel, and can be controlled through text channels
the commands for both the irc and discord bot:
!np
!prev
!next
- get the now playing, previous, and next track in the playlist!play <query>
- play this song on the stream immediately!queue <query>
- queue this song to be played next!search <query>
- get top 5 search results for your query!shuffle
- shuffle the playlist
edit config.json.example
and rename it to config.json
"user": "your@email.com",
"pass": "yourpass1",
"uris": [
"spotify:playlist:2WvtFSAkmcABdm3iAvYwXk"
],
"elevenlabs": {
"key": "",
"voice": ""
}
user
is your email
pass
is your password
uris
is a list of spotify URIs (track, album or playlist) to play once started (spotify:track:<ID>
or spotify:album:<ID>
or spotify:playlist:<ID>
)
optionally:
elevenlabs
contains your elevenlabs API key, and the voice ID of the voice you want to use for TTS
spotifm can announce the name of the song before it plays, as well as periodically play radio station bumpers of your choosing, configured as follows:
"announce": {
"song": {
"enable": false,
"espeak": {
"gap": 10,
"speed": 150,
"pitch": 50,
"voice": "en-us",
"amplitude": 100
}
},
"bumper": {
"enable": false,
"freq": 20,
"tags": [
"you are listening to my radio"
],
"espeak": {
"gap": 10,
"speed": 120,
"pitch": 50,
"voice": "en-us",
"amplitude": 100
}
}
}
they are disabled by default
freq
is how often to play a bumper
see espeak
manual for description of gap
, speed
, pitch
, voice
and amplitude
docker compose run builder
note: depending on your docker version, you may need to use
docker-compose
instead ofdocker compose
docker compose up -d --force-recreate streamer
icecast2 will become available on port
8000
, listen to your radio athttp://<your-ip-address>:8000/listen
spotifm will spawn a rest api on port
9090
, issue api calls athttp://<your-ip-address>:9090/...
make sure to edit ircbot.json.example
and rename it to ircbot.json
, then
docker compose up -d ircbot
make sure to edit discordbot.json.example
and rename it to discordbot.json
, then
docker compose up -d discordbot
all return (example):
{
"id": "6bu8npt0GdVeESCM7K4The",
"rid": 1676115018281,
"track": "Speak Up",
"artists": [
"Freddie Dredd"
]
}
or { "error": "<error msg>"}
returns (example):
[
{
"id": "6bu8npt0GdVeESCM7K4The",
"rid": 1676118353658,
"track": "Speak Up",
"artists": [
"Freddie Dredd"
]
},
...
]
returns (example):
[
{
"album": { ... },
"artists": [ ... ],
"available_markets": [ ... ],
"disc_number": 1,
"duration_ms": 122331,
"explicit": true,
"external_ids": { ... },
"external_urls": { ... },
"href": "https://api.spotify.com/v1/tracks/2nzjXDv6OuRHrHKhfhfB98",
"id": "2nzjXDv6OuRHrHKhfhfB98",
"is_local": false,
"name": "Low Key",
"popularity": 62,
"preview_url": "https://p.scdn.co/mp3-preview/c4008f1cb619949d448818891c5839404a0d53ad?cid=65b708073fc0480ea92a077233ca87bd",
"track_number": 3
},
...
]
or { "error": "<error msg>"}
takes post fields enable
, tag
, freq
, speed
, amplitude
, pitch
, gap
, voice
and updates the running instance of your config
if tag
is supplied, it is appended to your current tags
clears out your tags
all above return (example):
{
"idx": 1,
"enable": true,
"tags": [
...
],
"freq": 5,
"espeak": {
"speed": 160,
"amplitude": 60,
"pitch": 1,
"gap": 5,
"voice": "en-us"
}
}
takes post fields enable
, speed
, amplitude
, pitch
, gap
, voice
and updates running instance of your config
all above return (example):
{
"enable": false,
"espeak": {
"speed": 170,
"amplitude": 100,
"pitch": 50,
"gap": 10,
"voice": "en-us"
}
}
this will use espeak, or the elevenlabs API to speak your TEXT
it will return:
{
"text": <TEXT>
}