Added support for ponify in classifier

This commit is contained in:
Josef Citrine 2017-05-18 18:25:07 +01:00
parent 4e2b2f90ec
commit 2de284963e

View file

@ -333,6 +333,14 @@ class TracksController extends ApiControllerBase
$query->whereIn('track_type_id', Request::get('types')); $query->whereIn('track_type_id', Request::get('types'));
} }
$archive = null;
if (Request::has('archive')) {
// Select which archive to view
$archive = Request::get('archive');
$query->where('source', $archive);
}
if ($unknown) { if ($unknown) {
$query->where(function ($q) { $query->where(function ($q) {
$unknownGenre = Genre::where('name', 'Unknown')->first(); $unknownGenre = Genre::where('name', 'Unknown')->first();
@ -344,7 +352,11 @@ class TracksController extends ApiControllerBase
} }
}); });
$query->join('mlpma_tracks', 'tracks.id', '=', 'mlpma_tracks.track_id'); if ($archive == "mlpma") {
$query->join('mlpma_tracks', 'tracks.id', '=', 'mlpma_tracks.track_id');
} elseif ($archive == "ponify") {
$query->join('ponify_tracks', 'tracks.id', '=', 'ponify_tracks.track_id');
}
} }
if (Request::has('songs')) { if (Request::has('songs')) {
@ -357,11 +369,6 @@ class TracksController extends ApiControllerBase
$query->whereIn('show_song_track.show_song_id', Request::get('songs')); $query->whereIn('show_song_track.show_song_id', Request::get('songs'));
} }
if (Request::has('archive')) {
// Select which archive to view
$query->where('source', Request::get('archive'));
}
return $query; return $query;
} }
} }