mirror of
https://github.com/koel/koel
synced 2024-11-10 22:54:16 +00:00
Merge branch 'fix/default-sorting-track-parsing' of git://github.com/alex-phillips/koel into alex-phillips-fix/default-sorting-track-parsing
This commit is contained in:
commit
40c4dfbc78
2 changed files with 11 additions and 4 deletions
|
@ -98,12 +98,19 @@ class File
|
|||
return;
|
||||
}
|
||||
|
||||
$track = array_get($info, 'comments.track_number', [0])[0];
|
||||
$track = 0;
|
||||
$trackIndices = [
|
||||
'comments.track',
|
||||
'comments.tracknumber',
|
||||
'comments.track_number',
|
||||
];
|
||||
for ($i = 0; $i < count($trackIndices) && $track === 0; $i++) {
|
||||
$track = array_get($info, $trackIndices[$i], [0])[0];
|
||||
}
|
||||
if (preg_match('#(\d+)/#', $track, $matches)) {
|
||||
$track = $matches[1];
|
||||
} elseif ((int) $track) {
|
||||
$track = (int) $track;
|
||||
}
|
||||
$track = (int) $track;
|
||||
|
||||
$props = [
|
||||
'artist' => '',
|
||||
|
|
|
@ -82,7 +82,7 @@
|
|||
return {
|
||||
lastSelectedRow: null,
|
||||
q: '', // The filter query
|
||||
sortKey: this.type === 'top-songs' ? 'playCount' : '',
|
||||
sortKey: this.type === 'top-songs' ? 'playCount' : ['album.artist.name', 'album.name', 'track'],
|
||||
order: this.type === 'top-songs' ? -1 : 1,
|
||||
componentCache: {},
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue