Add podcast episode date picker for pubDate

This commit is contained in:
advplyr 2022-04-12 17:32:27 -05:00
parent 469278cd1e
commit b0b1d2707d
4 changed files with 24 additions and 4 deletions

View File

@ -14,7 +14,7 @@
<ui-text-input-with-label v-model="newEpisode.episodeType" label="Episode Type" /> <ui-text-input-with-label v-model="newEpisode.episodeType" label="Episode Type" />
</div> </div>
<div class="w-1/3 p-1"> <div class="w-1/3 p-1">
<ui-text-input-with-label v-model="newEpisode.pubDate" label="Pub Date" /> <ui-text-input-with-label v-model="pubDateInput" @input="updatePubDate" type="datetime-local" label="Pub Date" />
</div> </div>
<div class="w-full p-1"> <div class="w-full p-1">
<ui-text-input-with-label v-model="newEpisode.title" label="Title" /> <ui-text-input-with-label v-model="newEpisode.title" label="Title" />
@ -55,8 +55,10 @@ export default {
title: null, title: null,
subtitle: null, subtitle: null,
description: null, description: null,
pubDate: null pubDate: null,
} publishedAt: null
},
pubDateInput: null
} }
}, },
watch: { watch: {
@ -85,6 +87,15 @@ export default {
} }
}, },
methods: { methods: {
updatePubDate(val) {
if (val) {
this.newEpisode.pubDate = this.$formatJsDate(new Date(val), 'E, d MMM yyyy HH:mm:ssxx')
this.newEpisode.publishedAt = new Date(val).valueOf()
} else {
this.newEpisode.pubDate = null
this.newEpisode.publishedAt = null
}
},
init() { init() {
this.newEpisode.episode = this.episode.episode || '' this.newEpisode.episode = this.episode.episode || ''
this.newEpisode.episodeType = this.episode.episodeType || '' this.newEpisode.episodeType = this.episode.episodeType || ''
@ -92,6 +103,9 @@ export default {
this.newEpisode.subtitle = this.episode.subtitle || '' this.newEpisode.subtitle = this.episode.subtitle || ''
this.newEpisode.description = this.episode.description || '' this.newEpisode.description = this.episode.description || ''
this.newEpisode.pubDate = this.episode.pubDate || '' this.newEpisode.pubDate = this.episode.pubDate || ''
this.newEpisode.publishedAt = this.episode.publishedAt
this.pubDateInput = this.episode.pubDate ? this.$formatJsDate(new Date(this.episode.pubDate), "yyyy-MM-dd'T'HH:mm") : null
}, },
getUpdatePayload() { getUpdatePayload() {
var updatePayload = {} var updatePayload = {}

View File

@ -83,4 +83,7 @@ input:read-only {
color: #bbb; color: #bbb;
background-color: #444; background-color: #444;
} }
input::-webkit-calendar-picker-indicator {
filter: invert(1);
}
</style> </style>

View File

@ -34,7 +34,7 @@ export const getters = {
return state.serverSettings[key] return state.serverSettings[key]
}, },
getBookCoverAspectRatio: state => { getBookCoverAspectRatio: state => {
if (!state.serverSettings || !state.serverSettings.coverAspectRatio) return 1.6 if (!state.serverSettings || !state.serverSettings.coverAspectRatio) return 1
return state.serverSettings.coverAspectRatio === 0 ? 1.6 : 1 return state.serverSettings.coverAspectRatio === 0 ? 1.6 : 1
}, },
getNumLibraryItemsSelected: state => state.selectedLibraryItems.length, getNumLibraryItemsSelected: state => state.selectedLibraryItems.length,

View File

@ -79,6 +79,9 @@ class PodcastManager {
async scanAddPodcastEpisodeAudioFile() { async scanAddPodcastEpisodeAudioFile() {
var libraryFile = await this.getLibraryFile(this.currentDownload.targetPath, this.currentDownload.targetRelPath) var libraryFile = await this.getLibraryFile(this.currentDownload.targetPath, this.currentDownload.targetRelPath)
// TODO: Set meta tags on new audio file
var audioFile = await this.probeAudioFile(libraryFile) var audioFile = await this.probeAudioFile(libraryFile)
if (!audioFile) { if (!audioFile) {
return false return false