beets based mitm of your torrent client and music player


Keywords
automation, beets, docker, flask, htpc, plex, self-hosted, torrent, transmission, vue
License
MIT
Install
pip install betanin==0.5.6

Documentation

beets based man-in-the-middle of your torrent client and music player


installation

$ pip install --user betanin

usage

$ betanin [--port=<port>]

docker

image

docker pull sentriz/betanin

volumes

/root/.local/share/betanin/ for a persistent database
/root/.config/betanin/ for a persistent betanin config
/root/.config/beets/ for a persistent beets home (point this to your current beets home if you have one)
/music/ so beets can access your music
/downloads/ so beets can access your downloads

compose
betanin:
    image: sentriz/betanin
    ports:
    - 9393:9393
    restart: unless-stopped
    volumes:
    - ${DATA}/betanin/data:/root/.local/share/betanin/
    - ${DATA}/betanin/config:/root/.config/betanin/
    - ${DATA}/betanin/beets:/root/.config/beets/
    - ${MEDIA}/music:/music/
    - ${MEDIA}/downloads:/downloads/

transmission

settings.json (example excerpt)
...
"script-torrent-done-enabled": true,
"script-torrent-done-filename": "/scripts/done",
...
done script
#!/bin/sh


curl \
    --request POST \
    --data-urlencode "path=/downloads/complete/beets" \
    --data-urlencode "name=$TR_TORRENT_NAME" \
    --user 'user:password' \
    "http://betanin:9393/api/torrents/$TR_TORRENT_HASH"
docker compose (excerpt)
volumes:
- ${DATA}/transmission/config:/config
- ${DATA}/transmission/scripts:/scripts
- ${MEDIA}/download:/downloads

developing

working on the backend

there is not much else to do, write your code, python -m betanin.entry_betanin, kill it, write your code, etc. the webserver will be available at http://localhost:9393/. the static frontend is served at /, and the api is served at /api. (there is a swagger ui there too)

working on the frontend

start the backend with python -m betanin.entry_betanin, but don't use the static frontend served at http://localhost:9393/. Instead, in a new shell, do npm --prefix client/ run serve and use the frontend served at http://localhost:8081/. it will look for a backend listening on port 9393 locally. after that you can edit anything in client/src, it will be linted and automatically reflected in your web browser.