mirror of
https://github.com/cuiocean/ZY-Player.git
synced 2026-02-14 16:06:48 +08:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
97812af0fd | ||
|
|
490d7c963e | ||
|
|
ed1afa2026 | ||
|
|
7ef114d0e3 | ||
|
|
7f9b7fc2c8 |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "zy",
|
||||
"version": "2.4.3",
|
||||
"version": "2.4.4",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
|
||||
@@ -54,12 +54,24 @@ export default {
|
||||
set (val) {
|
||||
this.SET_VIEW(val)
|
||||
}
|
||||
},
|
||||
detail: {
|
||||
get () {
|
||||
return this.$store.getters.getDetail
|
||||
},
|
||||
set (val) {
|
||||
this.SET_DETAIL(val)
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['SET_VIEW']),
|
||||
...mapMutations(['SET_VIEW', 'SET_DETAIL']),
|
||||
changeView (e) {
|
||||
this.view = e
|
||||
// ChangeView 的时候关闭Detail页面
|
||||
this.detail = {
|
||||
show: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ export default {
|
||||
<style lang="scss" scoped>
|
||||
.detail{
|
||||
position: absolute;
|
||||
left: 0;
|
||||
left: 60px;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: calc(100% - 40px);
|
||||
|
||||
@@ -542,17 +542,39 @@ export default {
|
||||
},
|
||||
playWithExternalPalyerEvent () {
|
||||
this.fetchM3u8List().then(m3u8Arr => {
|
||||
var m3u8Link = m3u8Arr[this.video.info.index]
|
||||
const fs = require('fs')
|
||||
var externalPlayer = this.setting.externalPlayer
|
||||
if (fs.existsSync(externalPlayer)) {
|
||||
var exec = require('child_process').execFile
|
||||
exec(externalPlayer, [m3u8Link])
|
||||
} else {
|
||||
if (!fs.existsSync(externalPlayer)) {
|
||||
this.$message.error('请设置第三方播放器路径')
|
||||
} else {
|
||||
var exec = require('child_process').execFile
|
||||
var dplFile = this.generateDplFile(this.video.info.name, m3u8Arr, this.video.info.index)
|
||||
exec(externalPlayer, [dplFile])
|
||||
}
|
||||
})
|
||||
},
|
||||
generateDplFile (fileName, m3u8Arr, index) {
|
||||
const path = require('path')
|
||||
const os = require('os')
|
||||
const fs = require('fs')
|
||||
var filePath = path.join(os.tmpdir(), fileName + '.dpl')
|
||||
if (fs.existsSync(filePath)) {
|
||||
fs.unlinkSync(filePath)
|
||||
}
|
||||
var str = 'DAUMPLAYLIST' + os.EOL
|
||||
str += 'playname=' + m3u8Arr[index] + os.EOL
|
||||
str += 'topindex=' + 0 + os.EOL
|
||||
str += 'saveplaypos=' + index + os.EOL
|
||||
|
||||
var ind = 1
|
||||
m3u8Arr.forEach(element => {
|
||||
str += ind + '*title*第' + ind + '集' + os.EOL
|
||||
str += ind + '*file*' + element + os.EOL
|
||||
ind += 1
|
||||
})
|
||||
fs.writeFileSync(filePath, str)
|
||||
return filePath
|
||||
},
|
||||
checkStar () {
|
||||
star.find({ key: this.video.key, ids: this.video.info.id }).then(res => {
|
||||
if (res) {
|
||||
|
||||
@@ -84,10 +84,13 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="expSites">导出</div>
|
||||
<div class="vs-placeholder vs-noAfter" @click="exportSites">导出</div>
|
||||
</div>
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="impSites">导入</div>
|
||||
<div class="vs-placeholder vs-noAfter" @click="importSites">导入</div>
|
||||
</div>
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="resetSites">重置源</div>
|
||||
</div>
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="openDoc('sites')">说明文档</div>
|
||||
@@ -146,6 +149,7 @@ import pkg from '../../package.json'
|
||||
import { setting, sites, shortcut, star } from '../lib/dexie'
|
||||
import { shell, clipboard, remote } from 'electron'
|
||||
import db from '../lib/dexie/dexie'
|
||||
import { sites as defaultSites } from '../lib/dexie/initData'
|
||||
import fs from 'fs'
|
||||
export default {
|
||||
name: 'setting',
|
||||
@@ -331,7 +335,7 @@ export default {
|
||||
this.$message.error(err)
|
||||
})
|
||||
},
|
||||
expSites () {
|
||||
exportSites () {
|
||||
this.getSites()
|
||||
const arr = [...this.sitesList]
|
||||
const str = JSON.stringify(arr, null, 4)
|
||||
@@ -351,7 +355,7 @@ export default {
|
||||
this.$message.error(err)
|
||||
})
|
||||
},
|
||||
impSites () {
|
||||
importSites () {
|
||||
const options = {
|
||||
filters: [
|
||||
{ name: 'JSON file', extensions: ['json'] },
|
||||
@@ -380,6 +384,17 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
resetSites () {
|
||||
sites.clear()
|
||||
sites.add(defaultSites).then(e => {
|
||||
this.getSites()
|
||||
this.d.site = defaultSites[0].key
|
||||
setting.update(this.d).then(res => {
|
||||
this.setting = this.d
|
||||
this.$message.success('重置源成功')
|
||||
})
|
||||
})
|
||||
},
|
||||
changeTheme (e) {
|
||||
this.d.theme = e
|
||||
setting.update(this.d).then(res => {
|
||||
|
||||
Reference in New Issue
Block a user