2022-03-17 18:25:12 +01:00
|
|
|
<template>
|
|
|
|
<div class="w-full">
|
|
|
|
<div v-if="missingParts.length" class="bg-error border-red-800 shadow-md p-4">
|
|
|
|
<p class="text-sm mb-2">
|
2022-11-08 15:37:39 +01:00
|
|
|
{{ $strings.LabelMissingParts }} <span class="text-sm">({{ missingParts.length }})</span>
|
2022-03-17 18:25:12 +01:00
|
|
|
</p>
|
|
|
|
<p class="text-sm font-mono">{{ missingPartChunks.join(', ') }}</p>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div v-if="invalidParts.length" class="bg-error border-red-800 shadow-md p-4">
|
|
|
|
<p class="text-sm mb-2">
|
2022-11-08 15:37:39 +01:00
|
|
|
{{ $strings.LabelInvalidParts }} <span class="text-sm">({{ invalidParts.length }})</span>
|
2022-03-17 18:25:12 +01:00
|
|
|
</p>
|
|
|
|
<div>
|
|
|
|
<p v-for="part in invalidParts" :key="part.filename" class="text-sm font-mono">{{ part.filename }}: {{ part.error }}</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2023-04-16 01:09:49 +02:00
|
|
|
<tables-tracks-table :title="$strings.LabelStatsAudioTracks" :tracks="tracksWithAudioFile" :is-file="isFile" :library-item-id="libraryItemId" class="mt-6" />
|
2022-03-17 18:25:12 +01:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
2022-03-26 17:59:34 +01:00
|
|
|
libraryItemId: String,
|
|
|
|
media: {
|
2022-03-17 18:25:12 +01:00
|
|
|
type: Object,
|
|
|
|
default: () => {}
|
2022-04-28 02:42:34 +02:00
|
|
|
},
|
|
|
|
isFile: Boolean
|
2022-03-17 18:25:12 +01:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {}
|
|
|
|
},
|
|
|
|
computed: {
|
2023-04-16 01:09:49 +02:00
|
|
|
tracksWithAudioFile() {
|
|
|
|
return this.media.tracks.map((track) => {
|
|
|
|
track.audioFile = this.media.audioFiles.find((af) => af.metadata.path === track.metadata.path)
|
|
|
|
return track
|
|
|
|
})
|
|
|
|
},
|
2022-03-17 18:25:12 +01:00
|
|
|
missingPartChunks() {
|
|
|
|
if (this.missingParts === 1) return this.missingParts[0]
|
|
|
|
var chunks = []
|
|
|
|
|
|
|
|
var currentIndex = this.missingParts[0]
|
|
|
|
var currentChunk = [this.missingParts[0]]
|
|
|
|
|
|
|
|
for (let i = 1; i < this.missingParts.length; i++) {
|
|
|
|
var partIndex = this.missingParts[i]
|
|
|
|
if (currentIndex === partIndex - 1) {
|
|
|
|
currentChunk.push(partIndex)
|
|
|
|
currentIndex = partIndex
|
|
|
|
} else {
|
|
|
|
// console.log('Chunk ended', currentChunk.join(', '), currentIndex, partIndex)
|
|
|
|
if (currentChunk.length === 0) {
|
|
|
|
console.error('How is current chunk 0?', currentChunk.join(', '))
|
|
|
|
}
|
|
|
|
chunks.push(currentChunk)
|
|
|
|
currentChunk = [partIndex]
|
|
|
|
currentIndex = partIndex
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (currentChunk.length) {
|
|
|
|
chunks.push(currentChunk)
|
|
|
|
}
|
|
|
|
chunks = chunks.map((chunk) => {
|
|
|
|
if (chunk.length === 1) return chunk[0]
|
|
|
|
else return `${chunk[0]}-${chunk[chunk.length - 1]}`
|
|
|
|
})
|
|
|
|
return chunks
|
|
|
|
},
|
|
|
|
missingParts() {
|
2022-03-26 17:59:34 +01:00
|
|
|
return this.media.missingParts || []
|
2022-03-17 18:25:12 +01:00
|
|
|
},
|
|
|
|
invalidParts() {
|
2022-03-26 17:59:34 +01:00
|
|
|
return this.media.invalidParts || []
|
2022-03-17 18:25:12 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {},
|
|
|
|
mounted() {}
|
|
|
|
}
|
|
|
|
</script>
|