Musical web UI for yt-dlp: downloads, adds ID3, parses Genius lyrics
Find a file
2024-05-28 13:52:16 +04:00
backend Refactor: unify YDL object and proxy cfg field 2024-05-28 13:21:23 +04:00
frontend CSS: fix <pre> wrap, add dark theme, colored log 2024-05-28 13:52:16 +04:00
.gitignore Config, cookies 2024-05-03 20:57:20 +04:00
Caddyfile Add dev server Caddyfile 2024-05-28 10:33:42 +04:00
LICENSE Edit license notice template 2024-05-09 20:45:20 +04:00
Makefile Makefile: clean 2024-05-28 11:10:38 +04:00
pyproject.toml Move Python configs to root 2024-04-28 13:14:12 +04:00
README.md Note about track number 2024-05-24 22:01:07 +04:00
requirements.txt Update deps 2024-05-28 09:03:26 +04:00

musicdlp

Web UI for yt-dlp intended to be hosted on a music server. Downloads playlists and separate tracks from YouTube, YT Music and Yandex Music, converts to MP3, adds ID3 tags, searches for lyrics on Genius and writes to ID3.

Written in Python, because creating an interpreter process on each yt-dlp invoke is unreasonable.

Example configs

/home/mdlp/src contains cloned git repo, /home/mdlp/venv is a python venv.

Tip: to add track number to filenames, set TRACK_FILE_TMPL="%(track_number)d %(track)S.%(ext)s"

nginx

server {
    listen 443 ssl;
    listen [::]:443 ssl;

    server_name mdlp.domain.tld;
    root /home/mdlp/src/frontend;

    # https://ssl-config.mozilla.org/#server=nginx&version=1.26.0&config=modern&openssl=1.1.1k&guideline=5.7
    #ssl_certificate         /etc/letsencrypt/live/domain.tld/fullchain.pem
    #ssl_certificate_key     /etc/letsencrypt/live/domain.tld/privkey.pem
    #ssl_trusted_certificate /etc/letsencrypt/live/domain.tld/chain.pem
    #...

    location /ws {
        proxy_pass http://127.0.0.1:4009;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $host;
    }
}

openrc

#!/sbin/openrc-run

export HOST=127.0.0.1
export PORT=4009
export YT_PROXY="http://user:pass@host:port"

name=$RC_SVCNAME
command="/home/mdlp/venv/bin/python3"
command_args="/home/mdlp/src/backend/main.py"
command_user="mdlp"
directory="/home/mdlp"

error_log="/var/log/$RC_SVCNAME/error.log"

pidfile="/run/$RC_SVCNAME/$RC_SVCNAME.pid"
command_background="yes"

depend() {
    need net
}

start_pre() {
    checkpath --directory --owner $command_user:$command_user --mode 0775 \
        /run/$RC_SVCNAME /var/log/$RC_SVCNAME
}