2021-10-16 03:31:00 +02:00
|
|
|
<template>
|
|
|
|
<div class="w-full h-full overflow-y-auto overflow-x-hidden px-4 py-6">
|
2021-11-18 02:19:24 +01:00
|
|
|
<div class="mb-4">
|
|
|
|
<template v-if="hasTracks">
|
|
|
|
<div class="w-full bg-primary px-4 py-2 flex items-center">
|
|
|
|
<p class="pr-4">Audio Tracks</p>
|
|
|
|
<div class="h-7 w-7 rounded-full bg-white bg-opacity-10 flex items-center justify-center">
|
|
|
|
<span class="text-sm font-mono">{{ tracks.length }}</span>
|
|
|
|
</div>
|
|
|
|
<div class="flex-grow" />
|
|
|
|
<ui-btn small :color="showFullPath ? 'gray-600' : 'primary'" class="mr-2 hidden md:block" @click.stop="showFullPath = !showFullPath">Full Path</ui-btn>
|
2022-03-11 01:45:02 +01:00
|
|
|
<nuxt-link v-if="userCanUpdate" :to="`/item/${libraryItem.id}/edit`">
|
2021-11-18 02:19:24 +01:00
|
|
|
<ui-btn small color="primary">Manage Tracks</ui-btn>
|
|
|
|
</nuxt-link>
|
|
|
|
</div>
|
2022-03-13 00:45:32 +01:00
|
|
|
<table class="text-sm tracksTable break-all">
|
2021-11-18 02:19:24 +01:00
|
|
|
<tr class="font-book">
|
2022-03-13 00:45:32 +01:00
|
|
|
<th class="w-16">#</th>
|
2021-11-18 02:19:24 +01:00
|
|
|
<th class="text-left">Filename</th>
|
2022-03-13 00:45:32 +01:00
|
|
|
<th class="text-left w-24 min-w-24">Size</th>
|
|
|
|
<th class="text-left w-24 min-w-24">Duration</th>
|
|
|
|
<th v-if="showDownload" class="text-center w-24 min-w-24">Download</th>
|
2021-11-18 02:19:24 +01:00
|
|
|
</tr>
|
2022-03-11 01:45:02 +01:00
|
|
|
<template v-for="track in tracks">
|
2021-11-18 02:19:24 +01:00
|
|
|
<tr :key="track.index">
|
|
|
|
<td class="text-center">
|
|
|
|
<p>{{ track.index }}</p>
|
|
|
|
</td>
|
2022-03-13 00:45:32 +01:00
|
|
|
<td class="font-sans">{{ showFullPath ? track.metadata.path : track.metadata.filename }}</td>
|
2021-11-18 02:19:24 +01:00
|
|
|
<td class="font-mono">
|
2022-03-11 01:45:02 +01:00
|
|
|
{{ $bytesPretty(track.metadata.size) }}
|
2021-11-18 02:19:24 +01:00
|
|
|
</td>
|
|
|
|
<td class="font-mono">
|
|
|
|
{{ $secondsToTimestamp(track.duration) }}
|
|
|
|
</td>
|
|
|
|
<td v-if="showDownload" class="font-mono text-center">
|
2022-03-11 01:45:02 +01:00
|
|
|
<a :href="`/s/item/${libraryItem.id}/${track.metadata.relPath}?token=${userToken}`" download><span class="material-icons icon-text">download</span></a>
|
2021-11-18 02:19:24 +01:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</template>
|
|
|
|
</table>
|
|
|
|
</template>
|
|
|
|
<div v-else class="flex my-4 text-center justify-center text-xl">No Audio Tracks</div>
|
|
|
|
</div>
|
|
|
|
|
2022-03-11 01:45:02 +01:00
|
|
|
<tables-library-files-table :files="libraryFiles" :library-item-id="libraryItem.id" :is-missing="isMissing" />
|
2021-10-16 03:31:00 +02:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
2022-03-11 01:45:02 +01:00
|
|
|
libraryItem: {
|
2021-10-16 03:31:00 +02:00
|
|
|
type: Object,
|
|
|
|
default: () => {}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
2021-11-18 02:19:24 +01:00
|
|
|
return {
|
2022-03-11 01:45:02 +01:00
|
|
|
tracks: [],
|
2021-11-18 02:19:24 +01:00
|
|
|
showFullPath: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
watch: {
|
2022-03-11 01:45:02 +01:00
|
|
|
libraryItem: {
|
2021-11-18 02:19:24 +01:00
|
|
|
immediate: true,
|
|
|
|
handler(newVal) {
|
|
|
|
if (newVal) this.init()
|
|
|
|
}
|
|
|
|
}
|
2021-10-16 03:31:00 +02:00
|
|
|
},
|
2021-11-18 02:19:24 +01:00
|
|
|
computed: {
|
2022-03-11 01:45:02 +01:00
|
|
|
media() {
|
|
|
|
return this.libraryItem.media || {}
|
2021-11-18 02:19:24 +01:00
|
|
|
},
|
2022-03-11 01:45:02 +01:00
|
|
|
libraryFiles() {
|
|
|
|
return this.libraryItem.libraryFiles || []
|
2021-11-18 02:19:24 +01:00
|
|
|
},
|
|
|
|
userToken() {
|
|
|
|
return this.$store.getters['user/getToken']
|
|
|
|
},
|
|
|
|
userCanUpdate() {
|
|
|
|
return this.$store.getters['user/getUserCanUpdate']
|
|
|
|
},
|
|
|
|
userCanDownload() {
|
|
|
|
return this.$store.getters['user/getUserCanDownload']
|
|
|
|
},
|
|
|
|
isMissing() {
|
2022-03-11 01:45:02 +01:00
|
|
|
return this.libraryItem.isMissing
|
2021-11-18 02:19:24 +01:00
|
|
|
},
|
|
|
|
showDownload() {
|
|
|
|
return this.userCanDownload && !this.isMissing
|
|
|
|
},
|
|
|
|
hasTracks() {
|
2022-03-11 01:45:02 +01:00
|
|
|
return this.tracks.length
|
2021-11-18 02:19:24 +01:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
init() {
|
2022-03-11 01:45:02 +01:00
|
|
|
this.tracks = this.media.tracks || []
|
2021-11-18 02:19:24 +01:00
|
|
|
}
|
|
|
|
}
|
2021-10-16 03:31:00 +02:00
|
|
|
}
|
|
|
|
</script>
|