don't send path to config, only channel id

This commit is contained in:
jb-alvarado 2021-03-30 11:39:38 +02:00
parent 7223ad8773
commit cfa9b20bed
6 changed files with 20 additions and 10 deletions

2
.gitignore vendored
View File

@ -13,6 +13,8 @@ pids
*.seed *.seed
*.pid.lock *.pid.lock
jsconfig.json
# Directory for instrumented libs generated by jscoverage/JSCover # Directory for instrumented libs generated by jscoverage/JSCover
lib-cov lib-cov

View File

@ -223,6 +223,7 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex'
import Menu from '@/components/Menu.vue' import Menu from '@/components/Menu.vue'
export default { export default {
@ -261,6 +262,7 @@ export default {
}, },
computed: { computed: {
...mapState('config', ['configID', 'configGui'])
}, },
watch: { watch: {
@ -406,7 +408,10 @@ export default {
boxborderw: this.form.border boxborderw: this.form.border
} }
const response = await this.$axios.post('api/player/send/message/', { data: obj }) const response = await this.$axios.post('api/player/send/message/', {
data: obj,
channel: this.configGui[this.configID].id
})
if (response.data && response.data.status.Success && response.data.status.Success === '0 Success') { if (response.data && response.data.status.Success && response.data.status.Success === '0 Success') {
this.success = true this.success = true

View File

@ -398,6 +398,7 @@ export default {
} }
] ]
this.getPath(this.extensions, '')
this.getPlaylist() this.getPlaylist()
setTimeout(() => { scrollTo(this) }, 3000) setTimeout(() => { scrollTo(this) }, 3000)
} }
@ -566,7 +567,7 @@ export default {
'api/player/playlist/', 'api/player/playlist/',
{ {
data: { channel: this.$store.state.config.configGui.channel, date: saveDate, program: saveList }, data: { channel: this.$store.state.config.configGui.channel, date: saveDate, program: saveList },
config_path: this.configGui[this.configID].playout_config channel: this.configGui[this.configID].id
} }
) )
}, },

View File

@ -140,8 +140,8 @@ export const actions = {
}, },
async getPlayoutConfig ({ commit, state, rootState }) { async getPlayoutConfig ({ commit, state, rootState }) {
const path = state.configGui[state.configID].playout_config const channel = state.configGui[state.configID].id
const response = await this.$axios.get(`api/player/config/?configPlayout&path=${path}`) const response = await this.$axios.get(`api/player/config/?configPlayout&channel=${channel}`)
if (response.data) { if (response.data) {
if (response.data.playlist.day_start) { if (response.data.playlist.day_start) {
@ -160,8 +160,10 @@ export const actions = {
}, },
async setPlayoutConfig ({ commit, state }, obj) { async setPlayoutConfig ({ commit, state }, obj) {
const path = state.configGui[state.configID].playout_config const update = await this.$axios.post('api/player/config/?configPlayout', {
const update = await this.$axios.post(`api/player/config/?configPlayout&path=${path}`, { data: obj }) data: obj,
channel: state.configGui[state.configID].id
})
return update return update
}, },

View File

@ -20,9 +20,9 @@ export const actions = {
async getTree ({ commit, dispatch, state, rootState }, { extensions, path }) { async getTree ({ commit, dispatch, state, rootState }, { extensions, path }) {
const crumbs = [] const crumbs = []
let root = '/' let root = '/'
const configPath = rootState.config.configGui[rootState.config.configID].playout_config const channel = rootState.config.configGui[rootState.config.configID].id
const response = await this.$axios.get( const response = await this.$axios.get(
`api/player/media/?extensions=${extensions}&config_path=${configPath}&path=${path}`) `api/player/media/?extensions=${extensions}&channel=${channel}&path=${path}`)
if (response.data.tree) { if (response.data.tree) {
const pathArr = response.data.tree[0].split('/') const pathArr = response.data.tree[0].split('/')

View File

@ -53,14 +53,14 @@ export const mutations = {
export const actions = { export const actions = {
async getPlaylist ({ commit, dispatch, state, rootState }, { date }) { 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 const channel = rootState.config.configGui[rootState.config.configID].id
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) {
dateToday = this.$dayjs(dateToday).tz(rootState.config.timezone).subtract(1, 'day').format('YYYY-MM-DD') dateToday = this.$dayjs(dateToday).tz(rootState.config.timezone).subtract(1, 'day').format('YYYY-MM-DD')
} }
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}&channel=${channel}`)
if (response.data && response.data.program) { if (response.data && response.data.program) {
commit('UPDATE_PLAYLIST', this.$processPlaylist(rootState.config.startInSec, response.data.program)) commit('UPDATE_PLAYLIST', this.$processPlaylist(rootState.config.startInSec, response.data.program))