From ca677149ab9ff5b3380eb6f4b1d9a843b743ab48 Mon Sep 17 00:00:00 2001 From: Michael Goodnow Date: Mon, 28 Sep 2020 00:42:44 -0400 Subject: [PATCH] Add documentation for daemon mode --- README.md | 27 ++++++++++++++++++++++++++- src/server.js | 12 ++++++------ 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 77f15ed45..b8540a161 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ works there too. ## Usage -Invoking it is _almost_ as simple as: +Invoking `cross-seed` is _almost_ as simple as: ```shell script npx cross-seed @@ -56,6 +56,31 @@ Options: -h, --help display help for command ``` +## Daemon Mode (rtorrent only) + +`cross-seed` has a new feature called daemon mode, designed to work with Docker. +It starts an HTTP server, listening on port 2468. It will respond to a POST +request with a plaintext body containing the name of a torrent inside your +torrent directory. As of right now it only works with rtorrent. I recommend +[installing the app globally](#install) if you use daemon mode. + +To start the daemon, issue the following command: + +```shell script +cross-seed daemon +``` + +Then, while the daemon is running, you can trigger a search with an HTTP +request: + +```shell script +curl -XPOST http://localhost:2468 --data '' +``` + +If you are using rtorrent, you can adapt +[these instructions](https://www.filebot.net/forums/viewtopic.php?p=5316#p5316) +to run the `curl` command on finished download. + ## Install You don't need to install this app, but if you really want to, or if your diff --git a/src/server.js b/src/server.js index 9617e0f32..cce96170b 100644 --- a/src/server.js +++ b/src/server.js @@ -33,16 +33,16 @@ const handleRequest = (config) => (req, res) => { async function serve(config) { const { outputDir } = config; - // try { - // await validateJackettApi(config); - // } catch (e) { - // return; - // } + try { + await validateJackettApi(config); + } catch (e) { + return; + } fs.mkdirSync(outputDir, { recursive: true }); const server = http.createServer(handleRequest(config)); server.listen(2468); - console.log("Server is running on port 2468"); + console.log("Server is running on port 2468, ^C to stop."); } module.exports = { serve };