2022-05-28 11:38:51 -05:00
|
|
|
<template>
|
|
|
|
<modals-modal v-model="show" name="podcast-episode-view-modal" :width="800" :height="'unset'" :processing="processing">
|
|
|
|
<template #outer>
|
|
|
|
<div class="absolute top-0 left-0 p-5 w-2/3 overflow-hidden">
|
2023-02-11 15:02:56 -06:00
|
|
|
<p class="text-3xl text-white truncate">{{ $strings.LabelEpisode }}</p>
|
2022-05-28 11:38:51 -05:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<div ref="wrapper" class="p-4 w-full text-sm rounded-lg bg-bg shadow-lg border border-black-300 relative overflow-y-auto" style="max-height: 80vh">
|
|
|
|
<div class="flex mb-4">
|
|
|
|
<div class="w-12 h-12">
|
|
|
|
<covers-book-cover :library-item="libraryItem" :width="48" :book-cover-aspect-ratio="bookCoverAspectRatio" />
|
|
|
|
</div>
|
2025-03-16 16:41:37 +02:00
|
|
|
<div class="grow px-2">
|
2022-05-28 11:38:51 -05:00
|
|
|
<p class="text-base mb-1">{{ podcastTitle }}</p>
|
|
|
|
<p class="text-xs text-gray-300">{{ podcastAuthor }}</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
2024-03-28 23:56:59 +02:00
|
|
|
<p dir="auto" class="text-lg font-semibold mb-6">{{ title }}</p>
|
2025-06-18 17:20:36 -05:00
|
|
|
<div v-if="description" dir="auto" class="default-style less-spacing" @click="handleDescriptionClick" v-html="description" />
|
2022-11-08 17:10:08 -06:00
|
|
|
<p v-else class="mb-2">{{ $strings.MessageNoDescription }}</p>
|
2024-11-25 17:26:06 -06:00
|
|
|
|
|
|
|
<div class="w-full h-px bg-white/5 my-4" />
|
|
|
|
|
|
|
|
<div class="flex items-center">
|
2025-03-16 16:41:37 +02:00
|
|
|
<div class="grow">
|
2024-11-25 17:26:06 -06:00
|
|
|
<p class="font-semibold text-xs mb-1">{{ $strings.LabelFilename }}</p>
|
|
|
|
<p class="mb-2 text-xs">
|
|
|
|
{{ audioFileFilename }}
|
|
|
|
</p>
|
|
|
|
</div>
|
2025-03-16 16:41:37 +02:00
|
|
|
<div class="grow">
|
2024-11-25 17:26:06 -06:00
|
|
|
<p class="font-semibold text-xs mb-1">{{ $strings.LabelSize }}</p>
|
|
|
|
<p class="mb-2 text-xs">
|
|
|
|
{{ audioFileSize }}
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-05-28 11:38:51 -05:00
|
|
|
</div>
|
|
|
|
</modals-modal>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
processing: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
show: {
|
|
|
|
get() {
|
|
|
|
return this.$store.state.globals.showViewPodcastEpisodeModal
|
|
|
|
},
|
|
|
|
set(val) {
|
|
|
|
this.$store.commit('globals/setShowViewPodcastEpisodeModal', val)
|
|
|
|
}
|
|
|
|
},
|
|
|
|
libraryItem() {
|
|
|
|
return this.$store.state.selectedLibraryItem
|
|
|
|
},
|
|
|
|
episode() {
|
|
|
|
return this.$store.state.globals.selectedEpisode || {}
|
|
|
|
},
|
|
|
|
episodeId() {
|
|
|
|
return this.episode.id
|
|
|
|
},
|
|
|
|
title() {
|
|
|
|
return this.episode.title || 'No Episode Title'
|
|
|
|
},
|
|
|
|
description() {
|
2025-06-18 17:20:36 -05:00
|
|
|
return this.parseDescription(this.episode.description || '')
|
2022-05-28 11:38:51 -05:00
|
|
|
},
|
|
|
|
media() {
|
2024-11-25 17:26:06 -06:00
|
|
|
return this.libraryItem?.media || {}
|
2022-05-28 11:38:51 -05:00
|
|
|
},
|
|
|
|
mediaMetadata() {
|
|
|
|
return this.media.metadata || {}
|
|
|
|
},
|
|
|
|
podcastTitle() {
|
|
|
|
return this.mediaMetadata.title
|
|
|
|
},
|
|
|
|
podcastAuthor() {
|
|
|
|
return this.mediaMetadata.author
|
|
|
|
},
|
2024-11-25 17:26:06 -06:00
|
|
|
audioFileFilename() {
|
|
|
|
return this.episode.audioFile?.metadata?.filename || ''
|
|
|
|
},
|
|
|
|
audioFileSize() {
|
|
|
|
const size = this.episode.audioFile?.metadata?.size || 0
|
|
|
|
|
|
|
|
return this.$bytesPretty(size)
|
|
|
|
},
|
2022-05-28 11:38:51 -05:00
|
|
|
bookCoverAspectRatio() {
|
2022-08-13 13:56:37 -05:00
|
|
|
return this.$store.getters['libraries/getBookCoverAspectRatio']
|
2022-05-28 11:38:51 -05:00
|
|
|
}
|
|
|
|
},
|
2025-06-18 17:20:36 -05:00
|
|
|
methods: {
|
|
|
|
handleDescriptionClick(e) {
|
|
|
|
if (e.target.matches('span.time-marker')) {
|
|
|
|
const time = parseInt(e.target.dataset.time)
|
|
|
|
if (!isNaN(time)) {
|
|
|
|
this.$eventBus.$emit('play-item', {
|
|
|
|
episodeId: this.episodeId,
|
|
|
|
libraryItemId: this.libraryItem.id,
|
|
|
|
startTime: time
|
|
|
|
})
|
|
|
|
}
|
|
|
|
e.preventDefault()
|
|
|
|
}
|
|
|
|
},
|
|
|
|
parseDescription(description) {
|
|
|
|
const timeMarkerLinkRegex = /<a href="#([^"]*?\b\d{1,2}:\d{1,2}(?::\d{1,2})?)">(.*?)<\/a>/g
|
|
|
|
const timeMarkerRegex = /\b\d{1,2}:\d{1,2}(?::\d{1,2})?\b/g
|
|
|
|
|
|
|
|
function convertToSeconds(time) {
|
|
|
|
const timeParts = time.split(':').map(Number)
|
|
|
|
return timeParts.reduce((acc, part, index) => acc * 60 + part, 0)
|
|
|
|
}
|
|
|
|
|
|
|
|
return description
|
|
|
|
.replace(timeMarkerLinkRegex, (match, href, displayTime) => {
|
|
|
|
const time = displayTime.match(timeMarkerRegex)[0]
|
|
|
|
const seekTimeInSeconds = convertToSeconds(time)
|
|
|
|
return `<span class="time-marker cursor-pointer text-blue-400 hover:text-blue-300" data-time="${seekTimeInSeconds}">${displayTime}</span>`
|
|
|
|
})
|
|
|
|
.replace(timeMarkerRegex, (match) => {
|
|
|
|
const seekTimeInSeconds = convertToSeconds(match)
|
|
|
|
return `<span class="time-marker cursor-pointer text-blue-400 hover:text-blue-300" data-time="${seekTimeInSeconds}">${match}</span>`
|
|
|
|
})
|
|
|
|
}
|
|
|
|
},
|
2022-05-28 11:38:51 -05:00
|
|
|
mounted() {}
|
|
|
|
}
|
|
|
|
</script>
|