Identify songs in seconds right from Telegram. Not only through audio files but also via voice messages and videos!
Install python dependencies:
git clone https://github.com/Nachtalb/WhatSongIsThatBot
cd WhatSongIsThatBot
pip install -r requirements.txt
Install additional dependency songrec according to its instruction.
Copy over the sample config and adjust it's contents.
cp config.sample.json config.json
Name | Description |
---|---|
token |
Telegram bot token acquired via BotFather |
songrec |
Path to songrec's binary |
To run in webhook mode, add these additional settings to your config.json
.
{token}
will be automatically filled in.
{
// ...
"webhook": {
"port": 9001,
"host": "0.0.0.0",
"path": "{token}",
"url": "https://example.com"
}
}
Like this the hook will be started on 0.0.0.0:9001/your_token
and Telegram
connects via https://example.com/your_token
.
You can copy the wsit.service
over to /etc/systemd/system/
or
~/.config/systemd/user/
to run the bot as a service. Once you have copied
the file over, you have to adjust the paths inside it. Then:
# If it's inside ~/.config/systemd/user/ folder
systemctl --user daemon-reload # load the service
systemctl --user enable --now wsit.service # start the service on boot up and now
# Otherwise on system level
sudo systemctl daemon-reload
sudo systemctl enable --now wsit.service
There are no fancy option or whatever needed, just run the main.py file.
python main.py
I first tried to implement the whole scheme with ShazamAPI. An unofficial packaged that aims to do the same as songrec programmatically in python. But after implementing and testing it, I dropped it. Compared with songrec it's very very slow and much more inaccurate. But I left it in here as reference material.