Empty commit

This commit is contained in:
Git 2011-11-07 08:00:19 +00:00
parent 1d118971c9
commit c166ade5a1
4 changed files with 29 additions and 10 deletions

View File

@ -66,13 +66,17 @@
$DB->query("SELECT Name FROM artists_group WHERE ArtistID='$ArtistID'");
list($ArtistName) = $DB->next_record(MYSQLI_NUM,false);
$DB->query("SELECT GroupID FROM torrents_artists WHERE ArtistID='$ArtistID'");
$DB->query("SELECT GroupID, Importance FROM torrents_artists WHERE ArtistID='$ArtistID'");
if($DB->record_count() == 0) { error(404); }
$GroupIDs = $DB->collect(0,false);
$Releases = $DB->to_array('GroupID',MYSQLI_ASSOC,false);
$GroupIDs = array_keys($Releases);
$SQL = "SELECT CASE ";
foreach ($_REQUEST['list'] as $Priority => $Selection) {
if(!is_number($Priority)) {
continue;
}
$SQL .= "WHEN ";
switch ($Selection) {
case '00': $SQL .= "t.Format='MP3' AND t.Encoding='V0 (VBR)'"; break;
@ -103,7 +107,7 @@
case '46': $SQL .= "t.Format='AAC' AND t.Encoding='192'"; break;
default: error(0);
}
$SQL .= " THEN '".db_string($Priority)."' ";
$SQL .= " THEN $Priority ";
}
$SQL .= "ELSE 100 END AS Rank,
t.GroupID,
@ -121,10 +125,9 @@
$DB->query($SQL);
$Downloads = $DB->to_array('1',MYSQLI_NUM,false);
$Artists = get_artists($DB->collect('GroupID'), false);
$Artists = get_artists($GroupIDs, false);
$Skips = array();
$TotalSize = 0;
if(count($Downloads)) {
foreach($Downloads as $Download) {
$TorrentIDs[] = $Download[2];
@ -143,12 +146,19 @@
$Skips[] = $Artist.$Album.' '.$Year;
continue;
}
if($Releases[$GroupID]['Importance'] == 1) {
$ReleaseTypeName = $ReleaseTypes[$ReleaseType];
} elseif($Releases[$GroupID]['Importance'] == 2) {
$ReleaseTypeName = "Guest Appearance";
} elseif($Releases[$GroupID]['Importance'] == 3) {
$ReleaseTypeName = "Remixed By";
}
$TotalSize += $Size;
$Contents = unserialize(base64_decode($Torrents[$TorrentID]['file']));
$Tor = new TORRENT($Contents, true);
$Tor->set_announce_url(ANNOUNCE_URL.'/'.$LoggedUser['torrent_pass'].'/announce');
unset($Tor->Val['announce-list']);
$Zip->add_file($Tor->enc(), $ReleaseTypes[$ReleaseType].'/'.file_string($Artist.$Album).' - '.file_string($Year).' ('.file_string($Media).' - '.file_string($Format).' - '.file_string($Encoding).').torrent');
$Zip->add_file($Tor->enc(), $ReleaseTypeName.'/'.file_string($Artist.$Album).' - '.file_string($Year).' ('.file_string($Media).' - '.file_string($Format).' - '.file_string($Encoding).').torrent');
}
$Analyzed = count($Downloads);
$Skipped = count($Skips);

View File

@ -69,6 +69,9 @@
$SQL = "SELECT CASE ";
foreach ($_REQUEST['list'] as $Priority => $Selection) {
if(!is_number($Priority)) {
continue;
}
$SQL .= "WHEN ";
switch ($Selection) {
case '00': $SQL .= "t.Format='MP3' AND t.Encoding='V0 (VBR)'"; break;

View File

@ -112,7 +112,8 @@ function next_hour() {
//------------- Front page stats ----------------------------------------//
//Love or hate, this makes things a hell of a lot faster
if ($Hour%6 == 0) {
if ($Hour%2 == 0) {
$DB->query("SELECT COUNT(uid) AS Snatches FROM xbt_snatched");
list($SnatchStats) = $DB->next_record();
$Cache->cache_value('stats_snatches',$SnatchStats,0);

View File

@ -292,14 +292,18 @@ function header_link($SortKey,$DefaultWay="desc") {
$OrderWay = 'desc';
}
if(empty($_GET['order_by']) || !in_array($_GET['order_by'], array('year', 'time','size','seeders','leechers','snatched'))) {
if(empty($_GET['order_by']) || !in_array($_GET['order_by'], array('year','time','size','seeders','leechers','snatched','random'))) {
$_GET['order_by'] = 'time';
$OrderBy = 'time'; // For header links
} elseif($_GET['order_by'] == 'random') {
$OrderBy = '@random';
$Way = SPH_SORT_EXTENDED;
$SS->limit(0, TORRENTS_PER_PAGE, TORRENTS_PER_PAGE);
} else {
$OrderBy = $_GET['order_by'];
}
$SS->SetSortMode($Way, $_GET['order_by']);
$SS->SetSortMode($Way, $OrderBy);
if(count($Queries)>0) {
@ -540,6 +544,7 @@ function header_link($SortKey,$DefaultWay="desc") {
<option value="snatched"<?selected('order_by','snatched')?>>Snatched</option>
<option value="seeders"<?selected('order_by','seeders')?>>Seeders</option>
<option value="leechers"<?selected('order_by','leechers')?>>Leechers</option>
<option value="random"<?selected('order_by','random')?>>Random</option>
</select>
<select name="order_way">
<option value="desc"<?selected('order_way','desc')?>>Descending</option>