get values from rootState, process playlist with day start as seconds
This commit is contained in:
parent
d7ad26eb90
commit
51b42abf53
@ -369,20 +369,21 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
...mapState('config', ['configID', 'configGui', 'configPlayout', 'timezone']),
|
...mapState('config', ['configID', 'configGui', 'configPlayout', 'timezone']),
|
||||||
...mapState('media', ['crumbs', 'folderTree']),
|
...mapState('media', ['crumbs', 'folderTree']),
|
||||||
...mapState('playlist', ['timeStr', 'timeLeft', 'currentClip', 'progressValue', 'currentClipIndex', 'currentClipDuration', 'currentClipIn', 'currentClipOut']),
|
...mapState('playlist', [
|
||||||
|
'timeStr', 'timeLeft', 'currentClip', 'progressValue', 'currentClipIndex',
|
||||||
|
'currentClipDuration', 'currentClipIn', 'currentClipOut', 'startInSec']),
|
||||||
playlist: {
|
playlist: {
|
||||||
get () {
|
get () {
|
||||||
return this.$store.state.playlist.playlist
|
return this.$store.state.playlist.playlist
|
||||||
},
|
},
|
||||||
set (list) {
|
set (list) {
|
||||||
this.$store.commit('playlist/UPDATE_PLAYLIST', this.$processPlaylist(
|
this.$store.commit('playlist/UPDATE_PLAYLIST', this.$processPlaylist(this.startInSec, list))
|
||||||
this.configPlayout.playlist.day_start, list))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
listDate (date) {
|
listDate () {
|
||||||
this.getPlaylist()
|
this.getPlaylist()
|
||||||
setTimeout(() => { scrollTo(this) }, 5000)
|
setTimeout(() => { scrollTo(this) }, 5000)
|
||||||
},
|
},
|
||||||
@ -465,11 +466,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
async getPlaylist () {
|
async getPlaylist () {
|
||||||
await this.$store.dispatch('playlist/getPlaylist', {
|
await this.$store.dispatch('playlist/getPlaylist', { date: this.listDate })
|
||||||
dayStart: this.configPlayout.playlist.day_start,
|
|
||||||
date: this.listDate,
|
|
||||||
configPath: this.configGui[this.configID].playout_config
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
showPreviewModal (src) {
|
showPreviewModal (src) {
|
||||||
@ -519,24 +516,18 @@ export default {
|
|||||||
this.playlist[index].out = sec
|
this.playlist[index].out = sec
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$store.commit('playlist/UPDATE_PLAYLIST', this.$processPlaylist(
|
this.$store.commit('playlist/UPDATE_PLAYLIST', this.$processPlaylist(this.startInSec, this.playlist))
|
||||||
this.configPlayout.playlist.day_start, this.playlist))
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
removeItemFromPlaylist (index) {
|
removeItemFromPlaylist (index) {
|
||||||
this.playlist.splice(index, 1)
|
this.playlist.splice(index, 1)
|
||||||
|
|
||||||
this.$store.commit('playlist/UPDATE_PLAYLIST', this.$processPlaylist(
|
this.$store.commit('playlist/UPDATE_PLAYLIST', this.$processPlaylist(this.startInSec, this.playlist))
|
||||||
this.configPlayout.playlist.day_start, this.playlist))
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async resetPlaylist () {
|
async resetPlaylist () {
|
||||||
await this.$store.dispatch('playlist/getPlaylist', {
|
await this.$store.dispatch('playlist/getPlaylist', { date: this.listDate })
|
||||||
dayStart: this.configPlayout.playlist.day_start,
|
|
||||||
date: this.listDate,
|
|
||||||
configPath: this.configGui[this.configID].playout_config
|
|
||||||
})
|
|
||||||
},
|
},
|
||||||
|
|
||||||
loopClips () {
|
loopClips () {
|
||||||
@ -554,13 +545,11 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.$store.commit('playlist/UPDATE_PLAYLIST', this.$processPlaylist(
|
this.$store.commit('playlist/UPDATE_PLAYLIST', this.$processPlaylist(this.startInSec, tempList))
|
||||||
this.configPlayout.playlist.day_start, tempList))
|
|
||||||
},
|
},
|
||||||
|
|
||||||
async savePlaylist (saveDate) {
|
async savePlaylist (saveDate) {
|
||||||
this.$store.commit('playlist/UPDATE_PLAYLIST', this.$processPlaylist(
|
this.$store.commit('playlist/UPDATE_PLAYLIST', this.$processPlaylist(this.startInSec, this.playlist))
|
||||||
this.configPlayout.playlist.day_start, this.playlist))
|
|
||||||
|
|
||||||
const saveList = this.playlist.map(({ begin, ...item }) => item)
|
const saveList = this.playlist.map(({ begin, ...item }) => item)
|
||||||
|
|
||||||
|
@ -51,8 +51,9 @@ export const mutations = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const actions = {
|
export const actions = {
|
||||||
async getPlaylist ({ commit, dispatch, state, rootState }, { dayStart, date, configPath }) {
|
async getPlaylist ({ commit, dispatch, state, rootState }, { date }) {
|
||||||
const timeInSec = this.$timeToSeconds(this.$dayjs().tz(rootState.config.timezone).format('HH:mm:ss'))
|
const timeInSec = this.$timeToSeconds(this.$dayjs().tz(rootState.config.timezone).format('HH:mm:ss'))
|
||||||
|
const configPath = rootState.config.configGui[rootState.config.configID].playout_config
|
||||||
let dateToday = this.$dayjs().tz(this.timezone).format('YYYY-MM-DD')
|
let dateToday = this.$dayjs().tz(this.timezone).format('YYYY-MM-DD')
|
||||||
|
|
||||||
if (rootState.config.startInSec > timeInSec) {
|
if (rootState.config.startInSec > timeInSec) {
|
||||||
@ -60,9 +61,10 @@ export const actions = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const response = await this.$axios.get(`api/player/playlist/?date=${date}&config_path=${configPath}`)
|
const response = await this.$axios.get(`api/player/playlist/?date=${date}&config_path=${configPath}`)
|
||||||
|
console.log(rootState.config.configPlayout.playlist.day_start)
|
||||||
|
|
||||||
if (response.data && response.data.program) {
|
if (response.data && response.data.program) {
|
||||||
commit('UPDATE_PLAYLIST', this.$processPlaylist(dayStart, response.data.program))
|
commit('UPDATE_PLAYLIST', this.$processPlaylist(rootState.config.startInSec, response.data.program))
|
||||||
|
|
||||||
if (date === dateToday) {
|
if (date === dateToday) {
|
||||||
commit('UPDATE_TODAYS_PLAYLIST', _.cloneDeep(response.data.program))
|
commit('UPDATE_TODAYS_PLAYLIST', _.cloneDeep(response.data.program))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user