Commit d8b7a474 authored by anton's avatar anton
Browse files

Update from release_2_1

parents 2fbb595c bae2ab52
Pipeline #63759 passed with stage
in 3 minutes and 32 seconds
......@@ -10,7 +10,14 @@ and this project adheres to
## [Unreleased]
No changes.
### Added
- Add media screen uses `publishedAt` field from YouTube metadata as initial
reference date, if available (e.g. live streams)
### Fixed
- Exception on edit media screen when media duration is unknown
## [2.1.2] - 2020-05-29
......
......@@ -5,7 +5,7 @@
headline(:content="$t('routes.piecemaker.media.create.title')")
content-paragraph(:position="'first'")
calendar-time-main(v-if="mayAdd", @update="onCalendarUpdate")
calendar-time-main(v-if="mayAdd", :datetime="selectorValue", @update="onCalendarUpdate")
content-paragraph(:position="'last'")
form-main(v-if="mayAdd", v-model="payload", :schema="schema", ref="mediaForm")
......@@ -37,7 +37,7 @@
},
methods: {
onCalendarUpdate (val) {
this.selectorTime = val
this.selectorValue = val
}
},
data () {
......@@ -48,7 +48,7 @@
// FIXME: i know this is bullshit!!! (but i hope it works for now)
apiPayload: undefined,
payload: { url: undefined, title: undefined },
selectorTime: undefined,
selectorValue: undefined,
schema: {
fields: {
url: {
......@@ -71,8 +71,13 @@
}
})
let
start = _this.selectorTime || DateTime.local().toString(),
start = _this.selectorValue || DateTime.local().toString(),
end
if (metadata && metadata.publishedAt) {
_this.selectorValue = DateTime.fromISO(metadata.publishedAt, { setZone: true }).toISO()
start = _this.selectorValue
}
else start = DateTime.local().toString()
if (metadata && metadata.duration) {
end = DateTime.fromISO(start, {setZone: true}).plus(metadata.duration * 1000).toISO()
}
......
......@@ -70,8 +70,8 @@
},
duration () {
if (this.annotation && this.annotation.target.selector) {
console.log(this.annotation.target.selector)
return this.annotation.target.selector.getDuration().toFormat(constants.config.TIMECODE_FORMAT_DURATION)
const duration = this.annotation.target.selector.getDuration()
if (duration) return duration.toFormat(constants.config.TIMECODE_FORMAT_DURATION)
}
}
},
......
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