From 0068027218964884f9a8c490884e10f7cadfa958 Mon Sep 17 00:00:00 2001 From: jb-alvarado Date: Thu, 18 Mar 2021 18:16:47 +0100 Subject: [PATCH] work on multi channel --- pages/media.vue | 14 ++++++++++---- store/media.js | 6 ++++-- store/playlist.js | 4 ++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/pages/media.vue b/pages/media.vue index 559a2cef..cdf5dea1 100644 --- a/pages/media.vue +++ b/pages/media.vue @@ -297,12 +297,12 @@ export default { }, computed: { - ...mapState('config', ['configGui', 'configPlayout']), + ...mapState('config', ['configID', 'configGui', 'configPlayout']), ...mapState('media', ['crumbs', 'folderTree']) }, created () { - this.extensions = [...this.configPlayout.storage.extensions, ...this.configGui.extra_extensions].join(',') + this.extensions = [...this.configPlayout.storage.extensions, ...this.configGui[this.configID].extra_extensions].join(',') this.getPath(this.extensions, '') }, @@ -354,7 +354,11 @@ export default { await this.$axios.post( 'api/player/media/op/', - { folder: this.folderName, path: this.crumbs.map(e => e.text).join('/') } + { + folder: this.folderName, + path: this.crumbs.map(e => e.text).join('/'), + config_path: this.configGui[this.configID].playout_config + } ) this.$root.$emit('bv::hide::modal', 'folder-modal') @@ -389,6 +393,8 @@ export default { this.currentProgress = progress } + const configPath = this.configGui[this.configID].playout_config + for (const [i, file] of this.inputFiles.entries()) { this.uploadTask = file.name @@ -399,7 +405,7 @@ export default { } await this.$axios.put( - `api/player/media/upload/${encodeURIComponent(file.name)}?path=${encodeURIComponent(this.crumbs.map(e => e.text).join('/'))}`, + `api/player/media/upload/${encodeURIComponent(file.name)}?path=${encodeURIComponent(this.crumbs.map(e => e.text).join('/'))}&config_path=${configPath}`, file, config ) diff --git a/store/media.js b/store/media.js index ac8e27ee..e5137d26 100644 --- a/store/media.js +++ b/store/media.js @@ -17,10 +17,12 @@ export const mutations = { } export const actions = { - async getTree ({ commit, dispatch, state }, { extensions, path }) { + async getTree ({ commit, dispatch, state, rootState }, { extensions, path }) { const crumbs = [] let root = '/' - const response = await this.$axios.get(`api/player/media/?extensions=${extensions}&path=${path}`) + const configPath = rootState.config.configGui[rootState.config.configID].playout_config + const response = await this.$axios.get( + `api/player/media/?extensions=${extensions}&config_path=${configPath}&path=${path}`) if (response.data.tree) { const pathArr = response.data.tree[0].split('/') diff --git a/store/playlist.js b/store/playlist.js index 3e1bc41b..8e9c20eb 100644 --- a/store/playlist.js +++ b/store/playlist.js @@ -49,7 +49,7 @@ export const mutations = { } export const actions = { - async getPlaylist ({ commit, dispatch, state, rootState }, { dayStart, date }) { + async getPlaylist ({ commit, dispatch, state, rootState }, { dayStart, date, configPath }) { const timeInSec = this.$timeToSeconds(this.$dayjs().format('HH:mm:ss')) let dateToday = this.$dayjs().format('YYYY-MM-DD') @@ -57,7 +57,7 @@ export const actions = { dateToday = this.$dayjs(dateToday).subtract(1, 'day').format('YYYY-MM-DD') } - const response = await this.$axios.get(`api/player/playlist/?date=${date}`) + const response = await this.$axios.get(`api/player/playlist/?date=${date}&config_path=${configPath}`) if (response.data && response.data.program) { commit('UPDATE_PLAYLIST', this.$processPlaylist(dayStart, response.data.program))