Browse Source

Fix artists in ajax search

spaghetti 7 years ago
parent
commit
76b115be0d
1 changed files with 18 additions and 22 deletions
  1. 18
    22
      sections/ajax/browse.php

+ 18
- 22
sections/ajax/browse.php View File

@@ -25,9 +25,9 @@ if ($Results === false) {
25 25
 }
26 26
 
27 27
 if ($NumResults == 0) {
28
-  json_die("success", array(
28
+  json_die("success", [
29 29
     'results' => []
30
-  ));
30
+  ]);
31 31
 }
32 32
 
33 33
 $Bookmarks = Bookmarks::all_bookmarks('torrent');
@@ -39,8 +39,7 @@ foreach ($Results as $Key => $GroupID) {
39 39
     continue;
40 40
   }
41 41
   $CategoryID = $GroupInfo['CategoryID'];
42
-//  $ExtendedArtists = $GroupInfo['ExtendedArtists'];
43
-  $ExtendedArtists = $GroupInfo['Artists'];
42
+  $Artists = $GroupInfo['Artists'];
44 43
   $GroupCatalogueNumber = $GroupInfo['CatalogueNumber'];
45 44
   $GroupName = $GroupInfo['Name'];
46 45
   if ($GroupResults) {
@@ -55,31 +54,27 @@ foreach ($Results as $Key => $GroupID) {
55 54
     }
56 55
   } else {
57 56
     $TorrentID = $Key;
58
-    $Torrents = array($TorrentID => $GroupInfo['Torrents'][$TorrentID]);
57
+    $Torrents = [$TorrentID => $GroupInfo['Torrents'][$TorrentID]];
59 58
   }
60 59
 
61 60
   $TagList = explode(' ', str_replace('_', '.', $GroupInfo['TagList']));
62 61
   $JsonArtists = [];
63
-  if (!empty($ExtendedArtists[1]) || !empty($ExtendedArtists[4]) || !empty($ExtendedArtists[5]) || !empty($ExtendedArtists[6])) {
64
-    unset($ExtendedArtists[2]);
65
-    unset($ExtendedArtists[3]);
66
-    $DisplayName = Artists::display_artists($ExtendedArtists, false, false, false);
67
-    foreach ($ExtendedArtists[1] as $Artist) {
68
-      $JsonArtists[] = array(
62
+  $DisplayName = '';
63
+  if (!empty($Artists)) {
64
+    $DisplayName = Artists::display_artists($Artists, false, false, false);
65
+    foreach ($Artists as $Artist) {
66
+      $JsonArtists[] = [
69 67
         'id' => (int)$Artist['id'],
70
-        'name' => $Artist['name'],
71
-        'aliasid' => (int)$Artist['id']
72
-      );
68
+        'name' => $Artist['name']
69
+      ];
73 70
     }
74
-  } else {
75
-    $DisplayName = '';
76 71
   }
77 72
 
78 73
   $JsonTorrents = [];
79 74
   foreach ($Torrents as $TorrentID => $Data) {
80 75
     // All of the individual torrents in the group
81 76
 
82
-    $JsonTorrents[] = array(
77
+    $JsonTorrents[] = [
83 78
       'torrentId' =>       (int)$TorrentID,
84 79
       'artists' =>              $JsonArtists,
85 80
       'media' =>                $Data['Media'],
@@ -103,10 +98,10 @@ foreach ($Results as $Key => $GroupID) {
103 98
       'isPersonalFreeleech' =>  $Data['PersonalFL'],
104 99
       'canUseToken' =>          Torrents::can_use_token($Data),
105 100
       'hasSnatched' =>          $Data['IsSnatched']
106
-    );
101
+    ];
107 102
   }
108 103
 
109
-  $JsonGroups[] = array(
104
+  $JsonGroups[] = [
110 105
     'groupId' =>       (int)$GroupID,
111 106
     'groupName' =>          $GroupName,
112 107
     'artist' =>             $DisplayName,
@@ -124,10 +119,11 @@ foreach ($Results as $Key => $GroupID) {
124 119
     'totalSeeders' =>  (int)$TotalSeeders,
125 120
     'totalLeechers' => (int)$TotalLeechers,
126 121
     'torrents' =>           $JsonTorrents
127
-  );
122
+  ];
128 123
 }
129 124
 
130
-json_print('success', array(
125
+json_print('success', [
131 126
   'currentPage' => intval($Page),
132 127
   'pages' => ceil($NumResults / TORRENTS_PER_PAGE),
133
-  'results' => $JsonGroups));
128
+  'results' => $JsonGroups
129
+]);

Loading…
Cancel
Save