Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/osteenbergen/slackify
Slack bot to play/queue Spotify
https://github.com/osteenbergen/slackify
Last synced: 3 months ago
JSON representation
Slack bot to play/queue Spotify
- Host: GitHub
- URL: https://github.com/osteenbergen/slackify
- Owner: osteenbergen
- Created: 2015-10-19T05:48:11.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-06-01T07:11:06.000Z (over 7 years ago)
- Last Synced: 2024-05-02T12:38:35.564Z (7 months ago)
- Language: Python
- Size: 36.1 KB
- Stars: 13
- Watchers: 4
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# slackify
Slack bot to play/queue SpotifyUsed&Tested daily in our office with a simple setup. Install on a box connected to speakers and enjoy.
## Features
- Searching spotify
- Playing songs
- Queueing songs
- Random song from queue history if queue is empty## Settings
Create a file called ```slackbot_settings.py``` with the following contents
```python
# Slackbot settings
API_TOKEN = ''
# Force bot to only work on a single channel
FIXED_CHANNEL = 'music'
# Spotify settings
SPOTIFY_USERNAME = ''
SPOTIFY_PASSWORD = ''
SPOTIFY_MARKET = 'NL'# Folder with the slack commands
PLUGINS = ['plugins']
```## Installation
### Ubuntu
#### Slack
Install PIP package for python (lins05/slackbot)
```
sudo apt-get install python-pip
sudo pip install -r requirements
```
##### Generate the slack api tokenFirst you need to get the slack api token for your bot. You have two options:
1. If you use a [bot user integration](https://api.slack.com/bot-users) of slack, you can get the api token on the integration page.
2. If you use a real slack user, you can generate an api token on [slack web api page](https://api.slack.com/web).##### Configure the api token
Then you need to configure the `API_TOKEN` in the python module `slackbot_settings.py`.
#### Spotify
Follow pyspotify installation on https://pyspotify.mopidy.com/en/latest/installation/or in short:
```
wget -q -O - https://apt.mopidy.com/mopidy.gpg | sudo apt-key add -
sudo wget -q -O /etc/apt/sources.list.d/mopidy.list https://apt.mopidy.com/jessie.list
sudo apt-get update
sudo apt-get install python-spotify
```Get a binary spotify application key and store it in the main folder: https://devaccount.spotify.com/my-account/keys/
Finally install the correct audio driver:
```
sudo apt-get install python-alsaaudio
```### OSX
Follow instructions for Ubuntu and read the source websites for the spotify python library.
The audio driver for OSX is PyAudio:
```
pip install pyaudio
```OSX should be detected and use this library, although this is untested
## Commands
### Play
To play a song
```
@slackify: play
```
To pause or continue
```
@slackify: pause
@slackify: play
```
To stop playing
```
@slackify: stop
```### Search
```
@slackify: search
```
To play a song from a search result use:
```
@slackify: play
```
Search results are stored per user, you can only play from your own search result### Queueing
```
@slackify: queue
```
Or using the search result
```
@slackify: queue
```
Skip your song in the queue
```
@slackify: next
```
Remove a song from the queue
```
@slackify: remove
```### Related
When a song is playing you can query related artists and their top songs
```
@slackify: related
```
Now you can play/queue the result like a normal searchBy default the player will continue playing songs you queued before (random mode).
You can however toggle to related mode. Now the player will pick a random related artist
and play one of its top tracks.To view the current mode
```
@slackify: mode
```
Change the mode:
```
@slackify: mode related
@slackify: mode random
```### Album Art
To show or hide album art when a new song starts
```
@slackify: hide album art
@slackify: show album art
```### Other
A simple command overview
```
@slackify: help
```Sometimes a recently joined user can't use the bot, a reconnect can solve this issue.
```
@slackify: reconnect
```## TODO:
- Player controls (planned)
- ```@slackify: volume ```: Change the volume
- Voting (planned)
- ```@slackify: vote ```: Remove a song someone queued
- ```@slackify: vote next```: Vote to skip current song
- Admin (future)
- Configuration file should list one or more admins
- ```@slackify: admin add ```: Add user as admin
- ```@slackify: admin remove ```: Remove user as admin