mirror of
https://github.com/WhatCD/Gazelle.git
synced 2024-12-13 10:56:26 +00:00
47 lines
1.4 KiB
PHP
47 lines
1.4 KiB
PHP
<?
|
|
if(($GroupIDs = $Cache->get_value('better_single_groupids')) === false) {
|
|
$DB->query("SELECT t.ID AS TorrentID,
|
|
t.GroupID AS GroupID
|
|
FROM xbt_files_users AS x
|
|
JOIN torrents AS t ON t.ID=x.fid
|
|
WHERE t.Format='FLAC'
|
|
GROUP BY x.fid
|
|
HAVING COUNT(x.uid) = 1
|
|
ORDER BY t.LogScore DESC, t.Time ASC LIMIT 30");
|
|
|
|
$GroupIDs = $DB->to_array('GroupID');
|
|
$Cache->cache_value('better_single_groupids', $GroupIDs, 30*60);
|
|
}
|
|
|
|
$Results = get_groups(array_keys($GroupIDs));
|
|
|
|
$Results = $Results['matches'];
|
|
|
|
$JsonResults = array();
|
|
foreach ($Results as $GroupID=>$Group) {
|
|
list($GroupID, $GroupName, $GroupYear, $GroupRecordLabel, $GroupCatalogueNumber, $TagList, $ReleaseType, $GroupVanityHouse, $Torrents, $Artists) = array_values($Group);
|
|
$FlacID = $GroupIDs[$GroupID]['TorrentID'];
|
|
|
|
$DisplayName = '';
|
|
if(count($Artists)>0) {
|
|
$DisplayName = display_artists(array('1'=>$Artists));
|
|
}
|
|
$DisplayName.='<a href="torrents.php?id='.$GroupID.'&torrentid='.$FlacID.'" title="View Torrent">'.$GroupName.'</a>';
|
|
if($GroupYear>0) { $DisplayName.=" [".$GroupYear."]"; }
|
|
|
|
$JsonResults[] = array(
|
|
'torrentId' => $FlacID,
|
|
'groupId' => $GroupID,
|
|
'artist' => $Artists,
|
|
'groupName' => $GroupName,
|
|
'groupYear' => $GroupYear,
|
|
'downloadUrl' => 'torrents.php?action=download&id='.$FlacID.'&authkey='.$LoggedUser['AuthKey'].'&torrent_pass='.$LoggedUser['torrent_pass']
|
|
);
|
|
}
|
|
|
|
print json_encode(
|
|
array(
|
|
'status' => 'success',
|
|
'response' => $JsonResults
|
|
)
|
|
); |