mirror of
https://github.com/koel/koel
synced 2024-11-24 13:13:05 +00:00
added multiple methods to retrieve the 'track' from a file, set default sorting on the song lists
This commit is contained in:
parent
e5778d1896
commit
e3277f14ad
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