mirror of
https://github.com/cuiocean/ZY-Player.git
synced 2026-02-15 00:16:26 +08:00
Compare commits
57 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
cd77384bd9 | ||
|
|
64adc9d6c1 | ||
|
|
e9095e50a6 | ||
|
|
acfa742b4f | ||
|
|
a79c48cba0 | ||
|
|
904ef5ccea | ||
|
|
3db281c87f | ||
|
|
076e6e99e4 | ||
|
|
32f6ac0310 | ||
|
|
b8706ea432 | ||
|
|
509d6c7900 |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "zy",
|
||||
"version": "2.3.3",
|
||||
"version": "2.4.2",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
@@ -18,6 +18,7 @@
|
||||
"main": "background.js",
|
||||
"dependencies": {
|
||||
"axios": "^0.19.2",
|
||||
"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);
|
||||
}
|
||||
@@ -336,4 +339,8 @@
|
||||
background-color: var(--g-bgc-1);
|
||||
}
|
||||
}
|
||||
.history{
|
||||
background-color: var(--g-bgc-1);
|
||||
box-shadow: var(--g-bsc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -336,4 +339,8 @@
|
||||
background-color: var(--l-bgc-1);
|
||||
}
|
||||
}
|
||||
.history{
|
||||
background-color: var(--l-bgc-1);
|
||||
box-shadow: var(--l-bsc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -336,4 +339,8 @@
|
||||
background-color: var(--p-bgc-1);
|
||||
}
|
||||
}
|
||||
.history{
|
||||
background-color: var(--p-bgc-1);
|
||||
box-shadow: var(--p-bsc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,9 +121,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,18 +131,22 @@ 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.site.key,
|
||||
site: this.detail.site,
|
||||
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
|
||||
}
|
||||
star.add(docs).then(res => {
|
||||
this.$message.success('收藏成功')
|
||||
})
|
||||
|
||||
@@ -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,16 +37,16 @@
|
||||
<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.type}}</span>
|
||||
@@ -60,16 +60,16 @@
|
||||
<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="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,18 +81,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>
|
||||
@@ -199,7 +200,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 = {}
|
||||
@@ -275,35 +276,38 @@ 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,
|
||||
site: site,
|
||||
ids: e.id,
|
||||
name: e.name,
|
||||
type: e.type,
|
||||
year: e.year,
|
||||
last: e.last
|
||||
last: e.last,
|
||||
note: e.note
|
||||
}
|
||||
star.add(docs).then(res => {
|
||||
this.$message.success('收藏成功')
|
||||
@@ -313,15 +317,15 @@ 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 => {
|
||||
downloadEvent (site, e) {
|
||||
zy.download(site.key, e.id).then(res => {
|
||||
if (res.length > 0) {
|
||||
const text = res.dl.dd._t
|
||||
if (text) {
|
||||
@@ -338,7 +342,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) {
|
||||
@@ -376,8 +380,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
|
||||
@@ -389,18 +393,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 => {
|
||||
@@ -410,28 +420,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,10 +9,10 @@
|
||||
<ul>
|
||||
<li v-show="this.history.length === 0">无数据</li>
|
||||
<li v-for="(i, j) in history" :key="j" @click="historyItemEvent(i)">
|
||||
<span class="name">{{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="playEvent(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="downloadEvent(i)">下载</span>
|
||||
<span class="btn" @click.stop="removeHistoryItem(i)">删除</span>
|
||||
@@ -26,14 +26,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 +74,7 @@ export default {
|
||||
watch: {
|
||||
view () {
|
||||
this.getAllhistory()
|
||||
this.getAllsites()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -135,6 +137,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,20 +467,19 @@ 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,
|
||||
key: this.video.key,
|
||||
site: this.video.site,
|
||||
ids: info.id,
|
||||
name: info.name,
|
||||
type: info.type,
|
||||
year: info.year,
|
||||
last: info.last
|
||||
last: info.last,
|
||||
note: info.note
|
||||
}
|
||||
star.add(docs).then(res => {
|
||||
this.$message.success('收藏成功')
|
||||
@@ -536,6 +541,19 @@ export default {
|
||||
clipboard.writeText(JSON.stringify(info, null, 4))
|
||||
this.$message.success('视频信息复制成功')
|
||||
},
|
||||
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 {
|
||||
this.$message.error('请设置第三方播放器路径')
|
||||
}
|
||||
})
|
||||
},
|
||||
checkStar () {
|
||||
star.find({ site: this.video.key, ids: this.video.info.id }).then(res => {
|
||||
if (res) {
|
||||
|
||||
@@ -44,6 +44,31 @@
|
||||
</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>
|
||||
</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="selectExternalPlayer">选择</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="site">
|
||||
<div class="title">源管理</div>
|
||||
<div class="site-box">
|
||||
@@ -115,9 +140,10 @@
|
||||
<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 fs from 'fs'
|
||||
export default {
|
||||
name: 'setting',
|
||||
data () {
|
||||
@@ -125,6 +151,7 @@ export default {
|
||||
pkg: pkg,
|
||||
sitesList: [],
|
||||
shortcutList: [],
|
||||
favoritesList: [],
|
||||
show: {
|
||||
site: false,
|
||||
shortcut: false,
|
||||
@@ -135,7 +162,9 @@ export default {
|
||||
site: '',
|
||||
theme: '',
|
||||
shortcut: true,
|
||||
view: 'picture'
|
||||
searchAllSites: true,
|
||||
view: 'picture',
|
||||
externalPlayer: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -161,7 +190,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 +207,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,25 +228,123 @@ 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 () {
|
||||
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.$message.success('导入收藏成功')
|
||||
}
|
||||
}).catch(err => {
|
||||
this.$message.error(err)
|
||||
})
|
||||
},
|
||||
selectExternalPlayer () {
|
||||
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.$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)
|
||||
})
|
||||
},
|
||||
expSites () {
|
||||
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)
|
||||
})
|
||||
},
|
||||
impSites () {
|
||||
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)
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
changeTheme (e) {
|
||||
@@ -266,6 +400,7 @@ export default {
|
||||
this.getSetting()
|
||||
this.getSites()
|
||||
this.getShortcut()
|
||||
this.getFavorites()
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -313,6 +448,11 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
.search{
|
||||
width: 100%;
|
||||
padding: 20px;
|
||||
margin-top: 20px;
|
||||
}
|
||||
.site{
|
||||
width: 100%;
|
||||
padding: 20px;
|
||||
@@ -341,6 +481,7 @@ export default {
|
||||
margin-top: 20px;
|
||||
.theme-box{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: flex-start;
|
||||
margin-top: 10px;
|
||||
.theme-item{
|
||||
|
||||
@@ -7,12 +7,13 @@
|
||||
</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="operate" style="width: 220px">
|
||||
<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="deleteEvent(i)">删除</span>
|
||||
<span class="btn" @click.stop="shareEvent(i)">分享</span>
|
||||
@@ -82,21 +83,23 @@ export default {
|
||||
detailEvent (e) {
|
||||
this.detail = {
|
||||
show: true,
|
||||
key: e.site,
|
||||
key: e.site.key,
|
||||
info: {
|
||||
id: e.ids,
|
||||
name: e.name
|
||||
}
|
||||
}
|
||||
this.clearHasUpdateFlag(e)
|
||||
},
|
||||
playEvent (e) {
|
||||
history.find({ site: e.site, ids: e.ids }).then(res => {
|
||||
history.find({ site: e.site.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: res.site, info: { id: res.ids, name: res.name, index: res.index, site: e.site } }
|
||||
} else {
|
||||
this.video = { key: e.site, info: { id: e.ids, name: e.name, index: 0 } }
|
||||
this.video = { key: e.site.key, info: { id: e.ids, name: e.name, index: 0, site: e.site } }
|
||||
}
|
||||
})
|
||||
this.clearHasUpdateFlag(e)
|
||||
this.view = 'Play'
|
||||
},
|
||||
deleteEvent (e) {
|
||||
@@ -112,12 +115,19 @@ export default {
|
||||
shareEvent (e) {
|
||||
this.share = {
|
||||
show: true,
|
||||
key: e.site,
|
||||
key: e.site.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.site.key, e.ids).then(res => {
|
||||
if (e.last === res.last) {
|
||||
var msg = `同步"${e.name}"成功, 未查询到更新。`
|
||||
this.$message.info(msg)
|
||||
@@ -129,12 +139,15 @@ export default {
|
||||
name: res.name,
|
||||
site: e.site,
|
||||
type: res.type,
|
||||
year: res.year
|
||||
year: res.year,
|
||||
note: res.note,
|
||||
hasUpdate: true
|
||||
}
|
||||
star.update(e.id, doc).then(res => {
|
||||
var msg = `同步"${e.name}"成功, 检查到更新。`
|
||||
this.$message.success(msg)
|
||||
})
|
||||
this.getStarList()
|
||||
}
|
||||
}).catch(err => {
|
||||
var msg = `同步"${e.name}"失败, 请重试。`
|
||||
@@ -147,7 +160,7 @@ export default {
|
||||
})
|
||||
},
|
||||
downloadEvent (e) {
|
||||
zy.download(e.site, e.ids).then(res => {
|
||||
zy.download(e.site.key, e.ids).then(res => {
|
||||
if (res) {
|
||||
const text = res.dl.dd._t
|
||||
if (text) {
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user