Fix public tag tracker script

This commit is contained in:
Alex Thomassen 2023-10-24 09:46:02 +00:00
parent 0ecbdf9020
commit 1f33d611d9
Signed by: Alex
GPG Key ID: 10BD786B5F6FF5DE
2 changed files with 6 additions and 4 deletions

View File

@ -9,13 +9,16 @@
$limit = isset($cliOptions['l']) && $cliOptions['l'] === false;
$old = isset($cliOptions['o']) && $cliOptions['o'] === false;
$tag = (string) env('QBITTORRENT_PUBLIC_TAG', 'public-trackers');
$qBitClient = new QBitClient();
$torrents = $qBitClient->getBasicTorrentsInfo();
$torrents = array_filter(
$torrents,
function ($torrent)
function ($torrent) use ($tag)
{
return empty($torrent['tags']) && $torrent['trackers_count'] >= 5;
$tags = $torrent['tags'];
return !str_contains($tags, $tag) && $torrent['trackers_count'] >= 5;
}
);
@ -40,7 +43,6 @@
// Reset all array keys for torrents
$torrents = array_values($torrents);
$tag = (string) env('QBITTORRENT_PUBLIC_TAG', 'public-trackers');
if (!empty($torrents)) {
$torrentHashes = array_map(

View File

@ -33,7 +33,7 @@
/**
* Gets the full tracker list of every torrent, if necessary.
*
* @param QBitClient $qBitClient
* @param Decicus\qBitTorrent\Client $qBitClient
* @param array $torrents Array of torrents, such as the one returned by getBasicTorrentsInfo()
* @param array $trackerCache Array of already cached trackers for a specific hostname
*