Commit 84b0ab47 authored by anton's avatar anton
Browse files

Allow setting of duration later on edit media screen

parent e80b98ef
Pipeline #63785 passed with stage
in 4 minutes and 42 seconds
......@@ -15,6 +15,7 @@ and this project adheres to
- Add media screen uses `publishedAt` field from YouTube metadata as initial
reference date, if available (e.g. live streams)
- `Live` indicator for YouTube live streams in post-annotator
- Edit media screen allows adding duration for live streams once archived
### Changed
......
......@@ -8,6 +8,7 @@ export default {
abort: 'Abort',
apply_synchronisation: 'Apply Synchronisation',
annotate: 'Annotate',
add_duration: 'Add duration',
add_term: 'Add Term',
add_media: 'Add Media',
add_vocabulary: 'Add Vocabulary',
......@@ -480,7 +481,8 @@ export default {
},
edit: {
title: 'Edit media',
caption: 'Edit media details.'
caption: 'Edit media details.',
duration_found: 'Media currently has no duration but a duration was found for it.'
},
create: {
title: 'Add Media',
......
......@@ -5,6 +5,9 @@
headline(:content="$t('routes.piecemaker.media.edit.title') + ':'")
| {{ payload.title }} ({{ duration }})
.q-mb-lg
q-alert(color="info" :actions="actions" v-if="showDurationOverride") {{ $t('routes.piecemaker.media.edit.duration_found') }}
content-paragraph(v-if="acl.put", :position="'first'")
calendar-time-main(:datetime="selectorValue", @update="onCalendarUpdate")
......@@ -107,9 +110,19 @@
data () {
const context = this
return {
actions: [
{
label: this.$t('buttons.add_duration'),
handler () {
context.durationOverride = context.meta.duration * 1000
}
}
],
acl: {},
apiPayload: undefined,
selectorOverride: undefined,
showDurationOverride: false,
durationOverride: undefined,
titlePayload: undefined,
media: undefined,
meta: undefined,
......@@ -119,9 +132,17 @@
.then(async result => {
context.$q.loading.show()
if (result.target.selector) {
const duration = result.target.selector.getDuration()
if (!duration) {
this.meta = await this.$store.dispatch('metadata/get', result)
this.showDurationOverride = !!this.meta.duration
}
else this.meta = await this.$store.dispatch('metadata/getLocal', result)
}
this.annotation = result
this.map = await this.$store.dispatch('maps/get', parseURI(result.target.id).uuid)
this.meta = await this.$store.dispatch('metadata/getLocal', result)
this.titlePayload = this.meta.titleAnnotation
const tags = await this.$store.dispatch('tags/get', result)
......@@ -180,6 +201,7 @@
await titleHelper.update(context.$store, context.titlePayload.id, context.payload.title)
}
let selector
if (context.durationOverride) context.annotation.target.selector._valueDuration = context.durationOverride
if (context.selectorOverride) {
const
durationMs = context.annotation.target.selector._valueDuration,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment