Coder Social home page Coder Social logo

vlacour97 / alldebrid-watcher Goto Github PK

View Code? Open in Web Editor NEW
25.0 4.0 2.0 221 KB

Automatic downloader for alldebrid

License: Other

Makefile 1.15% Dockerfile 0.18% JavaScript 0.67% TypeScript 98.00%
alldebrid downloadfolder torrent-folder torrents npm docker watcher radarr sonarr lidarr

alldebrid-watcher's Introduction

Alldebrid watcher

ko-fi

Alldebrid-watcher is an open-source application that allows for automatic downloading of torrent files using AllDebrid services. The application is divided into 4 configurable services: Watcher, Debrider, Downloader, and Notifier.

Important Information
If you are using a version older than 2.0.0, please refer to the old documentation

How the app works ?

The application is divided into 5 parts:

  • AppKernel
  • Watchers
  • Debrider(s) (other debriders may come later)
  • Downloaders
  • Notifiers

AppKernel

Enables the operation of the application by calling different services

Watchers

Monitors torrent files or magnets to be downloaded.

Available Watchers:

  • FileSystem: Monitors a folder and downloads a torrent as soon as a file is dropped.
  • Coming soon

Only one watcher can be used at a time

Debriders

Transforms a torrent or magnet file into a direct link

Available Debriders:

Only one debrider can be used at a time

Downloaders

Downloads a file transformed by the debrider

Available Downloaders:

  • FileSystem: Uses node JS to download the file locally
  • Coming soon

Only one downloader can be used at a time

Notifiers

Notifies the user of actions taken. It is possible to select which actions you want to be informed of.

Possible notification types:

  • A torrent or magnet file was found
  • A torrent or magnet file was debridled
  • The download of a file has begun
  • Download progress (x% downloaded)
  • The download is finished
  • The download encountered an error

Available Notifiers:

  • Stdout: Log les action dans la sortie standard de la console
  • Pushover: Sends notifications using the Pushover service
  • Coming soon

Multiple notifiers can be used at the same time
Each notifier can inform of different actions (example: Stdout => verbose mode + Pushover => Downloads started, Downloads finished)

Usage with Node JS

Prerequisites

  • A valid AllDebrid account with an API key
  • Node.js
  • npm or yarn

Installation

Clone the Github repository on your machine using the following command:

git clone https://github.com/vlacour97/alldebrid-watcher.git

Install the dependencies using npm or yarn:

npm install ts-node -g
npm install 

or

yarn install ts-node -g
yarn install 

Launch

Each service can be configured independently using environment variables

Basic usage example

Launch the application using npm or yarn:

ALLDEBRID_TOKEN=allbredid-token  TORRENT_FOLDER=path/to/torrents DOWNLOAD_FOLDER=path/to/downloads npm run start

or

ALLDEBRID_TOKEN=allbredid-token  TORRENT_FOLDER=path/to/torrents DOWNLOAD_FOLDER=path/to/downloads yarn start

Use with Docker

Prerequisites

  • A valid AllDebrid account with an API key
  • Docker

Lancement

Each service can be configured independently using environment variables

Basic usage example

docker run -v path/tot/torrent:/torrents -v path/to/download:/downloads -e ALLDEBRID_TOKEN=allbredid-token vlacour97/alldebrid-watcher

The options used in this command are:

  • -e ALLDEBRID_TOKEN : sets the environment variable for your AllDebrid token
  • -v <path/to/torrents>:/app/torrents : binds the local folder containing the torrent files to the folder in the container where the application will look for torrent files
  • -v <path/to/downloads>:/app/downloads : binds the local folder where downloaded files will be saved to the folder in the container where the application will save downloaded files

Configuration

Watcher

Filesystem

Environment Variable Required ? Default value Description
TORRENT_FOLDER No /torrents Path to the folder containing the torrent files

Debrider

AllDebrid

Environment Variable Required ? Default value Description
ALLDEBRID_TOKEN Yes AllDebrid API key
AUTHORIZED_EXTENSIONS No null List of authorized extensions for download separated by a comma (example: avi,mkv,..)

Downloader

Filesystem

Environment Variable Required ? Default value Description
DOWNLOAD_FOLDER No /downloads Path to the folder where the files are downloaded
MAX_PARALLELS_DOWNLOADS No 5 Number of parallel downloads

Notifier

Environment Variable Required ? Default value Available values Description
NOTIFIER_SERVICES No stdout stdout, pushover Choice of notification services separated by a comma
NOTIFIER_SERVICES_CONFIG No {} Keys: stdout, pushover
Values: 'all' or an array with the values specified in the table below
Choice of which actions should be notified on which service in JSON
Example:
{"stdout": "all", "pushover": ["download_start", "download_done"]}

Type of actions

Valeur Description
watch A torrent or magnet file was found
debrid A torrent or magnet file was debrid
download_start The download of a file has begun
download_progress Download progress (x% downloaded)
download_done The download is complete
download_error The download encounters an error

Stdout

No configuration possible

Pushover

Action download_progress was not supported by pushover notifier.

Environment Variable Required ? Default value Description
PUSHOVER_USER_TOKEN Yes Pushover User Token. Set PUSHOVER_USER_TOKEN and PUSHOVER_APP_TOKEN to use pushover app to be notified when download was finish
PUSHOVER_APP_TOKEN Yes Pushover App Token. Set PUSHOVER_USER_TOKEN and PUSHOVER_APP_TOKEN to use pushover app to be notified when download was finish

Licence

Alldebrid-watcher is licensed under the MIT

Contribution

The project is open to contributions from the community.

Whether you're a beginner or an experienced developer, feel free to submit pull requests with bug fixes, new features, and improvements to the code. Your contributions will be greatly appreciated and will help make this project even better. If you have any questions or suggestions, please don't hesitate to reach out to us.

alldebrid-watcher's People

Contributors

vlacour97 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

alldebrid-watcher's Issues

Just a post to say it works flawlessly

To anyone arriving in this GitHub and wondering if it works looking at the issues : yes it does !
Just installed on a Synology with the docker GUI and it does what it advertises beautifully. Be it one torrent with one file or one torrent with several files, it works as intended.
I was afraid it would also download files I manually upload on the alldebrid website and thanksfully it doesn’t.
This is perfect for me

The only minor thing is that the pushover notification “download started” arrives when the file download is completed

Many many thanks to the dev !

Synchronous downloads

Synchronous downloads would be a nice feature. I think I'm getting rate limited by alldebrid when trying to download a torrent with many large files.

Server to Client, 1 file only torrents

Probably pointless posting this, as it looks like the project is sadly dead.

I have noticed torrents aren't picked up from AllDebrid if the torrent contained more than one file. Is there any way to alter this?

Notification problem

Hello,

I've noticed an error in the code. When I follow the documentation and run docker run -v path/to/torrent:/torrents -v path/to/download:/downloads -e ALLDEBRID_TOKEN=allbredid-token vlacour97/alldebrid-watcher.

The container runs fine until it tries to download the file, at which point I get this error:

yarn run v1.22.19
$ ts-node index.ts
Application started
The file "/torrents/ubuntu-23.04-desktop-amd64.iso.torrent" has been watched on your server
The file "ubuntu-23.04-desktop-amd64.iso" has been debrided on your server
The file "ubuntu-23.04-desktop-amd64.iso" is being downloaded on your server
/app/src/notifier/stdout-notifier.ts:26
        process.stdout.clearLine(0);
                       ^
TypeError: process.stdout.clearLine is not a function
    at StdoutNotifier.notifyOnDownloadProgress (/app/src/notifier/stdout-notifier.ts:26:24)
    at NotifierStrategy.notifyOnDownloadProgress (/app/src/notifier/notifier-strategy.ts:81:58)
    at DownloadFile.<anonymous> (/app/src/kernel.ts:91:89)
    at EventEmitter.<anonymous> (/app/src/file/download-file.ts:39:59)
    at EventEmitter.emit (node:events:512:28)
    at EventEmitter.emit (node:domain:489:12)
    at Request.<anonymous> (/app/src/downloader/filesystem-downloader.ts:66:30)
    at Request.emit (node:events:512:28)
    at Request.emit (node:domain:489:12)
    at reportState (/app/node_modules/request-progress/index.js:83:21)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I was able to fix the problem by modifying the file app/src/notifier/stdout-notifier.ts.
In this file, I added import * as readline from "readline"; and modified the notifyOnDownloadProgress() method to:

    notifyOnDownloadProgress(downloadFile: DownloadFile, progress: number): void {
        readline.clearLine(process.stdout, 0)
        readline.cursorTo(process.stdout, 0, null)
        process.stdout.write(`Downloading of file "${downloadFile.file.filename}": ${progress}%\r`);
    }

After making these modifications, I no longer received the error message.

Download file with another downloader

the plugin is great, but the download tracking is awesome.
Would it be possible to send the download links to an external source (Transmission, Synology downloadStation, ...)
Or indicate in the code where we can try to do it.

Is it working ?

Hello,
i tried your script on docker...
i put the .torrent on the folder but nothing is sent to alldebrid

best rgds
Jo

dont work

npm install ALLDEBRID_TOKEN=allbredid-token
npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "ALLDEBRID_TOKEN=allbredid-token" of package "ALLDEBRID_TOKEN=allbredid-token": Tags may not have any characters that encodeURIComponent encodes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.