Code Monkey home page Code Monkey logo

radioslack's Introduction

RS: Radio Slack

This is a collaborative jukebox for Slack built with Elixir.

How it works

Basics

This repository contains the code for a webserver that has 2 main endpoints:

  • POST /api receives requests from Slack and allows controlling the player (starting, stopping, adding tracks)
  • GET /stream returns an audio stream that can be opened in your media player or browser

Slack Integration

You need to add a "Slash Command" integration, with such settings:

  • Command: /radio
  • URL: http://radio.example.com/api
  • Method: POST
  • Token: Do not edit (but keep the value for the SLACK_TOKEN env var)
  • Customize Name: Radio
  • Description: Play YouTube or SoundCloud tracks
  • Usage Hints: [ status | playlist | add <url> | help ]

Usage

In Slack:

  • /radio status​ - displays the player status
  • /radio playlist - displays the tracks in the playlist
  • /radio add <url>​ - adds a new track to the playlist (YouTube or SoundCloud links)
  • /radio start - starts the player
  • /radio stop - stops the player
  • /radio help - displays the help ​

Audio Stream

You can access the audio stream at $HOSTNAME/stream (http://localhost:4000/stream by default).
Most the players accept to open such a stream (it works with VLC or iTunes or even in your browser).

Requirements

  1. Erlang/OTP and Elixir (obviously)

    Check http://elixir-lang.org/install.html

  2. ffmpeg for audio transcoding

    $ sudo apt-get install ffmpeg
    
  3. goon (for Porcelain)

    Download the binary from the releases page and put it somewhere in your $PATH (e.g. in /usr/local/bin)

Installation

$ git clone https://github.com/maxdec/radioslack
$ cd radioslack
$ mix deps.get compile
$ SLACK_TOKEN=123 SOUNDCLOUD_CLIENT_ID=456 mix run --no-halt

Now you have the radio server running at http://localhost:4000.

Environment Variables

You can configure the following environment variables:

PORT - Port for the server (Default: "4000")
HOSTNAME - The hostname to display in the links (Defaults: "http://localhost:4000")
SLACK_TOKEN - The verification token that is sent by Slack "Slash Commands" (Defaults: "123")
SOUNDCOUD_CLIENT_ID - SoundCloud API Client ID, required for SouldCloud tracks (Defaults: nil)

/!\ Those variables need to be set at compile time (not runtime).

ToDos

  • Improve support for YouTube protected videos
  • Improve Slack messages
  • Add "voting" feature to skip the current track
  • Add on-disk persistence for the playlist (so it can be restored after restarting the app)
  • Add history (past tracks)
  • Add some track properties (owner, duration)
  • Add small HTML5 webplayer?

radioslack's People

Contributors

maxdec avatar

Watchers

mntz avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.