- - 导出
+ - 导出
- 无数据
- {{i | ftName(j)}}
- - 清空
+ - 清空
- 无数据
- 【{{m.site}}】{{m.name}} 第{{m.index+1}}集删除
@@ -106,7 +112,7 @@ import zy from '../lib/site/tools'
import Player from 'xgplayer'
import Hls from 'xgplayer-hls.js'
import mt from 'mousetrap'
-const { remote, ipcRenderer } = require('electron')
+const { remote, ipcRenderer, clipboard } = require('electron')
const VIDEO_DETAIL_CACHE = {}
@@ -132,7 +138,6 @@ const addPlayerBtn = function (event, svg, attrs) {
const addPlayerView = function (event, tpl, attrs) {
const player = this
- console.log(player)
const util = Player.util
const rootEl = player.root
const viewConfig = player.config[event]
@@ -321,57 +326,6 @@ export default {
this.xg.off('ended')
})
})
- // const id = this.video.info.id
- // zy.detail(this.video.key, id).then(res => {
- // this.name = res.name
- // const dd = res.dl.dd
- // const type = Object.prototype.toString.call(dd)
- // let m3u8Txt = []
- // if (type === '[object Array]') {
- // for (const i of dd) {
- // if (i._t.indexOf('m3u8') >= 0) {
- // m3u8Txt = i._t.split('#')
- // }
- // }
- // } else {
- // m3u8Txt = dd._t.split('#')
- // }
- // this.right.list = m3u8Txt
- // const m3u8Arr = []
- // for (const i of m3u8Txt) {
- // const j = i.split('$')
- // if (j.length > 1) {
- // for (let m = 0; m < j.length; m++) {
- // if (j[m].indexOf('m3u8') >= 0) {
- // m3u8Arr.push(j[m])
- // }
- // }
- // } else {
- // m3u8Arr.push(j[0])
- // }
- // }
-
- // this.xg.src = m3u8Arr[index]
- // this.showNext = m3u8Arr.length > 1
-
- // if (time !== 0) {
- // this.xg.play()
- // this.xg.once('playing', () => {
- // this.xg.currentTime = time
- // })
- // } else {
- // this.xg.play()
- // }
-
- // this.videoPlaying()
- // this.xg.once('ended', () => {
- // if (m3u8Arr.length > 1 && (m3u8Arr.length - 1 > index)) {
- // this.video.info.time = 0
- // this.video.info.index++
- // }
- // this.xg.off('ended')
- // })
- // })
},
fetchM3u8List () {
return new Promise((resolve) => {
@@ -401,8 +355,9 @@ export default {
const j = i.split('$')
if (j.length > 1) {
for (let m = 0; m < j.length; m++) {
- if (j[m].indexOf('m3u8') >= 0) {
+ if (j[m].indexOf('.m3u8') >= 0 && j[m].startsWith('http')) {
m3u8Arr.push(j[m])
+ break
}
}
} else {
@@ -497,9 +452,7 @@ export default {
this.right.show = true
this.right.type = 'history'
}
- history.all().then(res => {
- this.right.history = res.reverse()
- })
+ this.getAllhistory()
},
getAllhistory () {
history.all().then(res => {
@@ -571,6 +524,18 @@ export default {
info: this.video.info
}
},
+ issueEvent () {
+ const info = {
+ video: this.video,
+ list: this.right.list,
+ m3u8List: VIDEO_DETAIL_CACHE[this.video.key + '@' + this.video.info.id] || [],
+ playerError: this.xg.error || '',
+ playerState: this.xg.readyState || '',
+ networkState: this.xg.networkState || ''
+ }
+ clipboard.writeText(JSON.stringify(info, null, 4))
+ this.$message.success('视频信息复制成功')
+ },
checkStar () {
star.find({ site: this.video.key, ids: this.video.info.id }).then(res => {
if (res) {
@@ -595,8 +560,9 @@ export default {
let link, name
if (j.length > 1) {
for (let m = 0; m < j.length; m++) {
- if (j[m].indexOf('m3u8') >= 0) {
+ if (j[m].indexOf('.m3u8') >= 0 && j[m].startsWith('http')) {
link = j[m]
+ break
}
}
name = j[0]
@@ -609,15 +575,9 @@ export default {
link: link
})
}
-
- console.log(m3u8Arr)
-
- let m3u8Content = `#EXTM3U
-`
+ let m3u8Content = `#EXTM3U`
for (const item of m3u8Arr) {
- m3u8Content += `#EXTINF:-1, ${item.name}
-${item.link}
-`
+ m3u8Content += `#EXTINF:-1, ${item.name}${item.link}`
}
const blob = new Blob([m3u8Content], { type: 'application/vnd.apple.mpegurl' })
const downloadElement = document.createElement('a') // 创建下载的链接
@@ -869,6 +829,7 @@ ${item.link}
}
},
refreshHistory () {
+ this.getAllhistory()
let ul = document.querySelector('xg-btn-showhistory ul')
if (!ul) {
ul = document.createElement('ul')
@@ -945,7 +906,6 @@ ${item.link}
this.mtEvent()
},
mounted () {
- console.log(this)
Player.install('playPrev', function () {
addPlayerBtn.bind(this, 'playPrev', '
', { title: '上一集' })()
})
@@ -971,10 +931,6 @@ ${item.link}
this.xg = new Hls(this.config)
ipcRenderer.on('miniClosed', () => {
- // this.xg.destroy()
- // this.xg = new Hls(this.config)
- // this.bindEvent()
- // 同步进度
history.find({ site: this.video.key, ids: this.video.info.id }).then(res => {
if (res) {
if (this.video.info.index !== res.index) {
@@ -1145,6 +1101,13 @@ ${item.link}
height: 40px;
line-height: 40px;
padding: 0 10px;
+ .right {
+ float: right;
+ svg {
+ margin-top: 8px;
+ cursor: pointer;
+ }
+ }
}
.player{
width: 100%;
diff --git a/src/mini/Mini.vue b/src/mini/Mini.vue
index 565c271..cf8d178 100644
--- a/src/mini/Mini.vue
+++ b/src/mini/Mini.vue
@@ -22,15 +22,15 @@
播放进度: {{progress}}%