Adapted localPage to use the videoPlayer if asked by the user

This commit is contained in:
Kylart 2018-03-25 20:37:09 +02:00
parent a7743b8e6c
commit 6190bb7b26
2 changed files with 31 additions and 24 deletions

View File

@ -122,33 +122,41 @@
return this.nbEps === 1
? 'episode'
: 'episodes'
},
inside: {
get () {
return this.$store.state.config.config.video.inside
},
set () {}
}
},
methods: {
playThis (item) {
console.log(`[${(new Date()).toLocaleTimeString()}]: Requested to play ${item.name} - ${item.ep}. Sending...`)
async playThis (item) {
this.$log(`Requested to play ${item.name} - ${item.ep}. Sending...`)
// No need to get through store.
// this.$axios.get(`openThis`, {
// params: {
// type: 'video',
// path: item.path,
// dir: this.$store.state.localFiles.dir
// }
// }).then((res) => {
// if (res.status !== 200) { console.log('An error occurred: request to open file ended with a status ' + res.status + '.') }
if (this.inside) {
this.$store.commit('videoPlayer/play', {
show: true,
link: {
link: item.path
}
})
} else {
const { status } = await this.$axios.get(`openThis`, {
params: {
type: 'video',
path: item.path,
dir: this.$store.state.localFiles.dir
}
})
// this.$store.dispatch('history/append', {
// type: 'Play',
// text: `${item.name} - ${item.ep}`
// }).catch(err => { void (err) })
// })
this.$store.commit('videoPlayer/play', {
show: true,
link: {
link: item.path
}
})
if (status !== 200) this.$log(`An error occurred: request to open file ended with a status ${status}.`)
}
this.$store.dispatch('history/append', {
type: 'Play',
text: `${item.name} - ${item.ep}`
}).catch(err => { void (err) })
},
delThis (item) {
console.log(`[${(new Date()).toLocaleTimeString()}]: Requested to delete ${item.path} - ${item.ep}. Sending...`)

View File

@ -2,7 +2,6 @@
* Created by Kylart on 04/04/2017.
*/
const {join} = require('path')
const {dialog, BrowserWindow, shell} = require('electron')
const {Logger} = require('../utils')
const logger = new Logger('Open-External')
@ -22,7 +21,7 @@ const openExternal = ({query}, res) => {
switch (type) {
case 'video':
shell.openItem(join(query.dir, query.path))
shell.openItem(query.path)
sendEmptyRes(res)
break