mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 22:03:49 -07:00
Updated
This commit is contained in:
parent
5b64608861
commit
13369c16c9
2 changed files with 28 additions and 5 deletions
|
@ -731,6 +731,7 @@ $bb_cfg['tracker'] = [
|
||||||
'multitracker' => [ // multi-tracker settings
|
'multitracker' => [ // multi-tracker settings
|
||||||
'enabled' => true,
|
'enabled' => true,
|
||||||
'update_interval' => 0,
|
'update_interval' => 0,
|
||||||
|
'max_trackers' => 3,
|
||||||
'timeout' => 5, // per announcer (in secs)
|
'timeout' => 5, // per announcer (in secs)
|
||||||
'torrents_per_cycle' => 20,
|
'torrents_per_cycle' => 20,
|
||||||
],
|
],
|
||||||
|
|
|
@ -15,27 +15,49 @@ namespace TorrentPier;
|
||||||
*/
|
*/
|
||||||
class MultiTracker
|
class MultiTracker
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Leechers count
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
public int $leechers;
|
public int $leechers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Seeders count
|
||||||
|
*
|
||||||
|
* @var int
|
||||||
|
*/
|
||||||
public int $seeders;
|
public int $seeders;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MultiTracker constructor
|
||||||
|
*
|
||||||
|
* @param array $infoHashes
|
||||||
|
* @param array $trackers
|
||||||
|
*/
|
||||||
public function __construct(array $infoHashes, array $trackers)
|
public function __construct(array $infoHashes, array $trackers)
|
||||||
{
|
{
|
||||||
|
global $bb_cfg;
|
||||||
|
|
||||||
$scraper = new Scraper();
|
$scraper = new Scraper();
|
||||||
$announcerInfo = $scraper->scrape($infoHashes, $trackers);
|
$announcerInfo = $scraper->scrape(
|
||||||
|
$infoHashes,
|
||||||
|
$trackers,
|
||||||
|
$bb_cfg['tracker']['multitracker']['max_trackers'],
|
||||||
|
$bb_cfg['tracker']['multitracker']['timeout'],
|
||||||
|
);
|
||||||
|
|
||||||
$seeders = $leechers = 0;
|
$seeders = $leechers = 0;
|
||||||
if (!$scraper->hasErrors()) {
|
if (!$scraper->hasErrors()) {
|
||||||
foreach ($infoHashes as $infoHash) {
|
foreach ($infoHashes as $infoHash) {
|
||||||
$announcerInfo = $announcerInfo[$infoHash];
|
$announcerInfo = $announcerInfo[$infoHash];
|
||||||
$seeders = $announcerInfo['seeders'];
|
$seeders = (int)$announcerInfo['seeders'];
|
||||||
$leechers = $announcerInfo['leechers'];
|
$leechers = (int)$announcerInfo['leechers'];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dump($scraper->getErrors());
|
dump($scraper->getErrors());
|
||||||
}
|
}
|
||||||
|
|
||||||
//dd([$seeders, $leechers]);
|
|
||||||
|
|
||||||
$this->leechers = $leechers;
|
$this->leechers = $leechers;
|
||||||
$this->seeders = $seeders;
|
$this->seeders = $seeders;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue