mirror of
https://github.com/cuiocean/ZY-Player.git
synced 2026-02-14 07:55:27 +08:00
Compare commits
86 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69a397e24e | ||
|
|
c216352268 | ||
|
|
89448d390f | ||
|
|
a853b02aa0 | ||
|
|
0443ce248f | ||
|
|
8009c3197e | ||
|
|
978d4e7181 | ||
|
|
138b70263a | ||
|
|
7f48c91f97 | ||
|
|
7a494a54c0 | ||
|
|
97812af0fd | ||
|
|
490d7c963e | ||
|
|
ed1afa2026 | ||
|
|
7ef114d0e3 | ||
|
|
7f9b7fc2c8 | ||
|
|
511820f873 | ||
|
|
af6dcb11bf | ||
|
|
7ecad1ad8e | ||
|
|
4d169f9d51 | ||
|
|
f3862e8385 | ||
|
|
490d4839b7 | ||
|
|
033bcb3df7 | ||
|
|
df22efa980 | ||
|
|
5428891297 | ||
|
|
bb3502774b | ||
|
|
fa67ad03d2 | ||
|
|
8a196ae52a | ||
|
|
ebfb681205 | ||
|
|
ba9f3246d2 | ||
|
|
51cb181acd | ||
|
|
33537638b0 | ||
|
|
fa9f85a177 | ||
|
|
3e1ecaac74 | ||
|
|
5cc9849e8a | ||
|
|
e353b629c5 | ||
|
|
4d20d5bc68 | ||
|
|
a921ce7adf | ||
|
|
1dd8d0dd24 | ||
|
|
b90c359670 | ||
|
|
27eb8c06ff | ||
|
|
add2bedb61 | ||
|
|
3dc970e198 | ||
|
|
3f2def4455 | ||
|
|
5b8d883af4 | ||
|
|
7113567475 | ||
|
|
e30da35e72 | ||
|
|
55b7396a2e | ||
|
|
83568fa499 | ||
|
|
838d3a64cd | ||
|
|
506be03e3e | ||
|
|
cfdb561473 | ||
|
|
ab2f45189f | ||
|
|
f4b9a73b18 | ||
|
|
6f99d789f4 | ||
|
|
e71090dad2 | ||
|
|
afe3351837 | ||
|
|
5dc0613aeb | ||
|
|
1c6385ae6c | ||
|
|
88a95a8bfb | ||
|
|
951e6ffa37 | ||
|
|
b83aed0a97 | ||
|
|
67ce537039 | ||
|
|
975562a66b | ||
|
|
8e7015c9d6 | ||
|
|
b841552dc7 | ||
|
|
0a9b939dc3 | ||
|
|
14ff252cce | ||
|
|
afd016be93 | ||
|
|
9cd7f7d267 | ||
|
|
8a76ec4e87 | ||
|
|
a00d965ce9 | ||
|
|
c9eb0c3e22 | ||
|
|
c80c0bd948 | ||
|
|
65dcfa04ae | ||
|
|
4e4ab82ea2 | ||
|
|
dd2adf4f99 | ||
|
|
777fbde528 | ||
|
|
472898f978 | ||
|
|
7f41d415f1 | ||
|
|
5d37a36c21 | ||
|
|
3a499766af | ||
|
|
cea797b6d0 | ||
|
|
37b41b0e20 | ||
|
|
1105c46f08 | ||
|
|
1df7b41edd | ||
|
|
f76c71c950 |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "zy",
|
||||
"version": "2.3.6",
|
||||
"version": "2.4.5",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
@@ -18,6 +18,8 @@
|
||||
"main": "background.js",
|
||||
"dependencies": {
|
||||
"axios": "^0.19.2",
|
||||
"cheerio": "^1.0.0-rc.3",
|
||||
"child_process": "^1.0.2",
|
||||
"core-js": "^3.6.5",
|
||||
"cors": "^2.8.5",
|
||||
"dexie": "^3.0.1",
|
||||
|
||||
@@ -78,7 +78,20 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.zy-checkbox{
|
||||
position: relative;
|
||||
display: flex;
|
||||
width: 200px;
|
||||
height: 30px;
|
||||
vertical-align: middle;
|
||||
align-items: center;
|
||||
.search-all-check-input{
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
.zy-highlighted{
|
||||
color: var(--highlight-color);
|
||||
}
|
||||
// table
|
||||
.zy-table{
|
||||
display: flex;
|
||||
@@ -118,41 +131,42 @@
|
||||
cursor: pointer;
|
||||
span{
|
||||
display: flex;
|
||||
width: 180px;
|
||||
font-size: 13px;
|
||||
height: 50px;
|
||||
line-height: 50px;
|
||||
overflow: hidden;
|
||||
margin-right: 5px;
|
||||
&.name{
|
||||
flex: 1;
|
||||
padding-left: 15px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
min-width: 100px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
&.note{
|
||||
width: 180px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
&.type{
|
||||
width: 120px;
|
||||
}
|
||||
&.last{
|
||||
width: 160px;
|
||||
width: 10%;
|
||||
}
|
||||
&.time{
|
||||
width: 60px;
|
||||
width: 10%;
|
||||
}
|
||||
&.from{
|
||||
width: 120px;
|
||||
&.last{
|
||||
width: 10%;
|
||||
}
|
||||
&.site{
|
||||
width: 10%;
|
||||
}
|
||||
&.note{
|
||||
width: 10%;
|
||||
}
|
||||
&.operate{
|
||||
width: 170px;
|
||||
.btn{
|
||||
width: 40px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// scroll
|
||||
.zy-scroll{
|
||||
&::-webkit-scrollbar{
|
||||
@@ -168,7 +182,6 @@
|
||||
position: absolute;
|
||||
}
|
||||
}
|
||||
|
||||
// loading
|
||||
.zy-loading{
|
||||
width: 100%;
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
:root{
|
||||
// general
|
||||
--highlight-color: #38dd77;
|
||||
// light
|
||||
--l-c-0: #823aa0;
|
||||
--l-c-1: #823aa011;
|
||||
|
||||
@@ -32,6 +32,10 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.zy-checkbox{
|
||||
color: var(--d-fc-1);
|
||||
transition: all 0.3s cubic-bezier(.25,.8,.25,1);
|
||||
}
|
||||
.zy-table{
|
||||
color: var(--d-fc-2);
|
||||
.tHeader{
|
||||
@@ -286,7 +290,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.view, .shortcut, .site{
|
||||
.view, .search, .shortcut, .site{
|
||||
.title{
|
||||
color: var(--d-fc-1);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.zy-checkbox{
|
||||
color: var(--g-fc-1);
|
||||
}
|
||||
.zy-table{
|
||||
color: var(--g-fc-2);
|
||||
.tHeader{
|
||||
@@ -286,7 +289,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.view, .shortcut, .site{
|
||||
.view, .search, .shortcut, .site{
|
||||
.title{
|
||||
color: var(--g-fc-1);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.zy-checkbox{
|
||||
color: var(--l-fc-1);
|
||||
}
|
||||
.zy-table{
|
||||
color: var(--l-fc-2);
|
||||
.tHeader{
|
||||
@@ -286,7 +289,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.view, .shortcut, .site{
|
||||
.view, .search, .shortcut, .site{
|
||||
.title{
|
||||
color: var(--l-fc-1);
|
||||
}
|
||||
|
||||
@@ -32,6 +32,9 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.zy-checkbox{
|
||||
color: var(--p-fc-1);
|
||||
}
|
||||
.zy-table{
|
||||
color: var(--p-fc-2);
|
||||
.tHeader{
|
||||
@@ -286,7 +289,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.view, .shortcut, .site{
|
||||
.view, .search, .shortcut, .site{
|
||||
.title{
|
||||
color: var(--p-fc-1);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<div class="year" v-show="info.year">上映: {{info.year}}</div>
|
||||
<div class="last" v-show="info.last">更新: {{info.last}}</div>
|
||||
<div class="note" v-show="info.note">备注: {{info.note}}</div>
|
||||
<div class="rate" v-show="info.rate">豆瓣评分: {{info.rate}}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="operate">
|
||||
@@ -32,6 +33,7 @@
|
||||
<span @click="starEvent">收藏</span>
|
||||
<span @click="downloadEvent">下载</span>
|
||||
<span @click="shareEvent">分享</span>
|
||||
<span @click="doubanLinkEvent">豆瓣</span>
|
||||
</div>
|
||||
<div class="desc" v-show="info.des">{{info.des}}</div>
|
||||
<div class="m3u8">
|
||||
@@ -121,9 +123,9 @@ export default {
|
||||
playEvent (n) {
|
||||
history.find({ site: this.detail.key, ids: this.detail.info.id }).then(res => {
|
||||
if (res) {
|
||||
this.video = { key: res.site, info: { id: res.ids, name: res.name, index: n } }
|
||||
this.video = { key: res.site, info: { id: res.ids, name: res.name, index: n, site: this.detail.site } }
|
||||
} else {
|
||||
this.video = { key: this.detail.key, info: { id: this.detail.info.id, name: this.detail.info.name, index: n } }
|
||||
this.video = { key: this.detail.key, info: { id: this.detail.info.id, name: this.detail.info.name, index: n, site: this.detail.site } }
|
||||
}
|
||||
})
|
||||
|
||||
@@ -131,19 +133,21 @@ export default {
|
||||
this.detail.show = false
|
||||
},
|
||||
starEvent () {
|
||||
star.find({ site: this.detail.key, ids: this.info.id }).then(res => {
|
||||
star.find({ key: this.detail.key, ids: this.info.id }).then(res => {
|
||||
const docs = {
|
||||
key: this.detail.key,
|
||||
ids: this.info.id,
|
||||
name: this.info.name,
|
||||
type: this.info.type,
|
||||
year: this.info.year,
|
||||
last: this.info.last,
|
||||
note: this.info.note
|
||||
}
|
||||
if (res) {
|
||||
this.$message.info('已存在')
|
||||
star.update(res.id, docs).then(res => {
|
||||
this.$message.success('已存在,更新成功')
|
||||
})
|
||||
} else {
|
||||
const docs = {
|
||||
site: this.detail.key,
|
||||
ids: this.info.id,
|
||||
name: this.info.name,
|
||||
type: this.info.type,
|
||||
year: this.info.year,
|
||||
last: this.info.last,
|
||||
note: this.info.note
|
||||
}
|
||||
star.add(docs).then(res => {
|
||||
this.$message.success('收藏成功')
|
||||
})
|
||||
@@ -154,7 +158,7 @@ export default {
|
||||
},
|
||||
downloadEvent () {
|
||||
zy.download(this.detail.key, this.info.id).then(res => {
|
||||
if (res) {
|
||||
if (res && res.dl && res.dl.dd) {
|
||||
const text = res.dl.dd._t
|
||||
if (text) {
|
||||
const list = text.split('#')
|
||||
@@ -187,12 +191,72 @@ export default {
|
||||
info: this.detail.info
|
||||
}
|
||||
},
|
||||
doubanLinkEvent () {
|
||||
const open = require('open')
|
||||
const axios = require('axios')
|
||||
const cheerio = require('cheerio')
|
||||
const name = this.detail.info.name.trim()
|
||||
// 豆瓣搜索链接
|
||||
var doubanSearchLink = 'https://www.douban.com/search?q=' + name
|
||||
var link = doubanSearchLink
|
||||
axios.get(doubanSearchLink).then(res => {
|
||||
const $ = cheerio.load(res.data)
|
||||
// 比较第一和第二豆瓣搜索结果, 如果名字相符, 就打开该链接,否则打开搜索页面
|
||||
var nameInDouban = $($('div.result')[0]).find('div>div>h3>a').first()
|
||||
if (name.replace(/\s/g, '') === nameInDouban.text().replace(/\s/g, '')) {
|
||||
link = nameInDouban.attr('href')
|
||||
} else {
|
||||
nameInDouban = $($('div.result')[1]).find('div>div>h3>a').first()
|
||||
if (name.replace(/\s/g, '') === nameInDouban.text().replace(/\s/g, '')) {
|
||||
link = nameInDouban.attr('href')
|
||||
}
|
||||
}
|
||||
open(link)
|
||||
})
|
||||
},
|
||||
getDoubanRate () {
|
||||
const axios = require('axios')
|
||||
const cheerio = require('cheerio')
|
||||
const name = this.detail.info.name.trim()
|
||||
// 豆瓣搜索链接
|
||||
var doubanSearchLink = 'https://www.douban.com/search?q=' + name
|
||||
axios.get(doubanSearchLink).then(res => {
|
||||
const $ = cheerio.load(res.data)
|
||||
// 比较第一和第二给豆瓣搜索结果, 看名字是否相符
|
||||
var link = ''
|
||||
var nameInDouban = $($('div.result')[0]).find('div>div>h3>a').first()
|
||||
if (name.replace(/\s/g, '') === nameInDouban.text().replace(/\s/g, '')) {
|
||||
link = nameInDouban.attr('href')
|
||||
} else {
|
||||
nameInDouban = $($('div.result')[1]).find('div>div>h3>a').first()
|
||||
if (name.replace(/\s/g, '') === nameInDouban.text().replace(/\s/g, '')) {
|
||||
link = nameInDouban.attr('href')
|
||||
}
|
||||
}
|
||||
// 如果找到链接,就打开该链接获取评分
|
||||
if (link) {
|
||||
axios.get(link).then(response => {
|
||||
const parsedHtml = cheerio.load(response.data)
|
||||
var rating = parsedHtml('body').find('#interest_sectl').first().find('strong').first()
|
||||
if (rating.text()) {
|
||||
this.info.rate = rating.text()
|
||||
} else {
|
||||
this.info.rate = '暂无评分'
|
||||
}
|
||||
})
|
||||
} else {
|
||||
this.info.rate = '暂无评分'
|
||||
}
|
||||
})
|
||||
},
|
||||
getDetailInfo () {
|
||||
const id = this.detail.info.ids || this.detail.info.id
|
||||
zy.detail(this.detail.key, id).then(res => {
|
||||
if (res) {
|
||||
this.info = res
|
||||
this.$set(this.info, 'rate', '')
|
||||
this.m3u8Parse(res)
|
||||
this.getDoubanRate()
|
||||
this.loading = false
|
||||
}
|
||||
})
|
||||
@@ -206,9 +270,10 @@ export default {
|
||||
<style lang="scss" scoped>
|
||||
.detail{
|
||||
position: absolute;
|
||||
left: 0;
|
||||
left: 80px;
|
||||
right: 20px;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
width: calc(100% - 100px);
|
||||
height: calc(100% - 40px);
|
||||
z-index: 888;
|
||||
.detail-content{
|
||||
@@ -263,6 +328,11 @@ export default {
|
||||
font-size: 14px;
|
||||
line-height: 26px;
|
||||
}
|
||||
.rate{
|
||||
font-size: 16px;
|
||||
line-height: 26px;
|
||||
font-weight: bolder;
|
||||
}
|
||||
}
|
||||
}
|
||||
.operate{
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="zy-select" @mouseleave="show.classList = false" v-if="show.class">
|
||||
<div class="zy-select" @mouseleave="show.classList = false" v-show="show.class">
|
||||
<div class="vs-placeholder" @click="show.classList = true">{{type.name}}</div>
|
||||
<div class="vs-options" v-show="show.classList">
|
||||
<ul class="zy-scroll" style="max-height: 600px;">
|
||||
@@ -18,10 +18,10 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="zy-select" @mouseleave="show.search = false">
|
||||
<div class="vs-input" @click="show.search = true"><input v-model.trim="searchTxt" type="text" placeholder="搜索" @keyup.enter="searchEvent"></div>
|
||||
<div class="vs-input" @click="show.search = true"><input v-model.trim="searchTxt" type="text" placeholder="搜索" @keyup.enter="searchEvent(searchTxt)"></div>
|
||||
<div class="vs-options" v-show="show.search">
|
||||
<ul class="zy-scroll" style="max-height: 600px">
|
||||
<li v-for="(i, j) in searchList" :key="j" @click="searchClickEvent(i)">{{i.keywords}}</li>
|
||||
<li v-for="(i, j) in searchList" :key="j" @click="searchEvent(i.keywords)">{{i.keywords}}</li>
|
||||
<li v-show="searchList.length >= 1" @click="clearSearch">清空历史记录</li>
|
||||
</ul>
|
||||
</div>
|
||||
@@ -37,18 +37,19 @@
|
||||
<template slot="item" slot-scope="props">
|
||||
<div class="card">
|
||||
<div class="img">
|
||||
<img style="width: 100%" :src="props.data.pic" alt="" @load="$refs.waterfall.refresh()" @click="detailEvent(props.data)">
|
||||
<img style="width: 100%" :src="props.data.pic" alt="" @load="$refs.waterfall.refresh()" @click="detailEvent(site, props.data)">
|
||||
<div class="operate">
|
||||
<div class="operate-wrap">
|
||||
<span class="o-play" @click="playEvent(props.data)">播放</span>
|
||||
<span class="o-star" @click="starEvent(props.data)">收藏</span>
|
||||
<span class="o-share" @click="shareEvent(props.data)">分享</span>
|
||||
<span class="o-play" @click="playEvent(site, props.data)">播放</span>
|
||||
<span class="o-star" @click="starEvent(site, props.data)">收藏</span>
|
||||
<span class="o-share" @click="shareEvent(site, props.data)">分享</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="name" @click="detailEvent(props.data)">{{props.data.name}}</div>
|
||||
<div class="name" @click="detailEvent(site, props.data)">{{props.data.name}}</div>
|
||||
<div class="info">
|
||||
<span>{{props.data.year}}</span>
|
||||
<span>{{props.data.note}}</span>
|
||||
<span>{{props.data.type}}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -60,16 +61,17 @@
|
||||
<div class="zy-table">
|
||||
<div class="tBody">
|
||||
<ul>
|
||||
<li v-for="(i, j) in list" :key="j" @click="detailEvent(i)">
|
||||
<li v-for="(i, j) in list" :key="j" @click="detailEvent(site, i)">
|
||||
<span class="name">{{i.name}}</span>
|
||||
<span class="type">{{i.type}}</span>
|
||||
<span class="time">{{i.year}}</span>
|
||||
<span class="time">{{i.note}}</span>
|
||||
<span class="last">{{i.last}}</span>
|
||||
<span class="operate">
|
||||
<span class="btn" @click.stop="playEvent(i)">播放</span>
|
||||
<span class="btn" @click.stop="starEvent(i)">收藏</span>
|
||||
<span class="btn" @click.stop="shareEvent(i)">分享</span>
|
||||
<span class="btn" @click.stop="downloadEvent(i)">下载</span>
|
||||
<span class="btn" @click.stop="playEvent(site, i)">播放</span>
|
||||
<span class="btn" @click.stop="starEvent(site, i)">收藏</span>
|
||||
<span class="btn" @click.stop="shareEvent(site, i)">分享</span>
|
||||
<span class="btn" @click.stop="downloadEvent(site, i)">下载</span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -81,19 +83,19 @@
|
||||
<div class="body-box" v-show="show.find">
|
||||
<div class="show-table">
|
||||
<div class="zy-table">
|
||||
<div class="tBody">
|
||||
<div class="tBody zy-scroll">
|
||||
<ul>
|
||||
<li v-for="(i, j) in searchContents" :key="j" @click="detailEvent(i)">
|
||||
<li v-for="(i, j) in searchContents" :key="j" @click="detailEvent(i.site, i)">
|
||||
<span class="name">{{i.name}}</span>
|
||||
<span class="type">{{i.type}}</span>
|
||||
<span class="time">{{i.year}}</span>
|
||||
<span class="last">{{i.last}}</span>
|
||||
<span class="site">{{i.site.name}}</span>
|
||||
<span class="note">{{i.note}}</span>
|
||||
<span class="operate">
|
||||
<span class="btn" @click.stop="playEvent(i)">播放</span>
|
||||
<span class="btn" @click.stop="starEvent(i)">收藏</span>
|
||||
<span class="btn" @click.stop="shareEvent(i)">分享</span>
|
||||
<span class="btn" @click.stop="downloadEvent(i)">下载</span>
|
||||
<span class="btn" @click.stop="playEvent(i.site, i)">播放</span>
|
||||
<span class="btn" @click.stop="starEvent(i.site, i)">收藏</span>
|
||||
<span class="btn" @click.stop="shareEvent(i.site, i)">分享</span>
|
||||
<span class="btn" @click.stop="downloadEvent(i.site, i)">下载</span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -200,7 +202,7 @@ export default {
|
||||
this.show.site = false
|
||||
this.show.class = false
|
||||
if (this.searchTxt.length > 0) {
|
||||
this.searchEvent()
|
||||
this.searchSingleSiteEvent(this.site, this.searchTxt)
|
||||
} else {
|
||||
this.classList = []
|
||||
this.type = {}
|
||||
@@ -226,10 +228,11 @@ export default {
|
||||
return new Promise((resolve, reject) => {
|
||||
const key = this.site.key
|
||||
zy.class(key).then(res => {
|
||||
this.classList = res.class
|
||||
var allClass = [{ name: '最新', tid: 0 }].concat(res.class)
|
||||
this.classList = allClass
|
||||
this.show.class = true
|
||||
this.pagecount = res.pagecount
|
||||
this.type = { name: '最新', tid: 0 }
|
||||
this.type = this.classList[0]
|
||||
resolve(true)
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
@@ -265,7 +268,8 @@ export default {
|
||||
$state.complete()
|
||||
}
|
||||
if (type === '[object Array]') {
|
||||
this.list.push(...res)
|
||||
// zy.list 返回的是按时间从旧到新排列, 我门需要翻转为从新到旧
|
||||
this.list.push(...res.reverse())
|
||||
}
|
||||
if (type === '[object Object]') {
|
||||
this.list.push(res)
|
||||
@@ -276,30 +280,31 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
detailEvent (e) {
|
||||
detailEvent (site, e) {
|
||||
this.detail = {
|
||||
show: true,
|
||||
key: this.site.key,
|
||||
key: site.key,
|
||||
site: site,
|
||||
info: e
|
||||
}
|
||||
},
|
||||
playEvent (e) {
|
||||
history.find({ site: this.site.key, ids: e.id }).then(res => {
|
||||
playEvent (site, e) {
|
||||
history.find({ site: site.key, ids: e.id }).then(res => {
|
||||
if (res) {
|
||||
this.video = { key: res.site, info: { id: res.ids, name: res.name, index: res.index } }
|
||||
this.video = { key: res.site, info: { id: res.ids, name: res.name, index: res.index, site: site } }
|
||||
} else {
|
||||
this.video = { key: this.site.key, info: { id: e.id, name: e.name, index: 0 } }
|
||||
this.video = { key: site.key, info: { id: e.id, name: e.name, index: 0, site: site } }
|
||||
}
|
||||
})
|
||||
this.view = 'Play'
|
||||
},
|
||||
starEvent (e) {
|
||||
star.find({ site: this.site.key, ids: e.id }).then(res => {
|
||||
starEvent (site, e) {
|
||||
star.find({ key: site.key, ids: e.id }).then(res => {
|
||||
if (res) {
|
||||
this.$message.info('已存在')
|
||||
} else {
|
||||
const docs = {
|
||||
site: this.site.key,
|
||||
key: site.key,
|
||||
ids: e.id,
|
||||
name: e.name,
|
||||
type: e.type,
|
||||
@@ -315,16 +320,16 @@ export default {
|
||||
this.$message.warning('收藏失败')
|
||||
})
|
||||
},
|
||||
shareEvent (e) {
|
||||
shareEvent (site, e) {
|
||||
this.share = {
|
||||
show: true,
|
||||
key: this.site.key,
|
||||
key: site.key,
|
||||
info: e
|
||||
}
|
||||
},
|
||||
downloadEvent (e) {
|
||||
zy.download(this.site.key, e.id).then(res => {
|
||||
if (res.length > 0) {
|
||||
downloadEvent (site, e) {
|
||||
zy.download(site.key, e.id).then(res => {
|
||||
if (res && res.length > 0 && res.dl && res.dl.dd) {
|
||||
const text = res.dl.dd._t
|
||||
if (text) {
|
||||
const list = text.split('#')
|
||||
@@ -340,7 +345,7 @@ export default {
|
||||
}
|
||||
} else {
|
||||
let m3u8List = []
|
||||
const dd = e.dl.dd
|
||||
const dd = res.dl.dd
|
||||
const type = Object.prototype.toString.call(dd)
|
||||
if (type === '[object Array]') {
|
||||
for (const i of dd) {
|
||||
@@ -378,8 +383,8 @@ export default {
|
||||
this.searchList = res.reverse()
|
||||
})
|
||||
},
|
||||
searchEvent () {
|
||||
const wd = this.searchTxt
|
||||
searchAllSitesEvent (sites, wd) {
|
||||
this.searchTxt = wd
|
||||
this.searchContents = []
|
||||
this.pagecount = 0
|
||||
this.show.search = false
|
||||
@@ -391,18 +396,24 @@ export default {
|
||||
}
|
||||
this.getAllSearch()
|
||||
})
|
||||
zy.search(this.site.key, wd).then(res => {
|
||||
const type = Object.prototype.toString.call(res)
|
||||
if (type === '[object Undefined]') {
|
||||
this.$message.info('无搜索结果')
|
||||
}
|
||||
if (type === '[object Array]') {
|
||||
this.searchContents.push(...res)
|
||||
}
|
||||
if (type === '[object Object]') {
|
||||
this.searchContents.push(res)
|
||||
}
|
||||
})
|
||||
sites.forEach(site =>
|
||||
zy.search(site.key, wd).then(res => {
|
||||
const type = Object.prototype.toString.call(res)
|
||||
if (type === '[object Undefined]') {
|
||||
this.$message.info(site.name + ' 无搜索结果')
|
||||
}
|
||||
if (type === '[object Array]') {
|
||||
res.forEach(element => {
|
||||
element.site = site
|
||||
this.searchContents.push(element)
|
||||
})
|
||||
}
|
||||
if (type === '[object Object]') {
|
||||
res.site = site
|
||||
this.searchContents.push(res)
|
||||
}
|
||||
})
|
||||
)
|
||||
} else {
|
||||
this.show.find = false
|
||||
this.getClass().then(res => {
|
||||
@@ -412,28 +423,17 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
searchClickEvent (e) {
|
||||
this.searchContents = []
|
||||
this.pagecount = 0
|
||||
this.searchTxt = e.keywords
|
||||
this.show.search = false
|
||||
this.show.find = true
|
||||
search.remove(e.id).then(res => {
|
||||
search.add({ keywords: e.keywords })
|
||||
this.getAllSearch()
|
||||
})
|
||||
zy.search(this.site.key, e.keywords).then(res => {
|
||||
const type = Object.prototype.toString.call(res)
|
||||
if (type === '[object Undefined]') {
|
||||
this.$message.info('无搜索结果')
|
||||
}
|
||||
if (type === '[object Array]') {
|
||||
this.searchContents.push(...res)
|
||||
}
|
||||
if (type === '[object Object]') {
|
||||
this.searchContents.push(res)
|
||||
}
|
||||
})
|
||||
searchEvent (wd) {
|
||||
if (this.setting.searchAllSites) {
|
||||
this.searchAllSitesEvent(this.sites, wd)
|
||||
} else {
|
||||
this.searchSingleSiteEvent(this.site, wd)
|
||||
}
|
||||
},
|
||||
searchSingleSiteEvent (site, wd) {
|
||||
var sites = []
|
||||
sites.push(this.site)
|
||||
this.searchAllSitesEvent(sites, wd)
|
||||
},
|
||||
clearSearch () {
|
||||
search.clear().then(res => {
|
||||
|
||||
@@ -9,11 +9,12 @@
|
||||
<ul>
|
||||
<li v-show="this.history.length === 0">无数据</li>
|
||||
<li v-for="(i, j) in history" :key="j" @click="historyItemEvent(i)">
|
||||
<span class="name" @click.stop="playEvent(i)">{{i.name}}</span>
|
||||
<span class="site">{{i.site}}</span>
|
||||
<span class="index">第{{i.index+1}}集</span>
|
||||
<span class="operate" style="width: 220px">
|
||||
<span class="name" @click.stop="detailEvent(i)">{{i.name}}</span>
|
||||
<span class="site">{{getSiteName(i.site)}}</span>
|
||||
<span class="note">第{{i.index+1}}集</span>
|
||||
<span class="operate">
|
||||
<span class="btn" @click.stop="playEvent(i)">播放</span>
|
||||
<span class="btn" @click.stop="shareEvent(i)">分享</span>
|
||||
<span class="btn" @click.stop="downloadEvent(i)">下载</span>
|
||||
<span class="btn" @click.stop="removeHistoryItem(i)">删除</span>
|
||||
</span>
|
||||
@@ -26,14 +27,15 @@
|
||||
</template>
|
||||
<script>
|
||||
import { mapMutations } from 'vuex'
|
||||
import { history } from '../lib/dexie'
|
||||
import { history, sites } from '../lib/dexie'
|
||||
import zy from '../lib/site/tools'
|
||||
const { clipboard } = require('electron')
|
||||
export default {
|
||||
name: 'history',
|
||||
data () {
|
||||
return {
|
||||
history: history
|
||||
history: history,
|
||||
sites: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -73,6 +75,7 @@ export default {
|
||||
watch: {
|
||||
view () {
|
||||
this.getAllhistory()
|
||||
this.getAllsites()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -97,9 +100,16 @@ export default {
|
||||
})
|
||||
this.view = 'Play'
|
||||
},
|
||||
shareEvent (e) {
|
||||
this.share = {
|
||||
show: true,
|
||||
key: e.site,
|
||||
info: e
|
||||
}
|
||||
},
|
||||
downloadEvent (e) {
|
||||
zy.download(e.site, e.ids).then(res => {
|
||||
if (res) {
|
||||
if (res && res.dl && res.dl.dd) {
|
||||
const text = res.dl.dd._t
|
||||
if (text) {
|
||||
const list = text.split('#')
|
||||
@@ -114,14 +124,28 @@ export default {
|
||||
this.$message.warning('没有查询到下载链接.')
|
||||
}
|
||||
} else {
|
||||
const list = [...this.m3u8List]
|
||||
let downloadUrl = ''
|
||||
for (const i of list) {
|
||||
const url = encodeURI(i.split('$')[1])
|
||||
downloadUrl += (url + '\n')
|
||||
}
|
||||
clipboard.writeText(downloadUrl)
|
||||
this.$message.success('『M3U8』格式的链接已复制, 快去下载吧!')
|
||||
var m3u8List = {}
|
||||
zy.detail(e.site, e.ids).then(res => {
|
||||
const dd = res.dl.dd
|
||||
const type = Object.prototype.toString.call(dd)
|
||||
if (type === '[object Array]') {
|
||||
for (const i of dd) {
|
||||
if (i._flag.indexOf('m3u8') >= 0) {
|
||||
m3u8List = i._t.split('#')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
m3u8List = dd._t.split('#')
|
||||
}
|
||||
const list = [...m3u8List]
|
||||
let downloadUrl = ''
|
||||
for (const i of list) {
|
||||
const url = encodeURI(i.split('$')[1])
|
||||
downloadUrl += (url + '\n')
|
||||
}
|
||||
clipboard.writeText(downloadUrl)
|
||||
this.$message.success('『M3U8』格式的链接已复制, 快去下载吧!')
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
@@ -135,6 +159,17 @@ export default {
|
||||
this.history = res.reverse()
|
||||
})
|
||||
},
|
||||
getAllsites () {
|
||||
sites.all().then(res => {
|
||||
this.sites = res
|
||||
})
|
||||
},
|
||||
getSiteName (key) {
|
||||
var site = this.sites.find(e => e.key === key)
|
||||
if (site) {
|
||||
return site.name
|
||||
}
|
||||
},
|
||||
historyItemEvent (e) {
|
||||
this.video = {
|
||||
key: e.site,
|
||||
|
||||
@@ -3,6 +3,12 @@
|
||||
<div class="box">
|
||||
<div class="title">
|
||||
<span v-if="this.right.list.length > 1">『第 {{(video.info.index + 1)}} 集』</span>{{name}}
|
||||
<span v-if="video.key" class="right" @click="playWithExternalPalyerEvent" title="使用第三方播放器">
|
||||
<svg role="img" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
|
||||
<polygon points="20 8 20 20 4 20 4 8"></polygon>
|
||||
<polyline stroke-linejoin="round" points="8 4 12 7.917 16 4"></polyline>
|
||||
</svg>
|
||||
</span>
|
||||
<span v-if="video.key" class="right" @click="issueEvent" title="复制调试信息">
|
||||
<svg t="1596338860607" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3127" width="24" height="24">
|
||||
<path d="M503.803829 63.578014c-247.050676 0-447.328072 200.277396-447.328072 447.327048 0 247.054769 200.277396 447.333188 447.328072 447.333188 247.054769 0 447.332165-200.278419 447.332165-447.333188C951.13497 263.85541 750.858598 63.578014 503.803829 63.578014L503.803829 63.578014zM503.803829 894.313336c-211.749682 0-383.408273-171.659615-383.408273-383.408273 0-211.749682 171.659615-383.40725 383.408273-383.40725 211.753775 0 383.412366 171.658591 383.412366 383.40725C887.216195 722.653721 715.557604 894.313336 503.803829 894.313336L503.803829 894.313336zM447.745069 255.897158l127.914298 0L575.659367 383.576095 447.745069 383.576095 447.745069 255.897158 447.745069 255.897158zM447.745069 425.470251l127.914298 0 0 342.058516L447.745069 767.528767 447.745069 425.470251 447.745069 425.470251zM447.745069 425.470251" p-id="3128"></path>
|
||||
@@ -461,15 +467,12 @@ export default {
|
||||
},
|
||||
starEvent () {
|
||||
const info = this.video.info
|
||||
star.find({ site: this.video.key, ids: info.id }).then(res => {
|
||||
star.find({ key: this.video.key, ids: info.id }).then(res => {
|
||||
if (res) {
|
||||
star.remove(res.id).then(e => {
|
||||
this.$message.info('取消收藏')
|
||||
this.isStar = false
|
||||
})
|
||||
this.$message.info('已存在')
|
||||
} else {
|
||||
const docs = {
|
||||
site: this.video.key,
|
||||
const doc = {
|
||||
key: this.video.key,
|
||||
ids: info.id,
|
||||
name: info.name,
|
||||
type: info.type,
|
||||
@@ -477,7 +480,7 @@ export default {
|
||||
last: info.last,
|
||||
note: info.note
|
||||
}
|
||||
star.add(docs).then(res => {
|
||||
star.add(doc).then(starRes => {
|
||||
this.$message.success('收藏成功')
|
||||
this.isStar = true
|
||||
})
|
||||
@@ -537,8 +540,47 @@ export default {
|
||||
clipboard.writeText(JSON.stringify(info, null, 4))
|
||||
this.$message.success('视频信息复制成功')
|
||||
},
|
||||
playWithExternalPalyerEvent () {
|
||||
this.fetchM3u8List().then(m3u8Arr => {
|
||||
const fs = require('fs')
|
||||
var externalPlayer = this.setting.externalPlayer
|
||||
if (!fs.existsSync(externalPlayer)) {
|
||||
this.$message.error('请设置第三方播放器路径')
|
||||
// 在线播放该视频
|
||||
var link = 'https://www.m3u8play.com/?play=' + m3u8Arr[this.video.info.index]
|
||||
const open = require('open')
|
||||
open(link)
|
||||
} 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({ site: this.video.key, ids: this.video.info.id }).then(res => {
|
||||
star.find({ key: this.video.key, ids: this.video.info.id }).then(res => {
|
||||
if (res) {
|
||||
this.isStar = true
|
||||
} else {
|
||||
|
||||
@@ -44,9 +44,49 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='site'>
|
||||
<div class="title">收藏管理</div>
|
||||
<div class="site-box">
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="exportFavorites">导出</div>
|
||||
</div>
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="importFavorites">导入</div>
|
||||
</div>
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="clearFavorites">清空收藏</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='search'>
|
||||
<div class="title">搜索</div>
|
||||
<div class="zy-checkbox">
|
||||
<input type="checkbox" v-model="setting.searchAllSites" @change="updateSearchOption($event)"> 搜索所有资源
|
||||
</div>
|
||||
</div>
|
||||
<div class='site'>
|
||||
<div class="title">第三方播放</div>
|
||||
<div class="site-box">
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="selectLocalPlayer">选择本地播放器</div>
|
||||
</div>
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="resetLocalPlayer">重置</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="site">
|
||||
<div class="title">源管理</div>
|
||||
<div class="site-box">
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="exportSites">导出</div>
|
||||
</div>
|
||||
<div class="zy-select">
|
||||
<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" @mouseleave="show.site = false">
|
||||
<div class="vs-placeholder" @click="show.site = true">默认源</div>
|
||||
<div class="vs-options" v-show="show.site">
|
||||
@@ -55,12 +95,6 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="expSites">导出</div>
|
||||
</div>
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="impSites">导入</div>
|
||||
</div>
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="openDoc('sites')">说明文档</div>
|
||||
</div>
|
||||
@@ -115,9 +149,11 @@
|
||||
<script>
|
||||
import { mapMutations } from 'vuex'
|
||||
import pkg from '../../package.json'
|
||||
import { setting, sites, shortcut } from '../lib/dexie'
|
||||
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',
|
||||
data () {
|
||||
@@ -125,6 +161,7 @@ export default {
|
||||
pkg: pkg,
|
||||
sitesList: [],
|
||||
shortcutList: [],
|
||||
favoritesList: [],
|
||||
show: {
|
||||
site: false,
|
||||
shortcut: false,
|
||||
@@ -135,7 +172,9 @@ export default {
|
||||
site: '',
|
||||
theme: '',
|
||||
shortcut: true,
|
||||
view: 'picture'
|
||||
searchAllSites: true,
|
||||
view: 'picture',
|
||||
externalPlayer: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -161,7 +200,9 @@ export default {
|
||||
site: res.site,
|
||||
theme: res.theme,
|
||||
shortcut: res.shortcut,
|
||||
view: res.view
|
||||
view: res.view,
|
||||
searchAllSites: res.searchAllSites,
|
||||
externalPlayer: res.externalPlayer
|
||||
}
|
||||
this.setting = this.d
|
||||
})
|
||||
@@ -176,6 +217,11 @@ export default {
|
||||
this.shortcutList = res
|
||||
})
|
||||
},
|
||||
getFavorites () {
|
||||
star.all().then(res => {
|
||||
this.favoritesList = res
|
||||
})
|
||||
},
|
||||
changeView (e) {
|
||||
this.d.view = e
|
||||
setting.update(this.d).then(res => {
|
||||
@@ -192,24 +238,169 @@ export default {
|
||||
this.show.site = false
|
||||
})
|
||||
},
|
||||
expSites () {
|
||||
const arr = [...this.sitesList]
|
||||
const str = JSON.stringify(arr)
|
||||
clipboard.writeText(str)
|
||||
this.$message.success('已复制到剪贴板')
|
||||
updateSearchOption (e) {
|
||||
this.d.searchAllSites = this.setting.searchAllSites
|
||||
setting.update(this.d).then(res => {
|
||||
this.setting = this.d
|
||||
})
|
||||
},
|
||||
impSites () {
|
||||
const str = clipboard.readText()
|
||||
const json = JSON.parse(str)
|
||||
sites.clear().then(res => {
|
||||
this.$message.info('已清空原数据')
|
||||
sites.add(json).then(e => {
|
||||
this.$message.success('已添加成功')
|
||||
this.getSites()
|
||||
this.d.site = json[0].key
|
||||
exportFavorites () {
|
||||
this.getFavorites()
|
||||
const arr = [...this.favoritesList]
|
||||
const str = JSON.stringify(arr, null, 4)
|
||||
const options = {
|
||||
filters: [
|
||||
{ name: 'JSON file', extensions: ['json'] },
|
||||
{ name: 'Normal text file', extensions: ['txt'] },
|
||||
{ name: 'All types', extensions: ['*'] }
|
||||
]
|
||||
}
|
||||
remote.dialog.showSaveDialog(options).then(result => {
|
||||
if (!result.canceled) {
|
||||
fs.writeFileSync(result.filePath, str)
|
||||
this.$message.success('已保存成功')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.$message.error(err)
|
||||
})
|
||||
},
|
||||
importFavorites () {
|
||||
const options = {
|
||||
filters: [
|
||||
{ name: 'JSON file', extensions: ['json'] },
|
||||
{ name: 'Normal text file', extensions: ['txt'] },
|
||||
{ name: 'All types', extensions: ['*'] }
|
||||
],
|
||||
properties: ['openFile', 'multiSelections']
|
||||
}
|
||||
remote.dialog.showOpenDialog(options).then(result => {
|
||||
if (!result.canceled) {
|
||||
result.filePaths.forEach(file => {
|
||||
var str = fs.readFileSync(file)
|
||||
const json = JSON.parse(str)
|
||||
star.bulkAdd(json).then(e => {
|
||||
this.getFavorites()
|
||||
})
|
||||
this.upgradeFavorites()
|
||||
})
|
||||
this.$message.success('导入收藏成功')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.$message.error(err)
|
||||
})
|
||||
},
|
||||
clearFavorites () {
|
||||
star.clear().then(e => {
|
||||
this.getFavorites()
|
||||
this.$message.success('清空所有收藏成功')
|
||||
})
|
||||
},
|
||||
upgradeFavorites () {
|
||||
star.all().then(res => {
|
||||
res.forEach(element => {
|
||||
const docs = {
|
||||
key: element.key,
|
||||
ids: element.ids,
|
||||
name: element.name,
|
||||
type: element.type,
|
||||
year: element.year,
|
||||
last: element.last,
|
||||
note: element.note
|
||||
}
|
||||
star.find({ key: element.key, ids: element.ids }).then(res => {
|
||||
if (!res) {
|
||||
star.add(docs)
|
||||
}
|
||||
})
|
||||
})
|
||||
this.getFavorites()
|
||||
})
|
||||
},
|
||||
selectLocalPlayer () {
|
||||
const options = {
|
||||
filters: [
|
||||
{ name: 'Executable file', extensions: ['exe'] },
|
||||
{ name: 'All types', extensions: ['*'] }
|
||||
],
|
||||
properties: ['openFile']
|
||||
}
|
||||
remote.dialog.showOpenDialog(options).then(result => {
|
||||
if (!result.canceled) {
|
||||
var playerPath = result.filePaths[0].replace(/\\/g, '/')
|
||||
this.$message.success('设定第三方播放器路径为:' + result.filePaths[0])
|
||||
this.d.externalPlayer = playerPath
|
||||
setting.update(this.d).then(res => {
|
||||
this.setting = this.d
|
||||
})
|
||||
}
|
||||
}).catch(err => {
|
||||
this.$message.error(err)
|
||||
})
|
||||
},
|
||||
resetLocalPlayer () {
|
||||
this.d.externalPlayer = ''
|
||||
setting.update(this.d).then(res => {
|
||||
this.setting = this.d
|
||||
this.$message.success('重置第三方播放器成功')
|
||||
})
|
||||
},
|
||||
exportSites () {
|
||||
this.getSites()
|
||||
const arr = [...this.sitesList]
|
||||
const str = JSON.stringify(arr, null, 4)
|
||||
const options = {
|
||||
filters: [
|
||||
{ name: 'JSON file', extensions: ['json'] },
|
||||
{ name: 'Normal text file', extensions: ['txt'] },
|
||||
{ name: 'All types', extensions: ['*'] }
|
||||
]
|
||||
}
|
||||
remote.dialog.showSaveDialog(options).then(result => {
|
||||
if (!result.canceled) {
|
||||
fs.writeFileSync(result.filePath, str)
|
||||
this.$message.success('已保存成功')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.$message.error(err)
|
||||
})
|
||||
},
|
||||
importSites () {
|
||||
const options = {
|
||||
filters: [
|
||||
{ name: 'JSON file', extensions: ['json'] },
|
||||
{ name: 'Normal text file', extensions: ['txt'] },
|
||||
{ name: 'All types', extensions: ['*'] }
|
||||
],
|
||||
properties: ['openFile']
|
||||
}
|
||||
remote.dialog.showOpenDialog(options).then(result => {
|
||||
if (!result.canceled) {
|
||||
sites.clear()
|
||||
result.filePaths.forEach(file => {
|
||||
var str = fs.readFileSync(file)
|
||||
const json = JSON.parse(str)
|
||||
sites.add(json).then(e => {
|
||||
this.getSites()
|
||||
this.d.site = json[0].key
|
||||
setting.update(this.d).then(res => {
|
||||
this.setting = this.d
|
||||
})
|
||||
})
|
||||
this.$message.success('导入成功')
|
||||
}).catch(err => {
|
||||
this.$message.error(err)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
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('重置源成功')
|
||||
})
|
||||
})
|
||||
},
|
||||
@@ -229,7 +420,7 @@ export default {
|
||||
},
|
||||
expShortcut () {
|
||||
const arr = [...this.shortcutList]
|
||||
const str = JSON.stringify(arr)
|
||||
const str = JSON.stringify(arr, null, 4)
|
||||
clipboard.writeText(str)
|
||||
this.$message.success('已复制到剪贴板')
|
||||
},
|
||||
@@ -266,6 +457,7 @@ export default {
|
||||
this.getSetting()
|
||||
this.getSites()
|
||||
this.getShortcut()
|
||||
this.getFavorites()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -313,6 +505,11 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
.search{
|
||||
width: 100%;
|
||||
padding: 20px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.site{
|
||||
width: 100%;
|
||||
padding: 20px;
|
||||
@@ -341,6 +538,7 @@ export default {
|
||||
margin-top: 20px;
|
||||
.theme-box{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
margin-top: 10px;
|
||||
.theme-item{
|
||||
|
||||
@@ -70,16 +70,22 @@ export default {
|
||||
zy.detail(this.share.key, id).then(res => {
|
||||
if (res) {
|
||||
this.pic = res.pic
|
||||
const text = res.dl.dd
|
||||
for (const i of text) {
|
||||
if (i._flag.indexOf('m3u8') >= 0) {
|
||||
const arr = i._t.split('#')
|
||||
const url = arr[0].split('$')[1]
|
||||
this.link = 'http://zyplayer.fun/player/player.html?url=' + url + '&title=' + this.share.info.name
|
||||
var m3u8List = {}
|
||||
const dd = res.dl.dd
|
||||
const type = Object.prototype.toString.call(dd)
|
||||
if (type === '[object Array]') {
|
||||
for (const i of dd) {
|
||||
if (i._flag.indexOf('m3u8') >= 0) {
|
||||
m3u8List = i._t.split('#')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
m3u8List = dd._t.split('#')
|
||||
}
|
||||
this.loading = false
|
||||
const url = m3u8List[1]
|
||||
this.link = 'http://zyplayer.fun/player/player.html?url=' + url + '&title=' + this.share.info.name
|
||||
}
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
picLoadEvent () {
|
||||
|
||||
@@ -7,18 +7,18 @@
|
||||
</div>
|
||||
<div class="tBody zy-scroll">
|
||||
<ul>
|
||||
<li v-for="(i, j) in list" :key="j" @click="detailEvent(i)">
|
||||
<li v-for="(i, j) in list" :key="j" @click="detailEvent(i)" :class="[i.hasUpdate ? 'zy-highlighted': '']">
|
||||
<span class="name">{{i.name}}</span>
|
||||
<span class="type">{{i.type}}</span>
|
||||
<span class="time">{{i.year}}</span>
|
||||
<span class="from">{{i.site}}</span>
|
||||
<span class="site">{{getSiteName(i.key)}}</span>
|
||||
<span class="note">{{i.note}}</span>
|
||||
<span class="operate" style="width: 220px">
|
||||
<span class="operate">
|
||||
<span class="btn" @click.stop="playEvent(i)">播放</span>
|
||||
<span class="btn" @click.stop="deleteEvent(i)">删除</span>
|
||||
<span class="btn" @click.stop="shareEvent(i)">分享</span>
|
||||
<span class="btn" @click.stop="updateEvent(i)">同步</span>
|
||||
<span class="btn" @click.stop="downloadEvent(i)">下载</span>
|
||||
<span class="btn" @click.stop="deleteEvent(i)">删除</span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -29,14 +29,15 @@
|
||||
</template>
|
||||
<script>
|
||||
import { mapMutations } from 'vuex'
|
||||
import { star, history } from '../lib/dexie'
|
||||
import { star, history, sites } from '../lib/dexie'
|
||||
import zy from '../lib/site/tools'
|
||||
const { clipboard } = require('electron')
|
||||
export default {
|
||||
name: 'star',
|
||||
data () {
|
||||
return {
|
||||
list: []
|
||||
list: [],
|
||||
sites: []
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@@ -76,6 +77,7 @@ export default {
|
||||
watch: {
|
||||
view () {
|
||||
this.getStarList()
|
||||
this.getAllsites()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -83,21 +85,27 @@ export default {
|
||||
detailEvent (e) {
|
||||
this.detail = {
|
||||
show: true,
|
||||
key: e.site,
|
||||
key: e.key,
|
||||
info: {
|
||||
id: e.ids,
|
||||
name: e.name
|
||||
}
|
||||
}
|
||||
if (e.hasUpdate) {
|
||||
this.clearHasUpdateFlag(e)
|
||||
}
|
||||
},
|
||||
playEvent (e) {
|
||||
history.find({ site: e.site, ids: e.ids }).then(res => {
|
||||
history.find({ site: e.key, ids: e.ids }).then(res => {
|
||||
if (res) {
|
||||
this.video = { key: res.site, info: { id: res.ids, name: res.name, index: res.index } }
|
||||
this.video = { key: e.key, info: { id: res.ids, name: res.name, index: res.index } }
|
||||
} else {
|
||||
this.video = { key: e.site, info: { id: e.ids, name: e.name, index: 0 } }
|
||||
this.video = { key: e.key, info: { id: e.ids, name: e.name, index: 0 } }
|
||||
}
|
||||
})
|
||||
if (e.hasUpdate) {
|
||||
this.clearHasUpdateFlag(e)
|
||||
}
|
||||
this.view = 'Play'
|
||||
},
|
||||
deleteEvent (e) {
|
||||
@@ -113,32 +121,43 @@ export default {
|
||||
shareEvent (e) {
|
||||
this.share = {
|
||||
show: true,
|
||||
key: e.site,
|
||||
key: e.key,
|
||||
info: e
|
||||
}
|
||||
},
|
||||
clearHasUpdateFlag (e) {
|
||||
star.find({ id: e.id }).then(res => {
|
||||
res.hasUpdate = false
|
||||
star.update(e.id, res)
|
||||
this.getStarList()
|
||||
})
|
||||
},
|
||||
updateEvent (e) {
|
||||
zy.detail(e.site, e.ids).then(res => {
|
||||
zy.detail(e.key, e.ids).then(res => {
|
||||
var doc = {
|
||||
key: e.key,
|
||||
id: e.id,
|
||||
ids: res.id,
|
||||
last: res.last,
|
||||
name: res.name,
|
||||
type: res.type,
|
||||
year: res.year,
|
||||
note: res.note
|
||||
}
|
||||
if (e.last === res.last) {
|
||||
var msg = `同步"${e.name}"成功, 未查询到更新。`
|
||||
this.$message.info(msg)
|
||||
doc.hasUpdate = false
|
||||
star.update(e.id, doc).then(res => {
|
||||
var msg = `同步"${e.name}"成功, 未查询到更新。`
|
||||
this.$message.info(msg)
|
||||
})
|
||||
} else {
|
||||
const doc = {
|
||||
id: e.id,
|
||||
ids: res.id,
|
||||
last: res.last,
|
||||
name: res.name,
|
||||
site: e.site,
|
||||
type: res.type,
|
||||
year: res.year,
|
||||
note: res.note
|
||||
}
|
||||
doc.hasUpdate = true
|
||||
star.update(e.id, doc).then(res => {
|
||||
var msg = `同步"${e.name}"成功, 检查到更新。`
|
||||
this.$message.success(msg)
|
||||
})
|
||||
this.getStarList()
|
||||
}
|
||||
this.getStarList()
|
||||
}).catch(err => {
|
||||
var msg = `同步"${e.name}"失败, 请重试。`
|
||||
this.$message.warning(msg, err)
|
||||
@@ -150,8 +169,8 @@ export default {
|
||||
})
|
||||
},
|
||||
downloadEvent (e) {
|
||||
zy.download(e.site, e.ids).then(res => {
|
||||
if (res) {
|
||||
zy.download(e.key, e.ids).then(res => {
|
||||
if (res && res.dl && res.dl.dd) {
|
||||
const text = res.dl.dd._t
|
||||
if (text) {
|
||||
const list = text.split('#')
|
||||
@@ -166,21 +185,46 @@ export default {
|
||||
this.$message.warning('没有查询到下载链接.')
|
||||
}
|
||||
} else {
|
||||
const list = [...this.m3u8List]
|
||||
let downloadUrl = ''
|
||||
for (const i of list) {
|
||||
const url = encodeURI(i.split('$')[1])
|
||||
downloadUrl += (url + '\n')
|
||||
}
|
||||
clipboard.writeText(downloadUrl)
|
||||
this.$message.success('『M3U8』格式的链接已复制, 快去下载吧!')
|
||||
var m3u8List = {}
|
||||
zy.detail(e.key, e.ids).then(res => {
|
||||
const dd = res.dl.dd
|
||||
const type = Object.prototype.toString.call(dd)
|
||||
if (type === '[object Array]') {
|
||||
for (const i of dd) {
|
||||
if (i._flag.indexOf('m3u8') >= 0) {
|
||||
m3u8List = i._t.split('#')
|
||||
}
|
||||
}
|
||||
} else {
|
||||
m3u8List = dd._t.split('#')
|
||||
}
|
||||
const list = [...m3u8List]
|
||||
let downloadUrl = ''
|
||||
for (const i of list) {
|
||||
const url = encodeURI(i.split('$')[1])
|
||||
downloadUrl += (url + '\n')
|
||||
}
|
||||
clipboard.writeText(downloadUrl)
|
||||
this.$message.success('『M3U8』格式的链接已复制, 快去下载吧!')
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
getSiteName (key) {
|
||||
var site = this.sites.find(e => e.key === key)
|
||||
if (site) {
|
||||
return site.name
|
||||
}
|
||||
},
|
||||
getStarList () {
|
||||
star.all().then(res => {
|
||||
this.list = res.reverse()
|
||||
})
|
||||
},
|
||||
getAllsites () {
|
||||
sites.all().then(res => {
|
||||
this.sites = res
|
||||
})
|
||||
}
|
||||
},
|
||||
created () {
|
||||
|
||||
@@ -9,5 +9,8 @@ export default {
|
||||
},
|
||||
async add (doc) {
|
||||
return await sites.bulkAdd(doc)
|
||||
},
|
||||
async find (doc) {
|
||||
return await sites.get(doc)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@ export default {
|
||||
async add (doc) {
|
||||
return await star.add(doc)
|
||||
},
|
||||
async bulkAdd (doc) {
|
||||
return await star.bulkAdd(doc)
|
||||
},
|
||||
async find (doc) {
|
||||
return await star.get(doc)
|
||||
},
|
||||
@@ -15,5 +18,8 @@ export default {
|
||||
},
|
||||
async remove (id) {
|
||||
return await star.delete(id)
|
||||
},
|
||||
async clear () {
|
||||
return await star.clear()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,54 +125,6 @@ export default {
|
||||
}
|
||||
})
|
||||
})
|
||||
// zy.detail(res.site, res.ids).then(e => {
|
||||
// this.name = e.name
|
||||
// this.detail = e
|
||||
// const dd = e.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('#')
|
||||
// }
|
||||
// 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.m3u8Arr = m3u8Arr
|
||||
// this.xg.src = m3u8Arr[res.index]
|
||||
// if (res.time !== 0 || res.time !== '') {
|
||||
// this.xg.play()
|
||||
// this.xg.once('playing', () => {
|
||||
// this.xg.currentTime = res.time
|
||||
// })
|
||||
// } else {
|
||||
// this.xg.play()
|
||||
// }
|
||||
// this.videoPlaying()
|
||||
// this.xg.once('ended', () => {
|
||||
// if (m3u8Arr.length > 1 && (m3u8Arr.length - 1 > res.index)) {
|
||||
// this.video.time = 0
|
||||
// this.video.index++
|
||||
// this.xg.src = m3u8Arr[this.video.index]
|
||||
// this.xg.play()
|
||||
// }
|
||||
// })
|
||||
// })
|
||||
})
|
||||
},
|
||||
fetchM3u8List (info) {
|
||||
|
||||
Reference in New Issue
Block a user