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 };