Music Downlobader

by reejit

GitHub Readme.md

🎶 Real Music Bot (beta) 🎶

Control your speakers with Telegram and play music from YouTube

What is it?

If you've ever used Discord, you've probably heard of music bots that play music for you. All you had to do was just type "-p <track_name>" to listen to your favorite song. I also liked it, so I made the real one!
This is a kind of addition to the awesome Music Player Daemon. This script runs as a service on Raspberry Pi and allows you to play music from YouTube and control playback using Telegram.

heroku.com/deploy

Features

  • Search for music simply by sending a title...

Screenshot
  • ...or link to a YouTube video

Screenshot
  • Use the search provided by @vid bot

Screenshot
  • Fully working queue

Screenshot
  • Turn on your favorite radio

Screenshot
  • Search for song lyrics

Screenshot
  • Protect the bot from unauthorized users

Screenshot

List of available commands:

  • /s - Skips the currently playing song
  • /stop - Stops playback and clears the queue
  • /q - Shows current queue
  • /p - Pauses playback
  • /v - Shows current volume
  • /v +10 - Changes current volume
  • /v 50 - Sets volume
  • /r - Searches for radio
  • /l - Searches for lyrics

Installation (Raspberry Pi / Linux)

Make sure you have Python 3.7+ installed

1. Install packages

$ sudo apt install mpd
$ pip3 install https://github.com/raitonoberu/realmusicbot/archive/master.zip

2. Change settings

Before running, you must configure your bot by editing the file ~/realmusicbot_settings.py:

$ nano ~/realmusicbot_settings.py

2.1 Set your bot token

How do I create a bot?

TOKEN = "<ENTER YOUR BOT TOKEN HERE>"

2.2 Enable additional features (optional)

# 1. Enable global keyboard
KEYBOARD = True

# 2. Allows you to search radio (/radio <station>)
RADIO_ON = True

# 3. Allows you to search lyrics (/lyrics)
# - Get your Genius API Token here:
# - https://genius.com/api-clients
GENIUS_TOKEN = ""

# 4. Bot privatization (HIGHLY RECOMMENDED)
# - Get your User ID using tg @userinfobot and add it to the list
# - https://t.me/userinfobot
# - If you leave it empty, everyone can use the bot
ALLOWED_IDS = []  # example: [123456789, 987641234]

3. Run your bot

Start MPD first:

$ sudo systemctl start mpd
$ sudo systemctl enable mpd

There are two ways to run Real Music Bot. It's recommended to run it in a terminal first to make sure that it works.

3.1 Running in a terminal

$ realmusicbot

Press Ctrl+C to close.

3.2 Running as a service

$ systemctl --user start realmusicbot
$ systemctl --user enable realmusicbot

Check logs:

$ journalctl | grep realmusicbot

Uninstallation

$ systemctl --user stop realmusicbot
$ systemctl --user disable realmusicbot
$ sudo rm ~/.config/systemd/user/realmusicbot.service
$ sudo rm -r ~/realmusicbot*
$ pip3 uninstall realmusicbot

Credits

Max Kellermann (MaxKellermann) for Music Player Daemon

FrankWang (eternnoir) for pyTelegramBotAPI

André P. Santos (andreztz) for pyradios

John W. Miller (johnwmillr) for LyricsGenius

"mps-youtube" organization for Pafy

Hitesh Kumar Saini (alexmercerind) for youtube-search-python