$row['to_go'] == 0 ? 'yes' : 'no',
'progress' => $progress,
'active_status' => $activeStatus,
];
}
return $snatchedList;
}
public function renderProgressBar($activeStatus, $progress): string
{
$color = '#aaa';
if ($activeStatus == 'seeding') {
$color = 'green';
} elseif ($activeStatus == 'leeching') {
$color = 'blue';
}
$progress = ($progress * 100) . '%';
$result = sprintf(
'
',
$activeStatus . " $progress", $progress, $color
);
return $result;
}
public function renderTorrentsPageAverageRating(array $torrentInfo, array|string $ptGenInfo): string
{
static $ptGen;
if (is_null($ptGen)) {
$ptGen = new PTGen();
}
$log = "torrent: " . $torrentInfo['id'];
$siteIdAndRating = $ptGen->listRatings(is_array($ptGenInfo) && count($ptGenInfo) ? $ptGenInfo : [], $torrentInfo['url']);
$log .= ", siteIdAndRating: " . json_encode($siteIdAndRating);
do_log($log);
return $ptGen->buildRatingSpan($siteIdAndRating);
}
}