Created
August 4, 2023 15:55
-
-
Save yinyanfr/4267a522bd0bfd74cefadfd33cf7285e to your computer and use it in GitHub Desktop.
Pause all unregistered torrents in Qbittorrent using the WebUI API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import qbittorrentAPI from "qbittorrent-api-v2" | |
async function pauseUnregisteredTorrents() { | |
const qbittorrent = await qbittorrentAPI.connect( | |
CONFIG.WebUIAddress, | |
CONFIG.Login, | |
CONFIG.Password | |
); | |
const torrents = await qbittorrent.torrents(); | |
const unregistered = []; | |
for (const torrent of torrents) { | |
const trackers = await qbittorrent.trackers(torrent.hash); | |
if (trackers.find((e) => e.status === 4)) { | |
unregistered.push(torrent.hash); | |
} | |
} | |
await qbittorrent.pauseTorrents(unregistered.join("|")); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment