• Stars
    star
    322
  • Rank 130,398 (Top 3 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created over 6 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

beets based mitm of your torrent client and music player

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


workflow


notifiers

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

  • email
  • discord
  • telegram
  • emby

installation

pip install --user betanin

usage

# start server
betanin
# 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_HOST=0.0.0.0 betanin
BETANIN_PORT=4030 betanin

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

screenshots


docker

image

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

compose
betanin:
  image: sentriz/betanin
  ports:
    - 9393:9393
  restart: unless-stopped
  environment:
    - UID=1000 # (optionally) set user id
    - GID=1000 # (optionally) set group id
  volumes:
    - ${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/

transmission

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

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

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

deluge

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

done script
#!/bin/sh

curl \
    --request POST \
    --data-urlencode "path=<path_to_deluge_downloads>" \
    --data-urlencode "name=$2" \
    --header "X-API-Key: <your_api_key>" \
    "https://betanin.example.com/api/torrents"

qbittorrent

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

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

set the path to the above done.sh and arguments such as

/path/to/done.sh "%L" "%R"
done script
#!/bin/sh

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

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

curl \
    --request POST \
    --data-urlencode "both=$2" \
    --header "X-API-Key: <your_api_key>" \
    "https://betanin.example.com/api/torrents"

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


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) also see python -m betanin.entry.shell.
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.

More Repositories

1

gonic

music streaming server / subsonic server API implementation
Go
1,062
star
2

fish-pipenv

๐ŸŸ๐Ÿ a fish plugin that automatically activates the pipenv subshell
Shell
200
star
3

cliphist

wayland clipboard manager
Go
161
star
4

wlr-sunclock

wayland desktop widget to show to the sun's shadows on earth
C
44
star
5

vim-print-debug

assisted printf debugging for vim
Vim Script
38
star
6

dotfiles

my dotfiles
Shell
18
star
7

standardnotes-extensions

auto updating extensions for your standardnotes server
Go
17
star
8

socr

screenshot OCR server
Go
11
star
9

socr-cli

searchable auto generated screenshot ocr database
Python
9
star
10

compose-status

simple home server status page, compose and traefik aware
Go
8
star
11

wl-gammactld

a daemon for wl-gammactl
Shell
7
star
12

bandcamp_downloader

a python 3+ script for downloading, renaming, and tagging albums from Bandcamp
Python
6
star
13

vi-pipe

edit text in the middle of a shell pipeline, and store a diff to replay changes after further invocations
Go
5
star
14

hexchat_python_addons

a python 3+ collection of HexChat addons
Python
5
star
15

reboodt

a python 3+ IRC bot
Python
4
star
16

cliphist-sh

wayland clipboard manager
Shell
4
star
17

rsl

reserialise: lossy but versatile conversion between data serialisation formats
Go
3
star
18

honk-docker

docker image for honk
Dockerfile
3
star
19

nvim-lsp-compose

compose language servers, and formatters / linters via efm in a language * feature matrix
Lua
2
star
20

beside

unix pipeline stage with before and after preview
Go
1
star
21

go-filelock

Go
1
star
22

log-proxy

a reverse proxy to a single address, logging request and response bodies
Go
1
star
23

xyz

personal jekyll website
Sass
1
star