{"id":18665330,"url":"https://github.com/robertklep/node-sabnzbd","last_synced_at":"2025-04-11T22:31:08.205Z","repository":{"id":3633109,"uuid":"4699700","full_name":"robertklep/node-sabnzbd","owner":"robertklep","description":"Node interface for SABnzbd","archived":false,"fork":false,"pushed_at":"2018-01-04T10:08:31.000Z","size":42,"stargazers_count":11,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-10-06T03:19:13.172Z","etag":null,"topics":["node","sabnzbd","sabnzbd-api"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robertklep.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-06-18T10:26:04.000Z","updated_at":"2023-02-12T23:16:29.000Z","dependencies_parsed_at":"2022-08-19T04:21:04.377Z","dependency_job_id":null,"html_url":"https://github.com/robertklep/node-sabnzbd","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertklep%2Fnode-sabnzbd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertklep%2Fnode-sabnzbd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertklep%2Fnode-sabnzbd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robertklep%2Fnode-sabnzbd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robertklep","download_url":"https://codeload.github.com/robertklep/node-sabnzbd/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223482408,"owners_count":17152516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["node","sabnzbd","sabnzbd-api"],"created_at":"2024-11-07T08:27:13.288Z","updated_at":"2024-11-07T08:27:13.929Z","avatar_url":"https://github.com/robertklep.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-sabnzbd\n\nNode API client for [SABnzbd](http://www.sabnzbd.org/).\n\n## TL;DR\n\n```javascript\nconst SABnzbd = require('sabnzbd');\nconst sabnzbd = new SABnzbd('http://localhost:8080/', API_KEY);\n\nconsole.log('Queue + History:');\nsabnzbd.entries().each(function(entry) {\n  console.log('-', entry.name, ',', entry.size / 1000 / 1000, 'MB');\n});\n```\n\n## Installation\n\n```\n$ npm install sabnzbd\n```\n\nYou'll also need the API key for your SABnzbd installation:\n\n- open the SABnzbd web interface in your browser\n- go to `Config \u003e General`\n- in the _SABnzbd Web Server_ settings, find the API key (or generate one)\n- note down the API key\n\n## Client basics\n\nThis client consists of three parts:\n\n- common commands\n- commands related to the SABnzbd queue (the list of currently active downloads)\n- commands related to the SABnzbd history (the list of completed downloads)\n\nFor the most part, the client implements the commands found on [the SABnzbd API page](http://wiki.sabnzbd.org/api), and returns their results pretty much as-is.\n\nHowever, because the SABnzbd API is horribly inconsistent at times, I've added some normalization (see the `status` and `entries` commands) to make interfacing with it a bit easier. Another thing is that the SABnzbd API is not terribly informative on the status of some commands; for instance, the `remove` commands will always return a `true` status, even if you're using an nonexistent NZB id.\n\n`sabnzbd` is `Promise` based, so all commands return a promise.\n\n## Commands\n\n### Common commands\n\n#### `new SABnzbd(URL, API_KEY)`\n\n* Connects to SABnzbd.\n\n    _Arguments_:\n\n    * `URL`\n        - url to web interface of the SABnzbd\n    * `API_KEY`\n        - API key (required for most operations, see _Install_ on how to get it)\n\n    _Returns_:\n\n    * a `SABnzbd` instance\n\n#### `instance.status()`\n\n* The results of `queue.status()` and `history.status()` (see below), merged (**NB**: for now, only the `slots` and `entries` are actually merged, the rest of the object returned is based on the object returned by the `queue.status()` method).\n\n#### `instance.entries()`\n\n* Both the history and queue entries, merged.\n\n#### `instance.delete(ID[, ID, ...])`\n\n* Delete an NZB from both queue and history.\n\n    _Arguments_:\n\n    * `ID`\n        - id of NZB (the `nzbid` property of queue/history entries)\n\n    Accepts multiple `ID` arguments, or one argument containing the string `all` to remove everything from both queue and history (so be careful!).\n\n#### `instance.version()`\n\n* Query the SABnzbd version.\n\n    _Returns_:\n\n    * the SABnzbd version as reported by the server\n\n#### `instance.cmd(CMD[, ARGS])`\n\n* Send a command to SABnzbd.\n\n    _Arguments_:\n\n    * `CMD`\n        - command to send\n    * `ARGS`\n        - optional object of _key/value_ parameters\n\n    (for all commands and their arguments, check the [the SABnzbd API page](http://wiki.sabnzbd.org/api))\n\n    For example, the `version()` method is implemented like this:\n\n    ```javascript\n    return this.cmd('version');\n    ```\n\n### Queue-related commands\n\n#### `instance.queue.status()`\n\n* Get status of the SABnzbd queue.\n\n    _Returns_:\n\n    * the output of the [advanced queue command](http://wiki.sabnzbd.org/api#toc8), with an extra property `entries` containing a normalized version of the `slots` property\n\n    A normalized queue entry contains the following properties:\n\n        age         : age of NZB posting, in seconds\n        size        : size of download in bytes\n        size_left   : number of bytes still to download before completion\n        nzbid       : internal SABnzbd id for this NZB\n        category    : categories\n        eta         : ETA for download, as Date object\n        name        : NZB filename\n        nzbname     : NZB filename\n        percentage  : percentage downloaded\n        index       : index into queue\n        missing     : ?\n        priority    : ?\n        status      : download status ('Completed', 'Paused', 'Queued,\n                      'Failed', 'Verifying', 'Downloading', 'Extracting')\n        time_left   : time left before download should be complete, in seconds\n        _queue_slot : boolean (always true) to identify this as a queue entry\n\n#### `instance.queue.delete(ID)`\n\n* Delete an NZB from the queue. See `instance.delete()` for arguments.\n\n#### `instance.queue.addurl(URL[, ARGS)`\n\n* Add an NZB to the queue by URL, with optional arguments.\n\n    _Arguments_:\n\n    * `URL`\n        - url pointing to an NZB file\n    * `ARGS` [Sab API Docs](http://wiki.sabnzbd.org/api#toc28)\n        - Optional object any of the following options `pp`=Post Process Level, `script`=Post Process Script, `cat`=Category, `priority`=Priority\n\n#### `instance.queue.pause([ID])`\n\n* Pause downloading. Without arguments, pauses the entire queue. Otherwise, just pauses downloading of a single NZB.\n\n    _Arguments_:\n\n    * `ID`\n        - id of NZB (the `nzbid` property of queue/history entries)\n\n#### `instance.queue.resume([ID])`\n\n* Resume downloading. Without arguments, resumes the entire queue. Otherwise, just resumes downloading of a single NZB.\n\n    _Arguments_:\n\n    * `ID`\n        - id of NZB (the `nzbid` property of queue/history entries)\n\n### History-related commands\n\n#### `instance.history.status()`\n\n* Get status of the SABnzbd history.\n\n    _Returns_:\n\n    * the output of the [history command](http://wiki.sabnzbd.org/api#toc11), with, again, an extra `entries` property\n\n    A normalized history entry contains the following properties:\n\n        action_line    : ?\n        size           : size in bytes\n        category       : categories\n        completed      : completed timestamp, as Date object\n        completeness   : ?\n        download_time  : download time in seconds\n        downloaded     : number of downloaded bytes\n        fail_message   : message why download failed\n        id             : internal id (not the same as `nzbid`)\n        loaded         : ?\n        meta           : ?\n        name           : name of download\n        nzbname        : NZB filename\n        nzbid          : internal SABnzbd id for this NZB\n        incomplete_path: path where SABnzbd stored incomplete download\n        postproc_time  : time in seconds it took to postprocess this NZB\n        pp             : ?\n        report         : ?\n        retry          : ?\n        script         : ?\n        script_line    : ?\n        script_log     : ?\n        show_details   : ?\n        stage_log      : list of actions taken by SABnzbd to download/process\n                         this NZB\n        status         : status (see queue entry)\n        downloaded_to  : file/directory this NZB was downloaded to\n        url            : ?\n        url_info       : ?\n        _history_slot  : boolean (always true) to identify this as a history entry\n\n#### `instance.history.delete(ID)`\n\n* Delete an NZB from the history. See `instance.delete()` for arguments.\n\nChangelog\n---------\n\n* **2.0.0**\n    * Complete rewrite, using native `Promise`'s.\n* **1.2.0**\n    * allow passing of parameters with `addurl()` (thanks to @OverFlow636)\n* **1.0.0**\n    * dropped Q in favor of Bluebird, tightened up code\n* **0.2.0**\n    * pretty much a rewrite of the API\n* **0.1.1**\n    * removed some left-over debugging code\n* **0.1.0**\n    * initial release\n\nTODO\n----\n\n* README:\n    - documentation formatting sucks\n* Queue:\n    - Add by upload/file path/newzbin ID\n    - Scripts/actions/priority\n    - Shutdown\n    - Move\n    - Change item name\n* History:\n    - Retry\n* Configuration:\n    - Everything\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertklep%2Fnode-sabnzbd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobertklep%2Fnode-sabnzbd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobertklep%2Fnode-sabnzbd/lists"}