Metadata-Version: 2.1
Name: betanin
Version: 0.3.10
Summary: beets based mitm of your torrent client and music player
Home-page: https://github.com/sentriz/betanin
Author: Senan Kelly
Author-email: senan@senan.xyz
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Description-Content-Type: text/markdown
Requires-Dist: Click (>=7.0)
Requires-Dist: Flask-Cors (>=3.0.6)
Requires-Dist: Flask-Migrate (>=2.3.0)
Requires-Dist: Flask-SQLAlchemy (>=2.3.2)
Requires-Dist: Flask-SocketIO (>=3.0.2)
Requires-Dist: Flask (>=1.0.2)
Requires-Dist: ItsDangerous
Requires-Dist: Jinja2 (>=2.10)
Requires-Dist: Mako (>=1.0.7)
Requires-Dist: MarkupSafe (>=1.0)
Requires-Dist: SQLAlchemy-Utils (>=0.33.6)
Requires-Dist: SQLAlchemy (>=1.2.12)
Requires-Dist: Werkzeug (>=0.14.1)
Requires-Dist: alembic (>=1.0.1)
Requires-Dist: aniso8601 (>=3.0.2)
Requires-Dist: beets (==1.4.9)
Requires-Dist: certifi (>=2018.10.15)
Requires-Dist: chardet (>=3.0.4)
Requires-Dist: flask-jwt-extended
Requires-Dist: flask-restplus (>=0.12.1)
Requires-Dist: gevent (>=1.3.7)
Requires-Dist: greenlet (>=0.4.15)
Requires-Dist: idna (>=2.7)
Requires-Dist: jsonschema (>=2.6.0)
Requires-Dist: loguru
Requires-Dist: ptyprocess
Requires-Dist: python-dateutil (>=2.7.3)
Requires-Dist: python-editor (>=1.0.3)
Requires-Dist: python-engineio (>=2.3.2)
Requires-Dist: python-socketio (>=2.0.0)
Requires-Dist: pytz (>=2018.5)
Requires-Dist: pyxdg (>=0.26)
Requires-Dist: requests (>=2.20.0)
Requires-Dist: six (>=1.11.0)
Requires-Dist: sqlalchemy-json (>=0.2.2)
Requires-Dist: toml
Requires-Dist: tzlocal (>=1.5.1)
Requires-Dist: urllib3 (>=1.24)

<p align="center"><img width="300" src="https://github.com/sentriz/betanin/raw/master/.github/logo.png"></p>
<h4 align="center">beets.io based man-in-the-middle of your torrent client and music player</h4>
<p align="center"><a href="http://hub.docker.com/r/sentriz/betanin"><img src="https://img.shields.io/docker/pulls/sentriz/betanin.svg"></a> <a href="https://microbadger.com/images/sentriz/betanin" title="Get your own image badge on microbadger.com"><img src="https://images.microbadger.com/badges/image/sentriz/betanin.svg"></a> <img src="https://api.codacy.com/project/badge/Grade/db7d1db9dd404f8fa31febc8a2d52d00"> <img src="https://img.shields.io/github/issues/sentriz/betanin.svg"> <img src="https://img.shields.io/github/issues-pr/sentriz/betanin.svg"></p>

<hr>

### workflow

<p align="center"><img src="https://github.com/sentriz/betanin/raw/master/.github/flow.png"></p>

<hr>

### notifiers

betanin uses [apprise](https://github.com/caronc/apprise) for notifications. so anything supported there will work. but some include

- email
- discord
- telegram
- emby

<hr>

### installation

```shell
$ pip install --user betanin
```

<hr>

### usage

```shell
$ # start server
$ betanin
$ # a config file will be created, add your credentials to it
$ # start again
$ betanin [--port=<port>]
$ # ui will be available at port

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

<hr>

### screenshots

<p align="center"><img src="https://github.com/sentriz/betanin/raw/master/.github/scrot_1.png"></p>
<p align="center"><img src="https://github.com/sentriz/betanin/raw/master/.github/scrot_2.png"></p>
<p align="center"><img src="https://github.com/sentriz/betanin/raw/master/.github/scrot_3.png"></p>
<p align="center"><img src="https://github.com/sentriz/betanin/raw/master/.github/scrot_4.png"></p>

<hr>

### 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
```yml
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/
```

<hr>

### transmission

###### settings.json (example excerpt)

```json
...
"script-torrent-done-enabled": true,
"script-torrent-done-filename": "/scripts/done",
...
```

###### done script

```bash
#!/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"
```

###### docker compose (excerpt)

```yaml
volumes:
- ${DATA}/transmission/config:/config
- ${DATA}/transmission/scripts:/scripts
- ${MEDIA}/download:/downloads
```

<hr>

### 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.


