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: {
|
||||
...mapState('config', ['configID', 'configGui', 'configPlayout', 'timezone']),
|
||||
...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: {
|
||||
get () {
|
||||
return this.$store.state.playlist.playlist
|
||||
},
|
||||
set (list) {
|
||||
this.$store.commit('playlist/UPDATE_PLAYLIST', this.$processPlaylist(
|
||||
this.configPlayout.playlist.day_start, list))
|
||||
this.$store.commit('playlist/UPDATE_PLAYLIST', this.$processPlaylist(this.startInSec, list))
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
listDate (date) {
|
||||
listDate () {
|
||||
this.getPlaylist()
|
||||
setTimeout(() => { scrollTo(this) }, 5000)
|
||||
},
|
||||
@ -465,11 +466,7 @@ export default {
|
||||
},
|
||||
|
||||
async getPlaylist () {
|
||||
await this.$store.dispatch('playlist/getPlaylist', {
|
||||
dayStart: this.configPlayout.playlist.day_start,
|
||||
date: this.listDate,
|
||||
configPath: this.configGui[this.configID].playout_config
|
||||
})
|
||||
await this.$store.dispatch('playlist/getPlaylist', { date: this.listDate })
|
||||
},
|
||||
|
||||
showPreviewModal (src) {
|
||||
@ -519,24 +516,18 @@ export default {
|
||||
this.playlist[index].out = sec
|
||||
}
|
||||
|
||||
this.$store.commit('playlist/UPDATE_PLAYLIST', this.$processPlaylist(
|
||||
this.configPlayout.playlist.day_start, this.playlist))
|
||||
this.$store.commit('playlist/UPDATE_PLAYLIST', this.$processPlaylist(this.startInSec, this.playlist))
|
||||
}
|
||||
},
|
||||
|
||||
removeItemFromPlaylist (index) {
|
||||
this.playlist.splice(index, 1)
|
||||
|
||||
this.$store.commit('playlist/UPDATE_PLAYLIST', this.$processPlaylist(
|
||||
this.configPlayout.playlist.day_start, this.playlist))
|
||||
this.$store.commit('playlist/UPDATE_PLAYLIST', this.$processPlaylist(this.startInSec, this.playlist))
|
||||
},
|
||||
|
||||
async resetPlaylist () {
|
||||
await this.$store.dispatch('playlist/getPlaylist', {
|
||||
dayStart: this.configPlayout.playlist.day_start,
|
||||
date: this.listDate,
|
||||
configPath: this.configGui[this.configID].playout_config
|
||||
})
|
||||
await this.$store.dispatch('playlist/getPlaylist', { date: this.listDate })
|
||||
},
|
||||
|
||||
loopClips () {
|
||||
@ -554,13 +545,11 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
this.$store.commit('playlist/UPDATE_PLAYLIST', this.$processPlaylist(
|
||||
this.configPlayout.playlist.day_start, tempList))
|
||||
this.$store.commit('playlist/UPDATE_PLAYLIST', this.$processPlaylist(this.startInSec, tempList))
|
||||
},
|
||||
|
||||
async savePlaylist (saveDate) {
|
||||
this.$store.commit('playlist/UPDATE_PLAYLIST', this.$processPlaylist(
|
||||
this.configPlayout.playlist.day_start, this.playlist))
|
||||
this.$store.commit('playlist/UPDATE_PLAYLIST', this.$processPlaylist(this.startInSec, this.playlist))
|
||||
|
||||
const saveList = this.playlist.map(({ begin, ...item }) => item)
|
||||
|
||||
|
@ -51,8 +51,9 @@ export const mutations = {
|
||||
}
|
||||
|
||||
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 configPath = rootState.config.configGui[rootState.config.configID].playout_config
|
||||
let dateToday = this.$dayjs().tz(this.timezone).format('YYYY-MM-DD')
|
||||
|
||||
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}`)
|
||||
console.log(rootState.config.configPlayout.playlist.day_start)
|
||||
|
||||
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) {
|
||||
commit('UPDATE_TODAYS_PLAYLIST', _.cloneDeep(response.data.program))
|
||||
|
Loading…
x
Reference in New Issue
Block a user