Add:Smart audio track order based on best match track and disc #155

This commit is contained in:
advplyr 2022-01-09 17:36:25 -06:00
parent c22eaae3bf
commit afd2b8c98f
6 changed files with 171 additions and 85 deletions

View file

@ -14,8 +14,9 @@ class AudioFile {
this.addedAt = null
this.trackNumFromMeta = null
this.discNumFromMeta = null
this.trackNumFromFilename = null
this.cdNumFromFilename = null
this.discNumFromFilename = null
this.format = null
this.duration = null
@ -42,16 +43,6 @@ class AudioFile {
}
}
// Sort number takes cd num into account
// get sortNumber() {
// if (this.manuallyVerified) return this.index
// var num = this.index
// if (this.cdNumFromFilename && !isNaN(this.cdNumFromFilename)) {
// num += (Number(this.cdNumFromFilename) * 1000)
// }
// return num
// }
toJSON() {
return {
index: this.index,
@ -62,8 +53,9 @@ class AudioFile {
fullPath: this.fullPath,
addedAt: this.addedAt,
trackNumFromMeta: this.trackNumFromMeta,
discNumFromMeta: this.discNumFromMeta,
trackNumFromFilename: this.trackNumFromFilename,
cdNumFromFilename: this.cdNumFromFilename,
discNumFromFilename: this.discNumFromFilename,
manuallyVerified: !!this.manuallyVerified,
invalid: !!this.invalid,
exclude: !!this.exclude,
@ -97,8 +89,11 @@ class AudioFile {
this.error = data.error || null
this.trackNumFromMeta = data.trackNumFromMeta
this.discNumFromMeta = data.discNumFromMeta
this.trackNumFromFilename = data.trackNumFromFilename
this.cdNumFromFilename = data.cdNumFromFilename
if (data.cdNumFromFilename !== undefined) this.discNumFromFilename = data.cdNumFromFilename // TEMP:Support old var name
else this.discNumFromFilename = data.discNumFromFilename
this.format = data.format
this.duration = data.duration
@ -132,8 +127,9 @@ class AudioFile {
this.addedAt = Date.now()
this.trackNumFromMeta = fileData.trackNumFromMeta
this.discNumFromMeta = fileData.discNumFromMeta
this.trackNumFromFilename = fileData.trackNumFromFilename
this.cdNumFromFilename = fileData.cdNumFromFilename
this.discNumFromFilename = fileData.discNumFromFilename
this.format = probeData.format
this.duration = probeData.duration

View file

@ -7,6 +7,7 @@ class AudioFileMetadata {
this.tagSeries = null
this.tagSeriesPart = null
this.tagTrack = null
this.tagDisc = null
this.tagSubtitle = null
this.tagAlbumArtist = null
this.tagDate = null
@ -42,6 +43,7 @@ class AudioFileMetadata {
this.tagSeries = metadata.tagSeries || null
this.tagSeriesPart = metadata.tagSeriesPart || null
this.tagTrack = metadata.tagTrack || null
this.tagDisc = metadata.tagDisc || null
this.tagSubtitle = metadata.tagSubtitle || null
this.tagAlbumArtist = metadata.tagAlbumArtist || null
this.tagDate = metadata.tagDate || null
@ -63,6 +65,7 @@ class AudioFileMetadata {
this.tagSeries = payload.file_tag_series || null
this.tagSeriesPart = payload.file_tag_seriespart || null
this.tagTrack = payload.file_tag_track || null
this.tagDisc = payload.file_tag_disc || null
this.tagSubtitle = payload.file_tag_subtitle || null
this.tagAlbumArtist = payload.file_tag_albumartist || null
this.tagDate = payload.file_tag_date || null
@ -84,6 +87,7 @@ class AudioFileMetadata {
tagSeries: payload.file_tag_series || null,
tagSeriesPart: payload.file_tag_seriespart || null,
tagTrack: payload.file_tag_track || null,
tagDisc: payload.file_tag_disc || null,
tagSubtitle: payload.file_tag_subtitle || null,
tagAlbumArtist: payload.file_tag_albumartist || null,
tagDate: payload.file_tag_date || null,