Giter Club home page Giter Club logo

botamusique's Introduction

botamusique

botamusique

Botamusique is a Mumble music bot. Predicted functionalities will be those people would expect from any classic music player.

Build Status

Features

  1. Support multiple music sources:
    • Music in local folders (which can be uploaded through the web interface).
    • Youtube/Soundcloud URLs and playlists (everything supported by youtube-dl).
    • Radio stations from URL and http://www.radio-browser.info API.
  2. Modern and powerful web remote control interface. Powered by Flask. Which supports:
    • Playlist management.
    • Music library management, including uploading, browsing all files and edit tags, etc.
  3. Powerful command system. Commands and words the bot says are fully customizable. Support partial-match for commands.
  4. Ducking. The bot would automatically lower its volume if people are talking.

Screenshots

botamusique in Mumble channel

botamusique web interface


Quick Start Guide

  1. Installation
  2. Configuration
  3. Run the bot
  4. Operate the bot
  5. Update
  6. Known issues
  7. Contributors

Installation

Dependencies

  1. Install python3.
  2. Install Opus Codec (which should be already installed if you installed Mumble or Murmur, or you may try to install opus-tools with your package manager).
  3. Install ffmpeg. If ffmpeg isn't in your package manager, you may need to find another source. I personally use this repository on my raspberry.

Install botamusique

Stable release (recommended)

This is the tested stable version, with auto-update support. To install the stable release, run these lines:

curl -Lo botamusique.tar.gz http://packages.azlux.fr/botamusique/sources.tar.gz
tar -xzf botamusique.tar.gz
cd botamusique
python3 -m venv venv
venv/bin/pip install wheel
venv/bin/pip install -r requirements.txt

Work-in-progress version (from the master branch of this repo)

We will test new features in this branch, maybe sometimes post some hotfixes. Please be noted that this version has no auto-update support. If you want to install this version, you need to have Git installed. We recommend you to install the stable version above, except you'd like to try out our half-baked features and put up with bugs amid them.

git clone https://github.com/azlux/botamusique.git
cd botamusique
python3 -m venv venv
venv/bin/pip install wheel
venv/bin/pip install -r requirements.txt
cd web
npm install
npm run build

Configuration

Please copy configuration.example.ini into configuration.ini, follow the instructions in the file and uncomment options you would like to modify. Please DO NOT MODIFY configuration.default.ini, since options undefined in configuration.ini will fall back into configuration.default.ini. This file will be constantly overridden in each update.

We list some basic settings for you to quickly get things working.

Basic settings

  1. Usually, the first thing is to set the Murmur server you'd like the bot to connect to. You may also specify which channel the bot stays, and tokens used by the bot.
[server]
host = 127.0.0.1
port = 64738
  1. You need to specify a folder that stores your music files. The bot will look for music and upload files into that folder. You also need to specify a temporary folder to store music files download from URLs.
[bot]
music_folder = music_folder/
tmp_folder = /tmp/
  1. Web interface is disabled by default for performance and security reasons. But it is extremely powerful, so we encourage you to have a try. To enable it, set
[webinterface]
enabled = True

Default binding address is

listening_addr = 127.0.0.1
listening_port = 8181

You can access the web interface through http://127.0.0.1:8181 if you keep it unchanged.

Note: Listening to address 127.0.0.1 will only accept requests from localhost. If you would like to connect from the public internet, you need to set it to 0.0.0.0, and set up username and password to impose access control. In addition, if the bot is behind a router, you should also properly set forwarding rules in you NAT configuration to forward requests to the bot.

  1. Generate a certificate (Optional, but recommended)

By default, murmur server uses certificates to identify users. Without a valid certificate, you wouldn't able to register the bot into your Murmur server. Some server even refused users without a certificate. Therefore, it is recommended to generate a certificate for the bot. If you have a certificate (for say, botmusique.pem in the folder of the bot), you can specify its location in

[server]
certificate=botamusique.pem

If you don't have a certificate, you may generate one by: openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout botamusique.pem -out botamusique.pem -subj "/CN=botamusique"

Sections explained

  • server: configuration about the server. Will be overridden by the ./mumbleBot.py parameters.
  • bot: basic configuration of the bot, eg. name, comment, folder, default volume, etc.
  • webinterface: basic configuration about the web interface.
  • commands: you can customize the command you want for each action (eg. put help = helpme , the bot will respond to !helpme)
  • radio: a list of default radio (eg. play a jazz radio with the command !radio jazz)
  • strings: you can customize all words the bot can say.
  • debug: option to activate ffmpeg or pymumble debug. (Can be very verbose)

Run the bot

If you have set up everything in your configuration.ini, you can venv/bin/python mumbleBot.py --config configuration.ini

Or you can venv/bin/python mumbleBot.py -s HOST -u BOTNAME -P PASSWORD -p PORT -c CHANNEL -C /path/to/botamusique.pem

If you want information about auto-starting and auto-restarting of the bot, you can check out the wiki page Run botamusique as a daemon In the background.

For the detailed manual of using botamusique, please see the wiki.

Operate the bot

You can control the bot by both commands sent by text message and the web interface.

By default, all commands start with !. You can type !help in the text message to see the full list of commands supported, or see the examples on the wiki page.

The web interface can be used if you'd like an intuitive way of interacting with the bot. Through it is fairly straightforward, a walk-through can be found on the wiki page.

Update

If you enable audo_check_update, the bot will check for updates every time it starts. If you are using the recommended install, you can send !update to the bot (command by default).

If you are using git, you need to update manually:

git pull --all
git submodule update
venv/bin/pip install --upgrade -r requirements.txt

Known issues

  1. During installation, you may encounter the following error:
ImportError: libtiff.so.5: cannot open shared object file: No such file or directory

You need to install a missing library: apt install libtiff5

  1. In the beginning, you may encounter the following error even if you have installed all requirements:
Exception: Could not find opus library. Make sure it is installed.

You need to install the opus codec (not embedded in all system): apt install libopus0

  1. If you have a large amount of music files (>1000), it may take some time for the bot to boot, since it will build up the cache for the music library on booting. You may want to disable this auto-scanning by setting refresh_cache_on_startup=False in [bot] section and control the scanning manually by !rescan command and the Rescan Files button on the web interface.

  2. Alpine Linux requires some extra dependencies during the installation (in order to compile Pillow):

python3-dev musl-lib libmagic jpeg-dev zlib-dev gcc

For more information, see #122.

Contributors

If you want to participate, You're welcome to fork and submit pull requests (fixes and new features).

The following people joined the collaborators for a faster development, big thanks to them:

  • @TerryGeng
  • @mertkutay

Feel free to ask me if you want to help actively without using pull requests.

botamusique's People

Contributors

ajmandourah avatar arvsindrarys avatar azlux avatar bafdyce avatar bsima avatar chall8908 avatar dexgs avatar felix91gr avatar fsteffek avatar gunzinger avatar herhde avatar kagurazakanyaa avatar lartza avatar neodarz avatar seifertk avatar slipenbois avatar tainmart avatar terrygeng avatar tylervigario avatar w0rmsy avatar wildrackoon avatar

Watchers

 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.