Skip to main content

beets based mitm of your torrent client and music player

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



betanin uses apprise for notifications. so anything supported there will work. but some include

  • email
  • discord
  • telegram
  • emby


pip install --user betanin


# start server
# a config file will be created, add your credentials to it
# start again
betanin [--host=<host>] [--port=<port>]
# ui will be available at port
# you may also use env vars instead, eg
BETANIN_PORT=4030 betanin

# optionally start cli (for db operations, debugging)
# or if docker
docker exec -it <container_id> betanin-shell




docker pull sentriz/betanin

volumes /b/.local/share/betanin/ for a persistent database

/b/.config/betanin/ for a persistent betanin config
/b/.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

  image: sentriz/betanin
    - 9393:9393
  restart: unless-stopped
    - UID=1000 # (optionally) set user id
    - GID=1000 # (optionally) set group id
    - ${DATA}/betanin/data:/b/.local/share/betanin/
    - ${DATA}/betanin/config:/b/.config/betanin/
    - ${DATA}/betanin/beets:/b/.config/beets/
    - ${MEDIA}/music:/music/
    - ${MEDIA}/downloads:/downloads/


create a script named or anything you like, and make it executable:
chmod +x

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

curl \
    --request POST \
    --data-urlencode "path=<path_to_transmission_downloads>" \
    --data-urlencode "name=$TR_TORRENT_NAME" \
    --header "X-API-Key: <your_api_key>" \
transmission docker compose (excerpt)
  - ${DATA}/transmission/config:/config
  - ${DATA}/transmission/scripts:/scripts
  - ${MEDIA}/download:/downloads


create a script named or anything you like, and make it executable:
chmod +x
you must also be using the Execute plugin, set to the Torrent Complete event

done script

curl \
    --request POST \
    --data-urlencode "path=<path_to_deluge_downloads>" \
    --data-urlencode "name=$2" \
    --header "X-API-Key: <your_api_key>" \


create a script named or anything you like, and make it executable:
chmod +x

open qbittorrent Tools > Options > check Run external program on torrent completion

set the path to the above and arguments such as

/path/to/ "%L" "%R"
done script

echo "category: $1"
echo "path: $2"

[ "$1" != "music" ] && exit

curl \
    --request POST \
    --data-urlencode "both=$2" \
    --header "X-API-Key: <your_api_key>" \

now any music downloaded to the music category will be imported by betanin


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) also see python -m
if you need to do a manual migration do env FLASK_APP='betanin.application:create' flask db migrate --directory betanin_migrations/ (then upgrades are automatically done on betanin start)

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 betanin_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 betanin_client/src, it will be linted and automatically reflected in your web browser.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

betanin-0.3.41.tar.gz (2.8 MB view hashes)

Uploaded source

Built Distribution

betanin-0.3.41-py3-none-any.whl (2.9 MB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page