$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): string
{
static $ptGen;
if (is_null($ptGen)) {
$ptGen = new PTGen();
}
$ptGenInfo = json_decode($torrentInfo['pt_gen'], true);
$log = "torrent: " . $torrentInfo['id'];
$siteIdAndRating = $ptGen->listRatings($ptGenInfo ?? [], $torrentInfo['url']);
$log .= "siteIdAndRating: " . json_encode($siteIdAndRating);
do_log($log);
return $ptGen->buildRatingSpan($siteIdAndRating);
}
}