MSBAPI stands for "my-seedbox.com API" and it aims to simplify the process of adding new torrents to your seedbox. It is the standard brick to enable full automation of torrent downloading. You can request the API with a URL linking to a torrent file or a magnet link, and it will manage adding it to your (my-)seedbox(.com) instance.
The key features are:
- Auto add torrent to your seedbox given the .torrent file URL or a magnet link
- Manage download directories based on the type of torrent
movie
,series
, etc.
This API is designed to be used with a my-seedbox.com instance running with the ruTorrent frontend.
There is only one route /add-torrent
where you can make a POST
request sending a JSON containing the url
of the
.torrent file or the magnet link. You can optionally add the type of torrent, this will change the download directory.
curl -X 'POST' \
'http://localhost:5000/add-torrent' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"url": "https://webtorrent.io/torrents/big-buck-bunny.torrent",
"type": "movie"
}'
Torrent types are useful to directly change the download directory based on what torrent you are downloading. Torrent types and download paths are not customizable for now, but they are already set up for a my-seedbox.com instance with a Plex server.
type |
Download path |
---|---|
movie |
BASE_PATH + /Plex/Films |
series |
BASE_PATH + /Plex/Series |
music |
BASE_PATH + /music |
default |
BASE_PATH |
null | BASE_PATH |
Use the package manager poetry to install msbapi.
poetry install
Use --no-dev
flag if you do not need dev dependencies
The API server uses uvicorn and fastapi, you can launch with the following command.
uvicorn main:app --host=localhost --port 5000
Once the API server is launched, the API Swagger will be available at http://localhost:5000/docs/
docker run -d \
-p 5000:5000 \
-e CLIENT_URL=$CLIENT_URL \
-e BASE_PATH=$BASE_PATH \
-e AUTH_TOKEN=$AUTH_TOKEN \
--name msbapi \
ghcr.io/samuelrince/msbapi
Paramter | Function |
---|---|
CLIENT_URL | The ruTorrent URL where you usually connect to add new torrents (e.g. https://seed20.my-seedbox.com:22000) |
BASE_PATH | The path where torrents are downloaded by default (e.g. /data/client_2000/outp/ ) |
AUTH_TOKEN | The access token from ruTorrent interface. Please read the section "How to get your access token" below |
To launch tests run the following command.
python -m pytest tests/
To get your ACCESS_TOKEN
you will need to log in your ruTorrent interface and the launch the Web Developer Tools from
your browser. In the network tab look for a backend call (to action.php
for instance) and check the request headers.
You will find an Authorization
header that contains your ACCESS_TOKEN
as following:
Authorization: Basic <ACCESS_TOKEN>
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.