Telegram-Spotdl-Bot/README.md

51 lines
953 B
Markdown
Raw Normal View History

2023-11-13 22:48:01 -05:00
1. Create a working dir
2023-11-13 22:49:36 -05:00
2023-11-13 22:48:01 -05:00
`mkdir /absolute/path/to/`
2023-11-13 22:50:04 -05:00
2023-11-13 22:48:01 -05:00
3. Create a python virtual environment
2023-11-13 22:49:36 -05:00
2023-11-13 22:48:01 -05:00
`python3 -m venv /absolute/path/to/venv`
2023-11-13 22:50:04 -05:00
2023-11-13 22:48:01 -05:00
5. Install depends in venv
2023-11-13 22:49:36 -05:00
2023-11-13 22:48:01 -05:00
`/absolute/path/to/venv/bin/pip install spotdl`
`/absolute/path/to/venv/bin/pip install python-telegram-bot`
2023-11-13 22:49:36 -05:00
2023-11-13 22:48:01 -05:00
script was written with version 4.14.0
`/absolute/path/to/venv/bin/pip install python-telegram-bot==4.14.0`
2023-11-13 22:49:36 -05:00
2023-11-13 22:48:01 -05:00
6. Edit start.py with correct telegram API token and change directories
start the script
`/absolute/path/to/venv/bin/python start.py`
## Unit file
```
[Unit]
Description=tg_spotdl
After=network-online.target
[Service]
User=clay
ExecStart=/absolute/path/to/venv/bin/python /absolute/path/to/start.py
Restart=always
RestartSec=5s
RuntimeMaxSec=12h
[Install]
WantedBy=multi-user.target
```
## start script
```
#!/bin/bash
/absolute/path/to/venv/bin/python /absolute/path/to/start.py
exit
```
## useful links
https://github.com/eternnoir/pyTelegramBotAPI