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:
An Phan 2016-03-24 11:01:33 +08:00
commit 40c4dfbc78
2 changed files with 11 additions and 4 deletions

View file

@ -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' => '',

View file

@ -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: {},
};