2022-03-26 21:23:25 +01:00
|
|
|
<template>
|
|
|
|
<div class="w-full h-full overflow-y-auto overflow-x-hidden px-4 py-6">
|
|
|
|
<div class="w-full mb-4">
|
2022-03-27 22:37:04 +02:00
|
|
|
<!-- <div class="flex items-center mb-4">
|
2022-03-27 01:58:59 +01:00
|
|
|
<p v-if="autoDownloadEpisodes">Last new episode check {{ $formatDate(lastEpisodeCheck) }}</p>
|
|
|
|
<div class="flex-grow" />
|
|
|
|
<ui-btn :loading="checkingNewEpisodes" @click="checkForNewEpisodes">Check for new episodes</ui-btn>
|
2022-03-27 22:37:04 +02:00
|
|
|
</div> -->
|
2022-03-27 01:58:59 +01:00
|
|
|
|
2022-03-26 21:23:25 +01:00
|
|
|
<div class="w-full p-4 bg-primary">
|
|
|
|
<p>Podcast Episodes</p>
|
|
|
|
</div>
|
|
|
|
<div v-if="!episodes.length" class="flex my-4 text-center justify-center text-xl">No Episodes</div>
|
|
|
|
<table v-else class="text-sm tracksTable">
|
|
|
|
<tr class="font-book">
|
2022-04-13 15:29:31 +02:00
|
|
|
<th class="text-left">Sort #</th>
|
|
|
|
<th class="text-left">Episode #</th>
|
2022-03-26 21:23:25 +01:00
|
|
|
<th class="text-left">Title</th>
|
|
|
|
<th class="text-center w-28">Duration</th>
|
|
|
|
<th class="text-center w-28">Size</th>
|
|
|
|
</tr>
|
|
|
|
<tr v-for="episode in episodes" :key="episode.id">
|
|
|
|
<td class="text-left">
|
|
|
|
<p class="px-4">{{ episode.index }}</p>
|
|
|
|
</td>
|
2022-04-13 15:29:31 +02:00
|
|
|
<td class="text-left">
|
|
|
|
<p class="px-4">{{ episode.episode }}</p>
|
|
|
|
</td>
|
2022-03-26 21:23:25 +01:00
|
|
|
<td class="font-book">
|
|
|
|
{{ episode.title }}
|
|
|
|
</td>
|
|
|
|
<td class="font-mono text-center">
|
|
|
|
{{ $secondsToTimestamp(episode.duration) }}
|
|
|
|
</td>
|
|
|
|
<td class="font-mono text-center">
|
|
|
|
{{ $bytesPretty(episode.size) }}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
libraryItem: {
|
|
|
|
type: Object,
|
|
|
|
default: () => {}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
data() {
|
2022-03-27 01:58:59 +01:00
|
|
|
return {
|
|
|
|
checkingNewEpisodes: false
|
|
|
|
}
|
2022-03-26 21:23:25 +01:00
|
|
|
},
|
|
|
|
computed: {
|
2022-03-27 01:58:59 +01:00
|
|
|
autoDownloadEpisodes() {
|
|
|
|
return !!this.media.autoDownloadEpisodes
|
|
|
|
},
|
|
|
|
lastEpisodeCheck() {
|
|
|
|
return this.media.lastEpisodeCheck
|
|
|
|
},
|
2022-03-26 21:23:25 +01:00
|
|
|
media() {
|
|
|
|
return this.libraryItem ? this.libraryItem.media || {} : {}
|
|
|
|
},
|
2022-03-27 01:58:59 +01:00
|
|
|
libraryItemId() {
|
|
|
|
return this.libraryItem ? this.libraryItem.id : null
|
|
|
|
},
|
2022-03-26 21:23:25 +01:00
|
|
|
episodes() {
|
|
|
|
return this.media.episodes || []
|
|
|
|
}
|
|
|
|
},
|
2022-03-27 01:58:59 +01:00
|
|
|
methods: {
|
|
|
|
checkForNewEpisodes() {
|
|
|
|
this.checkingNewEpisodes = true
|
|
|
|
this.$axios
|
|
|
|
.$get(`/api/podcasts/${this.libraryItemId}/checknew`)
|
|
|
|
.then((response) => {
|
|
|
|
if (response.episodes && response.episodes.length) {
|
|
|
|
console.log('New episodes', response.episodes.length)
|
|
|
|
this.$toast.success(`${response.episodes.length} new episodes found!`)
|
|
|
|
} else {
|
|
|
|
this.$toast.info('No new episodes found')
|
|
|
|
}
|
|
|
|
this.checkingNewEpisodes = false
|
|
|
|
})
|
|
|
|
.catch((error) => {
|
|
|
|
console.error('Failed', error)
|
|
|
|
var errorMsg = error.response && error.response.data ? error.response.data : 'Unknown Error'
|
|
|
|
this.$toast.error(errorMsg)
|
|
|
|
this.checkingNewEpisodes = false
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2022-03-26 21:23:25 +01:00
|
|
|
}
|
|
|
|
</script>
|