mirror of
https://github.com/cuiocean/ZY-Player.git
synced 2026-02-15 00:16:26 +08:00
Compare commits
87 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f296a1170 | ||
|
|
f8228a71f3 | ||
|
|
9886f04b48 | ||
|
|
37c4aad4b0 | ||
|
|
77d7b28e26 | ||
|
|
3505b22344 | ||
|
|
80cec08982 | ||
|
|
f92094daec | ||
|
|
2c06ef1da6 | ||
|
|
06403ece3f | ||
|
|
39a6491403 | ||
|
|
edb82eb3be | ||
|
|
c7ca3df50d | ||
|
|
0b198381b1 | ||
|
|
2dcda83741 | ||
|
|
5b3c3f0ff2 | ||
|
|
23454f7c7f | ||
|
|
0fdfe29343 | ||
|
|
fa7a799e2b | ||
|
|
9c1a707279 | ||
|
|
7b69bb05d4 | ||
|
|
3b6b6ea11b | ||
|
|
9ec65ab027 | ||
|
|
da5531a947 | ||
|
|
4744f91f6b | ||
|
|
36b80c1d7e | ||
|
|
15f4ab7248 | ||
|
|
0e25c25480 | ||
|
|
7ff48a407d | ||
|
|
bbc371b1c5 | ||
|
|
d141d60e77 | ||
|
|
80af701e5c | ||
|
|
f0e70e03cb | ||
|
|
aba3472f2e | ||
|
|
8772076d76 | ||
|
|
4abe03347a | ||
|
|
b3e6e817dd | ||
|
|
e48445c224 | ||
|
|
159f19d5ec | ||
|
|
c2953a530c | ||
|
|
9166f129d8 | ||
|
|
72ac3eafdd | ||
|
|
8610b41fad | ||
|
|
06e4c0e83e | ||
|
|
5db3fd9f9b | ||
|
|
978afb2b38 | ||
|
|
b00b69a582 | ||
|
|
9a33b0cfb3 | ||
|
|
f4bf42bf07 | ||
|
|
671a6e32d0 | ||
|
|
d05534fb17 | ||
|
|
b655c8c8bc | ||
|
|
8fbea8ab57 | ||
|
|
2ddfc66104 | ||
|
|
26d62cdef4 | ||
|
|
7f6be795b5 | ||
|
|
d7fc97b3d7 | ||
|
|
4a2aa9ee4b | ||
|
|
f4aeec0937 | ||
|
|
ea06a52921 | ||
|
|
26dc24d216 | ||
|
|
1c57c37997 | ||
|
|
15a6370785 | ||
|
|
c8580ff6e6 | ||
|
|
a104e7cfa8 | ||
|
|
c649d97021 | ||
|
|
17601935f1 | ||
|
|
0f85e65e26 | ||
|
|
8eb4ca5090 | ||
|
|
d6fcd151e3 | ||
|
|
711637ac8b | ||
|
|
1769fb9780 | ||
|
|
40de0337be | ||
|
|
b0fbdeef15 | ||
|
|
f75d961aaa | ||
|
|
12e2500fd7 | ||
|
|
e405225e02 | ||
|
|
dcba96a773 | ||
|
|
9910daa7c0 | ||
|
|
5ac57092db | ||
|
|
8864a624f5 | ||
|
|
72ae7494d2 | ||
|
|
877b564322 | ||
|
|
52562a1a12 | ||
|
|
43ff812b21 | ||
|
|
a3a26e0deb | ||
|
|
289f3c3c2d |
35964
package-lock.json
generated
Normal file
35964
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
23
package.json
23
package.json
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "zy",
|
||||
"version": "2.7.5",
|
||||
"version": "2.8.4",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
@@ -18,22 +18,23 @@
|
||||
"main": "background.js",
|
||||
"dependencies": {
|
||||
"axios": "^0.21.1",
|
||||
"cheerio": "^1.0.0-rc.5",
|
||||
"core-js": "^3.9.0",
|
||||
"bootstrap-vue": "^2.21.2",
|
||||
"cheerio": "^1.0.0-rc.6",
|
||||
"core-js": "^3.10.2",
|
||||
"dexie": "^3.0.3",
|
||||
"electron-localshortcut": "^3.2.1",
|
||||
"electron-proxy-agent": "^1.2.0",
|
||||
"electron-updater": "^4.3.5",
|
||||
"element-ui": "^2.15.0",
|
||||
"fast-xml-parser": "^3.18.0",
|
||||
"electron-updater": "^4.3.8",
|
||||
"element-ui": "^2.15.1",
|
||||
"fast-xml-parser": "^3.19.0",
|
||||
"html2canvas": "^1.0.0-rc.7",
|
||||
"iptv-playlist-parser": "^0.6.0",
|
||||
"m3u": "0.0.2",
|
||||
"m3u8-parser": "^4.5.2",
|
||||
"m3u8-parser": "^4.6.0",
|
||||
"memcached": "^2.2.2",
|
||||
"modern-normalize": "^1.0.0",
|
||||
"mousetrap": "^1.6.5",
|
||||
"pinyin-match": "^1.2.0",
|
||||
"pinyin-match": "^1.2.1",
|
||||
"qrcode.vue": "^1.7.0",
|
||||
"randomstring": "^1.1.5",
|
||||
"session": "^0.1.0",
|
||||
@@ -44,9 +45,9 @@
|
||||
"vue-waterfall-plugin": "^1.1.0",
|
||||
"vuedraggable": "^2.24.3",
|
||||
"vuex": "^3.6.2",
|
||||
"xgplayer": "^2.18.0",
|
||||
"xgplayer-flv.js": "^2.2.0",
|
||||
"xgplayer-hls.js": "^2.4.1"
|
||||
"xgplayer": "2.19.1",
|
||||
"xgplayer-flv.js": "^2.3.0",
|
||||
"xgplayer-hls.js": "^2.4.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "~4.5.11",
|
||||
|
||||
53
src/App.vue
53
src/App.vue
@@ -22,11 +22,62 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { setting } from './lib/dexie'
|
||||
const { remote } = require('electron')
|
||||
export default {
|
||||
name: 'App',
|
||||
data () {
|
||||
return {
|
||||
appTheme: 'theme-light'
|
||||
appTheme: 'theme-light',
|
||||
winSizePosition: {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 0,
|
||||
height: 0
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
// 窗口创建口,检查是否有窗口大小位置的记录,如果有的话,更新窗口位置及大小
|
||||
setting.find().then(res => {
|
||||
if (res.restoreWindowPositionAndSize) {
|
||||
var win = remote.getCurrentWindow()
|
||||
win.setBounds({
|
||||
x: res.windowPositionAndSize.x,
|
||||
y: res.windowPositionAndSize.y,
|
||||
width: res.windowPositionAndSize.width,
|
||||
height: res.windowPositionAndSize.height
|
||||
})
|
||||
this.winSizePosition = {
|
||||
x: win.getPosition()[0],
|
||||
y: win.getPosition()[1],
|
||||
width: win.getSize()[0],
|
||||
height: win.getSize()[1]
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
updated () {
|
||||
// 本来想hook up到beforedestroy, 但不工作
|
||||
// 每当窗口更新时,检查窗口大小及位置,记录到setting数据库中
|
||||
if (this.setting.restoreWindowPositionAndSize) {
|
||||
const win = remote.getCurrentWindow()
|
||||
var newWinSizePosition = {
|
||||
x: win.getPosition()[0],
|
||||
y: win.getPosition()[1],
|
||||
width: win.getSize()[0],
|
||||
height: win.getSize()[1]
|
||||
}
|
||||
if (newWinSizePosition.x !== this.winSizePosition.x ||
|
||||
newWinSizePosition.y !== this.winSizePosition.y ||
|
||||
newWinSizePosition.width !== this.winSizePosition.width ||
|
||||
newWinSizePosition.height !== this.winSizePosition.height) {
|
||||
this.winSizePosition = newWinSizePosition
|
||||
setting.find().then(res => {
|
||||
res.windowPositionAndSize = newWinSizePosition
|
||||
setting.update(res)
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
|
||||
@@ -178,7 +178,6 @@
|
||||
.el-select-dropdown__item.selected.hover{ //是上游的bug吗?临时性修补
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.el-select-dropdown__wrap{
|
||||
max-height: 574px
|
||||
}
|
||||
@@ -284,7 +283,8 @@
|
||||
cursor: pointer;
|
||||
transition: 0.2s;
|
||||
&:hover {
|
||||
top: -3px;
|
||||
width: 102%;
|
||||
height: 102%
|
||||
}
|
||||
.img{
|
||||
position: relative;
|
||||
@@ -441,3 +441,134 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// detail
|
||||
.detail{
|
||||
.detail-content{
|
||||
.detail-body{
|
||||
.m3u8{
|
||||
.show-picture{
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
.card{
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
cursor: pointer;
|
||||
transition: 0.2s;
|
||||
&:hover {
|
||||
width: 102%;
|
||||
height: 102%
|
||||
}
|
||||
.img{
|
||||
position: relative;
|
||||
min-height: 40px;
|
||||
img{
|
||||
width: 100%;
|
||||
height: auto;
|
||||
cursor: pointer;
|
||||
}
|
||||
.rate{
|
||||
position: absolute;
|
||||
top: 3%;
|
||||
right: -40%;
|
||||
width: 100%;
|
||||
background-color: #111111aa;
|
||||
color:#2f90b9;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
font-size: 14px;
|
||||
font-weight: bolder;
|
||||
text-align: center;
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
.site{
|
||||
position: absolute;
|
||||
top: 0%;
|
||||
left: 0%;
|
||||
width: 100%;
|
||||
background-color: #111111aa;
|
||||
color:#2f90b9;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
font-size: 14px;
|
||||
font-weight: bolder;
|
||||
text-align: center;
|
||||
}
|
||||
.progress{
|
||||
position: absolute;
|
||||
bottom: 10%;
|
||||
left: 0%;
|
||||
width: 40%;
|
||||
background-color: #111111aa;
|
||||
color: #f8df70;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
font-size: 14px;
|
||||
font-weight: bolder;
|
||||
text-align: left;
|
||||
}
|
||||
.update{
|
||||
position: absolute;
|
||||
top: 5%;
|
||||
left: -40%;
|
||||
width: 100%;
|
||||
background-color: #68b88e;
|
||||
color: #cdcdcd;
|
||||
height: 30px;
|
||||
line-height: 30px;
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
transform: rotate(-45deg);
|
||||
}
|
||||
.operate{
|
||||
display: none;
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
background-color: #111111aa;
|
||||
width: 100%;
|
||||
font-size: 13px;
|
||||
.operate-wrap{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
.o-play, .o-star, .o-share{
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
width: 80px;
|
||||
height: 36px;
|
||||
text-align: center;
|
||||
line-height: 36px;
|
||||
color: #cdcdcd;
|
||||
&:hover{
|
||||
background-color: #111;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.name{
|
||||
font-size: 16px;
|
||||
padding: 10px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.info{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
font-size: 12px;
|
||||
padding: 10px;
|
||||
}
|
||||
&:hover{
|
||||
.operate{
|
||||
display: block;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,7 @@
|
||||
--l-fc-3: #823aa0;
|
||||
--l-bgc-1: #ffffff;
|
||||
--l-bgc-2: #f2f6f9;
|
||||
--l-bgc-3: #F9FBFC;
|
||||
--l-bsc: 0 1px 3px #8e8da233, 0 1px 2px #8e8da244;
|
||||
--l-bsc-hover: 0 14px 28px #8e8da255, 0 10px 10px #8e8da244;
|
||||
--l-bsc-2: 0 -4px 23px 0 #8e8da233;
|
||||
@@ -32,6 +33,7 @@
|
||||
--d-fc-3: #38dd77;
|
||||
--d-bgc-1: #222222;
|
||||
--d-bgc-2: #2f2f2f;
|
||||
--d-bgc-3: #292929;
|
||||
--d-bsc: 0 1px 3px #38dd7733, 0 1px 2px #38dd7744;
|
||||
--d-bsc-hover: 0 14px 28px #38dd7755, 0 10px 10px #38dd7744;
|
||||
--d-bsc-2: 0 -4px 23px 0 #38dd7733;
|
||||
@@ -50,6 +52,7 @@
|
||||
--g-fc-3: #C1D95C;
|
||||
--g-bgc-1: #4baea0;
|
||||
--g-bgc-2: #74b4ac;
|
||||
--g-bgc-3: #60B1A6;
|
||||
--g-bsc: 0 1px 3px #e1ebe033, 0 1px 2px #e1ebe044;
|
||||
--g-bsc-hover: 0 14px 28px #e1ebe055, 0 10px 10px #e1ebe044;
|
||||
--g-bsc-2: 0 -4px 23px 0 #e1ebe033;
|
||||
@@ -68,6 +71,7 @@
|
||||
--p-fc-3: #177ea7;
|
||||
--p-bgc-1: #ff8499;
|
||||
--p-bgc-2: #fea1b2;
|
||||
--p-bgc-3: #FF93A6;
|
||||
--p-bsc: 0 1px 3px #ef528533, 0 1px 2px #ef528544;
|
||||
--p-bsc-hover: 0 14px 28px #ef528555, 0 10px 10px #ef528544;
|
||||
--p-bsc-2: 0 -4px 23px 0 #ef528533;
|
||||
|
||||
@@ -138,6 +138,17 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.show-picture{
|
||||
color: var(--d-fc-1);
|
||||
.card{
|
||||
background-color: var(--d-bgc-3);
|
||||
box-shadow: var(--d-bsc);
|
||||
transition: all 0.3s cubic-bezier(.25,.8,.25,1);
|
||||
&:hover{
|
||||
box-shadow: var(--d-bsc-hover);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -461,7 +472,7 @@
|
||||
.show-picture{
|
||||
color: var(--d-fc-1);
|
||||
.card{
|
||||
background-color: var(--d-bgc-1);
|
||||
background-color: var(--d-bgc-3);
|
||||
box-shadow: var(--d-bsc);
|
||||
transition: all 0.3s cubic-bezier(.25,.8,.25,1);
|
||||
&:hover{
|
||||
|
||||
@@ -138,6 +138,17 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.show-picture{
|
||||
color: var(--g-fc-1);
|
||||
.card{
|
||||
background-color: var(--g-bgc-3);
|
||||
box-shadow: var(--g-bsc);
|
||||
transition: all 0.3s cubic-bezier(.25,.8,.25,1);
|
||||
&:hover{
|
||||
box-shadow: var(--g-bsc-hover);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -449,7 +460,7 @@
|
||||
.show-picture{
|
||||
color: var(--g-fc-1);
|
||||
.card{
|
||||
background-color: var(--g-bgc-1);
|
||||
background-color: var(--g-bgc-3);
|
||||
box-shadow: var(--g-bsc);
|
||||
transition: all 0.3s cubic-bezier(.25,.8,.25,1);
|
||||
&:hover{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
.theme-light{
|
||||
background-color: var(--l-bgc-1);
|
||||
// background-color: var(--l-bgc-1);
|
||||
background: rgba(0, 0, 0, 0);
|
||||
.zy-select{
|
||||
color: var(--l-fc-1);
|
||||
background-color: var(--l-bgc-1);
|
||||
@@ -138,6 +139,17 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.show-picture{
|
||||
color: var(--l-fc-1);
|
||||
.card{
|
||||
background-color: var(--l-bgc-3);
|
||||
box-shadow: var(--l-bsc);
|
||||
transition: all 0.3s cubic-bezier(.25,.8,.25,1);
|
||||
&:hover{
|
||||
box-shadow: var(--l-bsc-hover);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -449,7 +461,7 @@
|
||||
.show-picture{
|
||||
color: var(--l-fc-1);
|
||||
.card{
|
||||
background-color: var(--l-bgc-1);
|
||||
background-color: var(--l-bgc-3);
|
||||
box-shadow: var(--l-bsc);
|
||||
transition: all 0.3s cubic-bezier(.25,.8,.25,1);
|
||||
&:hover{
|
||||
|
||||
@@ -138,6 +138,17 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.show-picture{
|
||||
color: var(--p-fc-1);
|
||||
.card{
|
||||
background-color: var(--p-bgc-3);
|
||||
box-shadow: var(--p-bsc);
|
||||
transition: all 0.3s cubic-bezier(.25,.8,.25,1);
|
||||
&:hover{
|
||||
box-shadow: var(--p-bsc-hover);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -449,7 +460,7 @@
|
||||
.show-picture{
|
||||
color: var(--p-fc-1);
|
||||
.card{
|
||||
background-color: var(--p-bgc-1);
|
||||
background-color: var(--p-bgc-3);
|
||||
box-shadow: var(--p-bsc);
|
||||
transition: all 0.3s cubic-bezier(.25,.8,.25,1);
|
||||
&:hover{
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
</svg>
|
||||
</span>
|
||||
</div>
|
||||
<div class="detail-body zy-scroll" v-show="!loading">
|
||||
<div class="detail-body zy-scroll listpage" v-show="!loading">
|
||||
<div class="info">
|
||||
<div class="info-left">
|
||||
<img :src="info.pic" alt="">
|
||||
@@ -37,9 +37,9 @@
|
||||
</div>
|
||||
<div class="operate">
|
||||
<span @click="playEvent(selectedEpisode)">播放</span>
|
||||
<span @click="starEvent">收藏</span>
|
||||
<span @click="starEvent(info)">收藏</span>
|
||||
<span @click="downloadEvent">下载</span>
|
||||
<span @click="shareEvent">分享</span>
|
||||
<span @click="shareEvent(info,selectedEpisode)">分享</span>
|
||||
<span @click="doubanLinkEvent">豆瓣</span>
|
||||
<span @click="togglePlayOnlineEvent">
|
||||
<input type="checkbox" v-model="playOnline"> 播放在线高清视频
|
||||
@@ -64,6 +64,47 @@
|
||||
<span v-bind:class="{ selected: j === selectedEpisode }" v-for="(i, j) in videoList" :key="j" @click="playEvent(j)" @mouseenter="() => { selectedEpisode = j }">{{ i | ftName(j) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="m3u8">
|
||||
<div class="show-picture" v-show="info.recommendations && info.recommendations.length > 0">
|
||||
<span>喜欢这部电影的人也喜欢 · · · · · ·</span>
|
||||
<Waterfall :list="info.recommendations" :gutter="20" :width="240"
|
||||
:breakpoints="{
|
||||
1200: { //当屏幕宽度小于等于1200
|
||||
rowPerView: 4,
|
||||
},
|
||||
800: { //当屏幕宽度小于等于800
|
||||
rowPerView: 3,
|
||||
},
|
||||
500: { //当屏幕宽度小于等于500
|
||||
rowPerView: 2,
|
||||
}
|
||||
}"
|
||||
animationEffect="fadeIn"
|
||||
backgroundColor="rgba(0, 0, 0, 0)">
|
||||
<template slot="item" slot-scope="props">
|
||||
<div class="card">
|
||||
<div class="img">
|
||||
<img style="width: 100%" :src="props.data.pic" alt="" @click="detailEvent(props.data)">
|
||||
<div class="operate">
|
||||
<div class="operate-wrap">
|
||||
<span class="o-play" @click="playRecommendationEvent(props.data)">播放</span>
|
||||
<span class="o-star" @click="starEvent(props.data)">收藏</span>
|
||||
<span class="o-share" @click="shareEvent(props.data, 0)">分享</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="name">{{props.data.name}}</div>
|
||||
<div class="info">
|
||||
<span>{{props.data.area}}</span>
|
||||
<span>{{props.data.year}}</span>
|
||||
<span>{{props.data.note}}</span>
|
||||
<span>{{props.data.type}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</Waterfall>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="detail-mask zy-loading" v-show="loading">
|
||||
<div class="loader"></div>
|
||||
@@ -73,6 +114,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import { mapMutations } from 'vuex'
|
||||
import Waterfall from 'vue-waterfall-plugin'
|
||||
import zy from '../lib/site/tools'
|
||||
import onlineVideo from '../lib/site/onlineVideo'
|
||||
import { star, history } from '../lib/dexie'
|
||||
@@ -85,6 +127,8 @@ export default {
|
||||
videoFlag: '',
|
||||
videoList: [],
|
||||
videoFullList: [],
|
||||
key: '',
|
||||
site: {},
|
||||
info: {},
|
||||
playOnline: false,
|
||||
selectedEpisode: 0, // 选定集数
|
||||
@@ -144,8 +188,22 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
Waterfall
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['SET_VIEW', 'SET_VIDEO', 'SET_DETAIL', 'SET_SHARE', 'SET_DetailCache']),
|
||||
async playRecommendationEvent (e) {
|
||||
const db = await history.find({ site: this.detail.key, ids: e.id })
|
||||
if (db) {
|
||||
this.video = { key: db.site, info: { id: db.ids, name: db.name, index: db.index, site: this.detail.site } }
|
||||
} else {
|
||||
this.video = { key: this.detail.key, info: { id: e.id, name: e.name, index: 0, site: this.detail.site } }
|
||||
}
|
||||
this.video.detail = e
|
||||
this.view = 'Play'
|
||||
this.detail.show = false
|
||||
},
|
||||
addClass (flag) {
|
||||
if (flag === this.videoFlag) {
|
||||
return 'selectedBox'
|
||||
@@ -200,15 +258,15 @@ export default {
|
||||
onlineVideo.playVideoOnline(this.selectedOnlineSite, this.detail.info.name, n)
|
||||
}
|
||||
},
|
||||
async starEvent () {
|
||||
const db = await star.find({ key: this.detail.key, ids: this.info.id })
|
||||
async starEvent (info) {
|
||||
const db = await star.find({ key: this.detail.key, ids: info.id })
|
||||
const doc = {
|
||||
key: this.detail.key,
|
||||
ids: this.info.id,
|
||||
ids: info.id,
|
||||
site: this.detail.site,
|
||||
name: this.info.name,
|
||||
detail: this.info,
|
||||
rate: this.info.rate
|
||||
name: info.name,
|
||||
detail: info,
|
||||
rate: info.rate
|
||||
}
|
||||
if (db) {
|
||||
star.update(db.id, doc)
|
||||
@@ -219,6 +277,10 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
detailEvent (info) {
|
||||
this.detail.info = info
|
||||
this.getDetailInfo()
|
||||
},
|
||||
togglePlayOnlineEvent () {
|
||||
this.playOnline = !this.playOnline
|
||||
},
|
||||
@@ -257,12 +319,12 @@ export default {
|
||||
this.$message.error(err.info)
|
||||
})
|
||||
},
|
||||
shareEvent () {
|
||||
shareEvent (info, selectedEpisode) {
|
||||
this.share = {
|
||||
show: true,
|
||||
key: this.detail.key,
|
||||
info: this.info,
|
||||
index: this.selectedEpisode
|
||||
info: info,
|
||||
index: selectedEpisode
|
||||
}
|
||||
},
|
||||
doubanLinkEvent () {
|
||||
@@ -277,6 +339,17 @@ export default {
|
||||
const name = this.info.name.trim()
|
||||
const year = this.info.year
|
||||
this.info.rate = await zy.doubanRate(name, year)
|
||||
const recommendations = await zy.doubanRecommendations(name, year)
|
||||
if (recommendations) {
|
||||
this.info.recommendations = []
|
||||
recommendations.forEach(element => {
|
||||
zy.searchFirstDetail(this.detail.key, element).then(detailRes => {
|
||||
if (detailRes) {
|
||||
this.info.recommendations.push(detailRes)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
},
|
||||
async getDetailInfo () {
|
||||
const id = this.detail.info.ids || this.detail.info.id
|
||||
@@ -293,13 +366,14 @@ export default {
|
||||
if (res) {
|
||||
this.info = res
|
||||
this.$set(this.info, 'rate', this.DetailCache[cacheKey].rate || '')
|
||||
this.$set(this.info, 'recommendations', this.DetailCache[cacheKey].recommendations || [])
|
||||
this.videoFlag = this.videoFlag || res.fullList[0].flag
|
||||
this.videoList = res.fullList[0].list
|
||||
this.videoFullList = res.fullList
|
||||
this.loading = false
|
||||
if (!this.info.rate) {
|
||||
await this.getDoubanRate()
|
||||
this.DetailCache[cacheKey].rate = this.info.rate
|
||||
this.DetailCache[cacheKey] = this.info
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<div class="listpage" id="sites">
|
||||
<div class="listpage-header" v-show="!enableBatchEdit">
|
||||
<el-switch v-model="enableBatchEdit" active-text="批处理分组">></el-switch>
|
||||
<el-checkbox v-model="setting.excludeR18Films" @change="excludeR18FilmsChangeEvent">屏蔽福利片</el-checkbox>
|
||||
<el-button @click="openFilterKeywordsDiag" icon="el-icon-key">关键词过滤</el-button>
|
||||
<el-button @click="addSite" icon="el-icon-document-add">新增</el-button>
|
||||
<el-button @click="exportSites" icon="el-icon-upload2" title="导出全部,自动添加扩展名">导出</el-button>
|
||||
<el-button @click="importSites" icon="el-icon-download" title="支持同时导入多个文件">导入</el-button>
|
||||
@@ -83,7 +83,7 @@
|
||||
</div>
|
||||
<!-- 编辑页面 -->
|
||||
<div>
|
||||
<el-dialog :visible.sync="dialogVisible" v-if='dialogVisible' :title="dialogType==='edit'?'编辑源':'新增源'" :append-to-body="true" @close="closeDialog">
|
||||
<el-dialog :visible.sync="editSiteDialogVisible" v-if='editSiteDialogVisible' :title="dialogType==='edit'?'编辑源':'新增源'" :append-to-body="true" @close="closeDialog">
|
||||
<el-form :model="siteInfo" ref='siteInfo' label-width="75px" label-position="left" :rules="rules">
|
||||
<el-form-item label="源站名" prop='name'>
|
||||
<el-input v-model="siteInfo.name" placeholder="请输入源站名" />
|
||||
@@ -112,6 +112,27 @@
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
<!-- 设置过滤关键词页面 -->
|
||||
<div>
|
||||
<el-dialog :visible.sync="filterKeywordsDialogVisible" v-if='filterKeywordsDialogVisible' :title="'分类过滤'" :append-to-body="true" @close="closeDialog">
|
||||
<el-form>
|
||||
<el-switch v-model="excludeRootClasses" active-text="开启主分类过滤">></el-switch>
|
||||
<el-form-item>
|
||||
<el-input v-model="rootClassFilterKeywords" :autosize="{ minRows: 3, maxRows: 6}" type="textarea" placeholder="请输入过滤关键词" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<el-form>
|
||||
<el-switch v-model="excludeR18Films" active-text="开启福利分类过滤">></el-switch>
|
||||
<el-form-item>
|
||||
<el-input v-model="r18ClassFilterKeywords" :autosize="{ minRows: 3, maxRows: 6}" type="textarea" placeholder="请输入过滤关键词" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="closeDialog">取消</el-button>
|
||||
<el-button type="primary" @click="saveFilterKeywords">保存</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
@@ -129,7 +150,8 @@ export default {
|
||||
show: false,
|
||||
sites: [],
|
||||
dialogType: 'new',
|
||||
dialogVisible: false,
|
||||
editSiteDialogVisible: false,
|
||||
filterKeywordsDialogVisible: false,
|
||||
siteInfo: {
|
||||
key: '',
|
||||
name: '',
|
||||
@@ -139,6 +161,10 @@ export default {
|
||||
group: '',
|
||||
isActive: true
|
||||
},
|
||||
excludeRootClasses: true,
|
||||
excludeR18Films: true,
|
||||
rootClassFilterKeywords: [],
|
||||
r18ClassFilterKeywords: [],
|
||||
siteGroup: [],
|
||||
rules: {
|
||||
name: [
|
||||
@@ -204,12 +230,6 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['SET_SETTING']),
|
||||
excludeR18FilmsChangeEvent () {
|
||||
setting.find().then(res => {
|
||||
res.excludeR18Films = this.setting.excludeR18Films
|
||||
setting.update(res)
|
||||
})
|
||||
},
|
||||
selectionCellClick (selection, row) {
|
||||
if (this.shiftDown && this.selectionBegin !== '' && selection.includes(row)) {
|
||||
this.selectionEnd = row.id
|
||||
@@ -261,6 +281,29 @@ export default {
|
||||
}
|
||||
this.siteGroup = arr
|
||||
},
|
||||
openFilterKeywordsDiag () {
|
||||
this.excludeRootClasses = this.setting.excludeRootClasses
|
||||
this.excludeR18Films = this.setting.excludeR18Films
|
||||
this.rootClassFilterKeywords = this.setting.rootClassFilter?.join()
|
||||
this.r18ClassFilterKeywords = this.setting.r18ClassFilter?.join()
|
||||
this.filterKeywordsDialogVisible = true
|
||||
},
|
||||
saveFilterKeywords () {
|
||||
// 移除空格,然后按逗号分开
|
||||
this.setting.rootClassFilter = this.rootClassFilterKeywords?.replace(/\s/g, '').split(',')
|
||||
this.setting.r18ClassFilter = this.r18ClassFilterKeywords?.replace(/\s/g, '').split(',')
|
||||
this.setting.classFilter = []
|
||||
this.setting.excludeRootClasses = this.excludeRootClasses
|
||||
if (this.excludeRootClasses) {
|
||||
this.setting.classFilter = this.setting.classFilter.concat(this.setting.rootClassFilter)
|
||||
}
|
||||
this.setting.excludeR18Films = this.excludeR18Films
|
||||
if (this.excludeR18Films) {
|
||||
this.setting.classFilter = this.setting.classFilter.concat(this.setting.r18ClassFilter)
|
||||
}
|
||||
setting.update(this.setting)
|
||||
this.filterKeywordsDialogVisible = false
|
||||
},
|
||||
addSite () {
|
||||
if (this.checkAllSitesLoading) {
|
||||
this.$message.info('正在检测, 请勿操作.')
|
||||
@@ -268,7 +311,7 @@ export default {
|
||||
}
|
||||
this.getSitesGroup()
|
||||
this.dialogType = 'new'
|
||||
this.dialogVisible = true
|
||||
this.editSiteDialogVisible = true
|
||||
this.siteInfo = {
|
||||
key: '',
|
||||
name: '',
|
||||
@@ -286,12 +329,13 @@ export default {
|
||||
}
|
||||
this.getSitesGroup()
|
||||
this.dialogType = 'edit'
|
||||
this.dialogVisible = true
|
||||
this.editSiteDialogVisible = true
|
||||
this.siteInfo = siteInfo
|
||||
this.editOldkey = siteInfo.key
|
||||
},
|
||||
closeDialog () {
|
||||
this.dialogVisible = false
|
||||
this.editSiteDialogVisible = false
|
||||
this.filterKeywordsDialogVisible = false
|
||||
this.getSites()
|
||||
},
|
||||
removeEvent (e) {
|
||||
@@ -348,7 +392,7 @@ export default {
|
||||
group: ''
|
||||
}
|
||||
this.dialogType === 'edit' ? this.$message.success('修改成功!') : this.$message.success('新增源成功!')
|
||||
this.dialogVisible = false
|
||||
this.editSiteDialogVisible = false
|
||||
this.getSites()
|
||||
})
|
||||
this.editOldkey = ''
|
||||
@@ -379,31 +423,57 @@ export default {
|
||||
}
|
||||
const options = {
|
||||
filters: [
|
||||
{ name: 'JSON file', extensions: ['json'] }
|
||||
{ name: '支持的文件格式', extensions: ['json', 'txt'] }
|
||||
],
|
||||
properties: ['openFile', 'multiSelections']
|
||||
}
|
||||
remote.dialog.showOpenDialog(options).then(result => {
|
||||
if (!result.canceled) {
|
||||
result.filePaths.forEach(file => {
|
||||
const str = fs.readFileSync(file)
|
||||
const json = JSON.parse(str)
|
||||
json.forEach(ele => {
|
||||
if (ele.api && this.sites.filter(x => x.key === ele.key).length === 0 && this.sites.filter(x => x.name === ele.name && x.api === ele.api).length === 0) {
|
||||
// 不含该key 同时也不含名字和url一样的
|
||||
if (ele.isActive === undefined) {
|
||||
ele.isActive = true
|
||||
if (file.endsWith('json')) {
|
||||
const str = fs.readFileSync(file)
|
||||
const json = JSON.parse(str)
|
||||
json.forEach(ele => {
|
||||
if (ele.api && this.sites.filter(x => x.key === ele.key).length === 0 && this.sites.filter(x => x.name === ele.name && x.api === ele.api).length === 0) {
|
||||
// 不含该key 同时也不含名字和url一样的
|
||||
if (ele.isActive === undefined) {
|
||||
ele.isActive = true
|
||||
}
|
||||
if (ele.group === undefined) {
|
||||
ele.group = '导入'
|
||||
}
|
||||
this.sites.push(ele)
|
||||
}
|
||||
if (ele.group === undefined) {
|
||||
ele.group = '导入'
|
||||
}
|
||||
this.sites.push(ele)
|
||||
})
|
||||
this.resetId(this.sites)
|
||||
sites.clear().then(sites.bulkAdd(this.sites))
|
||||
this.$message.success('导入成功')
|
||||
this.getSites()
|
||||
}
|
||||
if (file.endsWith('txt')) {
|
||||
try {
|
||||
const txt = fs.readFileSync(file, 'utf8')
|
||||
const json = JSON.parse(txt)
|
||||
json.forEach(ele => {
|
||||
if (ele.api && this.sites.filter(x => x.key === ele.key).length === 0 && this.sites.filter(x => x.name === ele.name && x.api === ele.api).length === 0) {
|
||||
// 不含该key 同时也不含名字和url一样的
|
||||
if (ele.isActive === undefined) {
|
||||
ele.isActive = true
|
||||
}
|
||||
if (ele.group === undefined) {
|
||||
ele.group = '导入'
|
||||
}
|
||||
this.sites.push(ele)
|
||||
}
|
||||
})
|
||||
this.resetId(this.sites)
|
||||
sites.clear().then(sites.bulkAdd(this.sites))
|
||||
this.$message.success('导入成功')
|
||||
this.getSites()
|
||||
} catch (error) {
|
||||
this.$message.warning('导入失败')
|
||||
}
|
||||
})
|
||||
this.resetId(this.sites)
|
||||
sites.clear().then(sites.bulkAdd(this.sites))
|
||||
this.$message.success('导入成功')
|
||||
this.getSites()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
@@ -414,14 +484,11 @@ export default {
|
||||
// 如果没有设置源站文件链接,使用默认的gitee源
|
||||
url = 'https://gitee.com/cuiocean/ZY-Player-Resources/raw/main/Sites/Sites.json'
|
||||
}
|
||||
const axios = require('axios')
|
||||
axios.get(url).then(res => {
|
||||
if (res.status === 200) {
|
||||
if (res.data.length > 0) {
|
||||
sites.clear().then(sites.bulkAdd(res.data))
|
||||
this.$message.success('重置源成功')
|
||||
this.getSites()
|
||||
}
|
||||
zy.getDefaultSites(url).then(res => {
|
||||
if (res.length > 0) {
|
||||
sites.clear().then(sites.bulkAdd(res))
|
||||
this.$message.success('重置源成功')
|
||||
this.getSites()
|
||||
}
|
||||
}).catch(error => {
|
||||
this.$message.error('导入云端源站失败. ' + error)
|
||||
|
||||
@@ -281,7 +281,7 @@
|
||||
animationEffect="fadeIn"
|
||||
backgroundColor="rgba(0, 0, 0, 0)">
|
||||
<template slot="item" slot-scope="props">
|
||||
<div class="card" v-show="!setting.excludeR18Films || !containsR18Keywords(props.data.type)">
|
||||
<div class="card" v-show="!setting.excludeR18Films || !containsClassFilterKeyword(props.data.type)">
|
||||
<div class="img">
|
||||
<div class="site">
|
||||
<span>{{props.data.site.name}}</span>
|
||||
@@ -322,7 +322,6 @@ export default {
|
||||
data () {
|
||||
return {
|
||||
showFind: false,
|
||||
showToolbar: false,
|
||||
showTableLastColumn: false,
|
||||
sites: [],
|
||||
site: {},
|
||||
@@ -345,18 +344,19 @@ export default {
|
||||
filteredSearchContents: [],
|
||||
currentColumn: '',
|
||||
searchGroup: '',
|
||||
searchGroups: [],
|
||||
// 福利片关键词
|
||||
r18KeyWords: ['伦理', '论理', '倫理', '福利', '激情', '理论', '写真', '情色', '美女', '街拍', '赤足', '性感', '里番'],
|
||||
searchGroups: ['站内', '组内', '全站'],
|
||||
classFilterKeywords: [],
|
||||
filteredList: [],
|
||||
areas: [],
|
||||
searchRunning: false,
|
||||
siteSearchCount: 0,
|
||||
infiniteHandlerCount: 0,
|
||||
// Toolbar
|
||||
showToolbar: false,
|
||||
selectedAreas: [],
|
||||
sortKeyword: '',
|
||||
sortKeywords: ['按片名', '按上映年份', '按更新时间'],
|
||||
selectedYears: { start: 0, end: new Date().getFullYear() },
|
||||
searchRunning: false,
|
||||
siteSearchCount: 0,
|
||||
infiniteHandlerCount: 0
|
||||
selectedYears: { start: 0, end: new Date().getFullYear() }
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@@ -413,12 +413,13 @@ export default {
|
||||
}
|
||||
},
|
||||
filterSettings () {
|
||||
return this.$store.getters.getSetting.excludeR18Films // 需要监听的数据
|
||||
return this.$store.getters.getSetting.classFilter // 需要监听的数据
|
||||
},
|
||||
searchSites () {
|
||||
if (this.searchGroup === '站内') return [this.site]
|
||||
if (this.searchGroup === '组内') return this.sites.filter(site => site.group === this.site.group)
|
||||
if (this.searchGroup === '全站') return this.sites
|
||||
return this.sites.filter(site => site.group === this.searchGroup)
|
||||
return this.sites.filter(site => site.isActive)
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
@@ -443,7 +444,7 @@ export default {
|
||||
}
|
||||
},
|
||||
filterSettings () {
|
||||
this.siteClick(this.site.name)
|
||||
this.refreshClass()
|
||||
},
|
||||
list: {
|
||||
handler (list) {
|
||||
@@ -455,9 +456,12 @@ export default {
|
||||
siteSearchCount () {
|
||||
if (this.siteSearchCount === this.searchSites.length) this.searchRunning = false
|
||||
},
|
||||
site () {
|
||||
this.siteClick(this.site.name)
|
||||
},
|
||||
searchContents: {
|
||||
handler (list) {
|
||||
list = list.filter(res => !this.setting.excludeR18Films || !this.containsR18Keywords(res.type))
|
||||
list = list.filter(res => !this.setting.excludeR18Films || !this.containsClassFilterKeyword(res.type))
|
||||
this.areas = [...new Set(list.map(ele => ele.area))].filter(x => x)
|
||||
this.searchClassList = [...new Set(list.map(ele => ele.type))].filter(x => x)
|
||||
this.refreshFilteredList()
|
||||
@@ -499,7 +503,7 @@ export default {
|
||||
let filteredData = this.showFind ? this.searchContents : this.list
|
||||
if (this.showFind) filteredData = filteredData.filter(x => (this.selectedSearchClassNames.length === 0) || this.selectedSearchClassNames.includes(x.type))
|
||||
filteredData = filteredData.filter(x => (this.selectedAreas.length === 0) || this.selectedAreas.includes(x.area))
|
||||
filteredData = filteredData.filter(res => !this.setting.excludeR18Films || !this.containsR18Keywords(res.type))
|
||||
filteredData = filteredData.filter(res => !this.setting.excludeR18Films || !this.containsClassFilterKeyword(res.type))
|
||||
filteredData = filteredData.filter(res => res.year >= this.selectedYears.start)
|
||||
filteredData = filteredData.filter(res => res.year <= this.selectedYears.end)
|
||||
if (!this.showFind) this.selectedClassName = this.type.name + ' ' + filteredData.length + '/' + this.recordcount
|
||||
@@ -591,6 +595,16 @@ export default {
|
||||
})
|
||||
}
|
||||
},
|
||||
refreshClass () {
|
||||
this.getClass().then(res => {
|
||||
this.classList = res
|
||||
// cache classList data
|
||||
FILM_DATA_CACHE[this.site.key] = {
|
||||
classList: this.classList
|
||||
}
|
||||
this.classClick(this.site.name)
|
||||
})
|
||||
},
|
||||
classClick (className) {
|
||||
this.list = []
|
||||
this.type = this.classList.find(x => x.name === className)
|
||||
@@ -618,20 +632,11 @@ export default {
|
||||
getClass () {
|
||||
return new Promise((resolve, reject) => {
|
||||
const key = this.site.key
|
||||
// 屏蔽主分类
|
||||
const classToHide = ['电影', '电影片', '电视剧', '连续剧', '综艺', '动漫']
|
||||
zy.class(key).then(res => {
|
||||
const allClass = [{ name: '最新', tid: 0 }]
|
||||
res.class.forEach(element => {
|
||||
if (!this.setting.excludeRootClasses || !classToHide.includes(element.name)) {
|
||||
if (this.setting.excludeR18Films) {
|
||||
const containKeyWord = this.containsR18Keywords(element.name)
|
||||
if (!containKeyWord) {
|
||||
allClass.push(element)
|
||||
}
|
||||
} else {
|
||||
allClass.push(element)
|
||||
}
|
||||
if (!this.containsClassFilterKeyword(element.name)) {
|
||||
allClass.push(element)
|
||||
}
|
||||
})
|
||||
resolve(allClass)
|
||||
@@ -640,12 +645,17 @@ export default {
|
||||
})
|
||||
})
|
||||
},
|
||||
containsR18Keywords (name) {
|
||||
const containKeyWord = false
|
||||
if (!name) {
|
||||
return containKeyWord
|
||||
containsClassFilterKeyword (name) {
|
||||
let ret = false
|
||||
// 主分类过滤, 检测关键词是否包含分类名
|
||||
if (this.setting.excludeRootClasses) {
|
||||
ret = this.setting.rootClassFilter?.some(v => v.includes(name))
|
||||
}
|
||||
return this.r18KeyWords.some(v => name.includes(v))
|
||||
// 福利过滤,检测分类名是否包含关键词
|
||||
if (this.setting.excludeR18Films && !ret) {
|
||||
ret = this.setting.r18ClassFilter?.some(v => name?.includes(v))
|
||||
}
|
||||
return ret
|
||||
},
|
||||
toFlipPagecount () {
|
||||
// 似乎需要解析的网站的视频排序和其他m3u8采集站的顺序正好相反
|
||||
@@ -873,10 +883,6 @@ export default {
|
||||
this.selectedSiteName = this.sites[0].name
|
||||
}
|
||||
}
|
||||
this.searchGroups = [...new Set(this.sites.map(site => site.group))]
|
||||
if (this.searchGroups.length === 1) this.searchGroups = []
|
||||
this.searchGroups.unshift('站内')
|
||||
this.searchGroups.push('全站')
|
||||
this.searchGroup = this.setting.searchGroup
|
||||
if (this.searchGroup === undefined) setting.find().then(res => { this.searchGroup = res.searchGroup })
|
||||
})
|
||||
|
||||
@@ -1,15 +1,55 @@
|
||||
<template>
|
||||
<div class="listpage" id="history">
|
||||
<div class="listpage-header" id="history-header">
|
||||
<el-switch v-model="setting.historyViewMode" active-text="海报" active-value="picture" inactive-text="列表" inactive-value="table" @change="updateViewMode"></el-switch>
|
||||
<el-button @click.stop="exportHistory" icon="el-icon-upload2" title="导出全部,自动添加扩展名">导出</el-button>
|
||||
<el-button @click.stop="importHistory" icon="el-icon-download" title="支持同时导入多个文件">导入</el-button>
|
||||
<el-button @click.stop="removeSelectedItems" icon="el-icon-delete-solid">{{ multipleSelection.length === 0 ? "清空" : "删除所选" }}</el-button>
|
||||
<b-button-group>
|
||||
<el-switch v-model="onlyShowItemsHasUpdate" active-text="有更新" inactive-text="全部" @change="refreshFilteredList"></el-switch>
|
||||
<el-button @click.stop="updateAllEvent" icon="el-icon-refresh">检查更新</el-button>
|
||||
</b-button-group>
|
||||
</div>
|
||||
<div class="toolbar" v-show="showToolbar">
|
||||
<el-select v-model="selectedAreas" size="small" multiple placeholder="地区" popper-class="popper" :popper-append-to-body="false" @remove-tag="refreshFilteredList" @change="refreshFilteredList">
|
||||
<el-option
|
||||
v-for="item in areas"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-select v-model="selectedTypes" size="small" multiple placeholder="类型" popper-class="popper" :popper-append-to-body="false" @remove-tag="refreshFilteredList" @change="refreshFilteredList">
|
||||
<el-option
|
||||
v-for="item in types"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-select v-model="sortKeyword" size="small" placeholder="排序" popper-class="popper" :popper-append-to-body="false" @change="refreshFilteredList">
|
||||
<el-option
|
||||
v-for="item in sortKeywords"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<span>
|
||||
上映区间:
|
||||
<el-input-number size="small" v-model="selectedYears.start" :min=0 :max="new Date().getFullYear()" controls-position="right" step-strictly @change="refreshFilteredList"></el-input-number>
|
||||
至
|
||||
<el-input-number size="small" v-model="selectedYears.end" :min=0 :max="new Date().getFullYear()" controls-position="right" step-strictly @change="refreshFilteredList"></el-input-number>
|
||||
</span>
|
||||
</div>
|
||||
<el-divider class="listpage-header-divider" content-position="right">
|
||||
<el-button type="text" size="mini" @click="toggleViewMode">视图切换</el-button>
|
||||
<el-button type="text" size="mini" @click='() => { showToolbar = !showToolbar; if (!showToolbar) this.refreshFilteredList() }' title="收起工具栏会重置筛选排序">{{ showToolbar ? '隐藏工具栏' : '显示工具栏' }}</el-button>
|
||||
<el-button type="text" size="mini" @click="backTop">回到顶部</el-button>
|
||||
</el-divider>
|
||||
<div class="listpage-body" id="history-body">
|
||||
<div class="show-table" id="history-table" v-if="setting.historyViewMode === 'table'">
|
||||
<el-table size="mini" fit height="100%"
|
||||
:data="history"
|
||||
:data="filteredList"
|
||||
row-key="id"
|
||||
ref="historyTable"
|
||||
@select="selectionCellClick"
|
||||
@@ -40,11 +80,11 @@
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column v-if="history.some(e => e.time)"
|
||||
width="150"
|
||||
<el-table-column v-if="list.some(e => e.time)"
|
||||
width="200"
|
||||
label="时间进度">
|
||||
<template slot-scope="scope">
|
||||
<span v-if="scope.row.time && scope.row.duration">{{fmtMSS(scope.row.time.toFixed(0))}}/{{fmtMSS(scope.row.duration.toFixed(0))}}</span>
|
||||
<span v-if="scope.row.time && scope.row.duration">{{fmtMSS(scope.row.time.toFixed(0))}}/{{fmtMSS(scope.row.duration.toFixed(0))}} ({{progress(scope.row)}}%)</span>
|
||||
<span v-if="scope.row.onlinePlay">在线解析</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -63,7 +103,7 @@
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="show-picture" id="star-picture" v-if="setting.historyViewMode === 'picture'">
|
||||
<Waterfall ref="historyWaterfall" :list="history" :gutter="20" :width="240"
|
||||
<Waterfall ref="historyWaterfall" :list="filteredList" :gutter="20" :width="240"
|
||||
:breakpoints="{
|
||||
1200: { //当屏幕宽度小于等于1200
|
||||
rowPerView: 4,
|
||||
@@ -80,6 +120,9 @@
|
||||
<template slot="item" slot-scope="props">
|
||||
<div class="card">
|
||||
<div class="img">
|
||||
<div class="update" v-if="props.data.hasUpdate">
|
||||
<span>有更新</span>
|
||||
</div>
|
||||
<img v-if="props.data.detail && props.data.detail.pic" style="width: 100%" :src="props.data.detail.pic" alt="" @load="$refs.historyWaterfall.refresh()" @click="detailEvent(props.data)">
|
||||
<div class="operate">
|
||||
<div class="operate-wrap">
|
||||
@@ -93,7 +136,7 @@
|
||||
<div class="name" @click="detailEvent(props.data)">{{props.data.name}}</div>
|
||||
<div class="info">
|
||||
<span v-if="props.data.time && props.data.duration">
|
||||
{{fmtMSS(props.data.time.toFixed(0))}}/{{fmtMSS(props.data.duration.toFixed(0))}}
|
||||
{{fmtMSS(props.data.time.toFixed(0))}}/{{fmtMSS(props.data.duration.toFixed(0))}} ({{progress(props.data)}}%)
|
||||
</span>
|
||||
<span v-if="props.data.onlinePlay">在线解析</span>
|
||||
<span v-if="props.data.detail && props.data.detail.fullList[0].list !== undefined && props.data.detail.fullList[0].list.length > 1">
|
||||
@@ -120,12 +163,25 @@ export default {
|
||||
name: 'history',
|
||||
data () {
|
||||
return {
|
||||
history: [],
|
||||
list: [],
|
||||
sites: [],
|
||||
shiftDown: false,
|
||||
selectionBegin: '',
|
||||
selectionEnd: '',
|
||||
multipleSelection: []
|
||||
multipleSelection: [],
|
||||
areas: [],
|
||||
types: [],
|
||||
filteredList: [],
|
||||
// Update
|
||||
numNoUpdate: 0,
|
||||
// Toolbar
|
||||
showToolbar: false,
|
||||
selectedAreas: [],
|
||||
selectedTypes: [],
|
||||
sortKeyword: '',
|
||||
sortKeywords: ['按片名', '按上映年份', '按更新时间', '按完成度'],
|
||||
selectedYears: { start: 0, end: new Date().getFullYear() },
|
||||
onlyShowItemsHasUpdate: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@@ -171,6 +227,14 @@ export default {
|
||||
set (val) {
|
||||
this.SET_SETTING(val)
|
||||
}
|
||||
},
|
||||
DetailCache: {
|
||||
get () {
|
||||
return this.$store.getters.getDetailCache
|
||||
},
|
||||
set (val) {
|
||||
this.SET_DetailCache(val)
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -180,19 +244,134 @@ export default {
|
||||
this.getAllsites()
|
||||
if (this.setting.historyViewMode === 'table') this.showShiftPrompt()
|
||||
}
|
||||
},
|
||||
list: {
|
||||
handler (list) {
|
||||
this.areas = [...new Set(list.map(ele => ele.detail.area))].filter(x => x)
|
||||
this.types = [...new Set(list.map(ele => ele.detail.type))].filter(x => x)
|
||||
this.refreshFilteredList()
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
numNoUpdate () {
|
||||
// 如果所有历史都没有更新的话
|
||||
if (this.numNoUpdate === this.list.length) {
|
||||
this.numNoUpdate = 0
|
||||
this.$message.warning('未查询到任何更新')
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['SET_VIEW', 'SET_DETAIL', 'SET_VIDEO', 'SET_SHARE', 'SET_SETTING']),
|
||||
updateAllEvent () {
|
||||
this.numNoUpdate = 0
|
||||
this.list.forEach(e => {
|
||||
this.updateEvent(e)
|
||||
})
|
||||
},
|
||||
async updateEvent (e) {
|
||||
try {
|
||||
if (!this.DetailCache[e.site + '@' + e.ids]) {
|
||||
this.DetailCache[e.site + '@' + e.ids] = await zy.detail(e.site, e.ids)
|
||||
}
|
||||
const newDetail = this.DetailCache[e.site + '@' + e.ids]
|
||||
history.get(e.id).then(res => {
|
||||
if (!e.hasUpdate && e.detail.last !== newDetail.last) {
|
||||
res.hasUpdate = true
|
||||
res.detail = newDetail
|
||||
const msg = `检查到"${e.name}"有更新。`
|
||||
this.$message.success(msg)
|
||||
} else {
|
||||
this.numNoUpdate += 1
|
||||
}
|
||||
history.update(e.id, res)
|
||||
this.getAllhistory()
|
||||
})
|
||||
} catch (err) {
|
||||
const msg = `更新"${e.name}"失败, 请重试。`
|
||||
this.$message.warning(msg, err)
|
||||
}
|
||||
},
|
||||
toggleViewMode () {
|
||||
this.setting.historyViewMode = this.setting.historyViewMode === 'picture' ? 'table' : 'picture'
|
||||
if (this.setting.historyViewMode === 'table') {
|
||||
this.showShiftPrompt()
|
||||
} else {
|
||||
setTimeout(() => { if (this.$refs.historyWaterfall) this.$refs.historyWaterfall.refresh() }, 700)
|
||||
}
|
||||
setting.find().then(res => {
|
||||
res.historyViewMode = this.setting.historyViewMode
|
||||
setting.update(res)
|
||||
})
|
||||
},
|
||||
backTop () {
|
||||
if (this.setting.starViewMode === 'picture') {
|
||||
document.getElementById('history-body').scrollTop = 0
|
||||
} else {
|
||||
this.$refs.historyTable.bodyWrapper.scrollTop = 0
|
||||
}
|
||||
},
|
||||
refreshFilteredList () {
|
||||
if (!this.showToolbar) {
|
||||
this.sortKeyword = ''
|
||||
this.selectedAreas = []
|
||||
this.selectedSearchClassNames = []
|
||||
this.selectedYears.start = 0
|
||||
this.selectedYears.end = new Date().getFullYear()
|
||||
this.filteredList = this.list
|
||||
} else {
|
||||
let filteredData = this.list
|
||||
filteredData = filteredData.filter(x => (this.selectedAreas.length === 0) || this.selectedAreas.includes(x.detail.area))
|
||||
filteredData = filteredData.filter(x => (this.selectedTypes.length === 0) || this.selectedTypes.includes(x.detail.type))
|
||||
filteredData = filteredData.filter(res => res.detail.year >= this.selectedYears.start)
|
||||
filteredData = filteredData.filter(res => res.detail.year <= this.selectedYears.end)
|
||||
switch (this.sortKeyword) {
|
||||
case '按上映年份':
|
||||
filteredData.sort(function (a, b) {
|
||||
return a.detail.year - b.detail.year
|
||||
})
|
||||
break
|
||||
case '按片名':
|
||||
filteredData.sort(function (a, b) {
|
||||
return a.detail.name.localeCompare(b.detail.name, 'zh')
|
||||
})
|
||||
break
|
||||
case '按更新时间':
|
||||
filteredData.sort(function (a, b) {
|
||||
return new Date(b.detail.last) - new Date(a.detail.last)
|
||||
})
|
||||
break
|
||||
case '按完成度':
|
||||
filteredData.sort(this.sortByProgress)
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
this.filteredList = filteredData
|
||||
}
|
||||
if (this.onlyShowItemsHasUpdate) {
|
||||
this.filteredList = this.filteredList.filter(x => x.hasUpdate)
|
||||
}
|
||||
},
|
||||
progress (e) {
|
||||
return e.duration > 0 ? ((e.time / e.duration) * 100).toFixed(0) : 0
|
||||
},
|
||||
sortByProgress (a, b) {
|
||||
if (this.progress(a) < this.progress(b)) {
|
||||
return -1
|
||||
} else {
|
||||
return 1
|
||||
}
|
||||
},
|
||||
fmtMSS (s) {
|
||||
return (s - (s %= 60)) / 60 + (s > 9 ? ':' : ':0') + s
|
||||
},
|
||||
selectionCellClick (selection, row) { // 历史id与顺序刚好相反,大的反而在前面
|
||||
if (this.shiftDown && this.selectionBegin !== '' && selection.includes(row)) {
|
||||
this.selectionEnd = row.id
|
||||
const start = this.history.findIndex(e => e.id === Math.max(this.selectionBegin, this.selectionEnd))
|
||||
const end = this.history.findIndex(e => e.id === Math.min(this.selectionBegin, this.selectionEnd))
|
||||
const selections = this.history.slice(start, end + 1)
|
||||
const start = this.list.findIndex(e => e.id === Math.max(this.selectionBegin, this.selectionEnd))
|
||||
const end = this.list.findIndex(e => e.id === Math.min(this.selectionBegin, this.selectionEnd))
|
||||
const selections = this.list.slice(start, end + 1)
|
||||
this.$nextTick(() => {
|
||||
selections.forEach(e => this.$refs.historyTable.toggleRowSelection(e, true))
|
||||
})
|
||||
@@ -209,7 +388,7 @@ export default {
|
||||
this.multipleSelection = rows
|
||||
},
|
||||
removeSelectedItems () {
|
||||
if (!this.multipleSelection.length) this.multipleSelection = this.history
|
||||
if (!this.multipleSelection.length) this.multipleSelection = this.list
|
||||
this.multipleSelection.forEach(e => history.remove(e.id))
|
||||
this.multipleSelection = []
|
||||
this.getAllhistory()
|
||||
@@ -224,6 +403,9 @@ export default {
|
||||
name: e.name
|
||||
}
|
||||
}
|
||||
if (e.hasUpdate) {
|
||||
this.clearHasUpdateFlag(e)
|
||||
}
|
||||
},
|
||||
async playEvent (e) {
|
||||
const db = await history.find({ site: e.site, ids: e.ids })
|
||||
@@ -232,8 +414,19 @@ export default {
|
||||
} else {
|
||||
this.video = { key: e.site, info: { id: e.ids, name: e.name, index: 0 } }
|
||||
}
|
||||
if (e.hasUpdate) {
|
||||
this.clearHasUpdateFlag(e)
|
||||
}
|
||||
this.view = 'Play'
|
||||
},
|
||||
async clearHasUpdateFlag (e) {
|
||||
const db = await history.find({ id: e.id })
|
||||
if (db) {
|
||||
db.hasUpdate = false
|
||||
history.update(e.id, db)
|
||||
this.getAllhistory()
|
||||
}
|
||||
},
|
||||
shareEvent (e) {
|
||||
this.share = {
|
||||
show: true,
|
||||
@@ -251,7 +444,7 @@ export default {
|
||||
},
|
||||
exportHistory () {
|
||||
this.getAllhistory()
|
||||
const arr = [...this.history]
|
||||
const arr = [...this.list]
|
||||
const str = JSON.stringify(arr, null, 2)
|
||||
const options = {
|
||||
filters: [
|
||||
@@ -296,7 +489,7 @@ export default {
|
||||
},
|
||||
getAllhistory () {
|
||||
history.all().then(res => {
|
||||
this.history = res.reverse()
|
||||
this.list = res.reverse()
|
||||
})
|
||||
},
|
||||
getAllsites () {
|
||||
@@ -320,24 +513,13 @@ export default {
|
||||
updateDatabase () {
|
||||
history.clear().then(res => {
|
||||
let id = length
|
||||
this.history.forEach(ele => {
|
||||
this.list.forEach(ele => {
|
||||
ele.id = id
|
||||
id -= 1
|
||||
history.add(ele)
|
||||
})
|
||||
})
|
||||
},
|
||||
updateViewMode () {
|
||||
if (this.setting.historyViewMode === 'table') {
|
||||
this.showShiftPrompt()
|
||||
} else {
|
||||
setTimeout(() => { if (this.$refs.historyWaterfall) this.$refs.historyWaterfall.refresh() }, 700)
|
||||
}
|
||||
setting.find().then(res => {
|
||||
res.historyViewMode = this.setting.historyViewMode
|
||||
setting.update(res)
|
||||
})
|
||||
},
|
||||
showShiftPrompt () {
|
||||
if (this.setting.shiftTooltipLimitTimes === undefined) this.setting.shiftTooltipLimitTimes = 5
|
||||
if (this.setting.shiftTooltipLimitTimes) {
|
||||
|
||||
@@ -113,6 +113,7 @@ import zy from '../lib/site/tools'
|
||||
import { remote } from 'electron'
|
||||
import fs from 'fs'
|
||||
import Sortable from 'sortablejs'
|
||||
import axios from 'axios'
|
||||
export default {
|
||||
name: 'iptv',
|
||||
data () {
|
||||
@@ -349,10 +350,55 @@ export default {
|
||||
this.$message.info('正在检测, 请勿操作.')
|
||||
return false
|
||||
}
|
||||
this.$msgbox.prompt('请输入网址', '提示', {
|
||||
distinguishCancelAndClose: true,
|
||||
inputValue: 'http://y.qibaobaike.com/nzy.txt',
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '本地文件'
|
||||
}).then(({ value }) => {
|
||||
this.importOnlineChannels(value)
|
||||
}).catch(action => {
|
||||
if (action === 'cancel') {
|
||||
this.importLocalChannels()
|
||||
}
|
||||
})
|
||||
},
|
||||
async importOnlineChannels (url) {
|
||||
try {
|
||||
const docs = []
|
||||
let id = this.channelList.length ? this.channelList.slice(-1)[0].id + 1 : 1
|
||||
const res = await axios.get(url)
|
||||
const result = res.data.split('\n')
|
||||
const supportFormats = /\.(m3u8|flv)$/
|
||||
for (const i of result) {
|
||||
if (i.includes('http') && supportFormats.test(i)) {
|
||||
const j = i.split(',')
|
||||
const doc = {
|
||||
id: id,
|
||||
name: j[0],
|
||||
url: j[1],
|
||||
isActive: true
|
||||
}
|
||||
id += 1
|
||||
docs.push(doc)
|
||||
}
|
||||
}
|
||||
// 获取url不重复的列表
|
||||
const uniqueList = [...new Map(docs.map(item => [item.url, item])).values()]
|
||||
iptv.clear().then(res => {
|
||||
iptv.bulkAdd(uniqueList).then(e => { // 支持导入同名频道,群里反馈
|
||||
this.updateChannelList()
|
||||
})
|
||||
})
|
||||
this.$message.success('导入成功')
|
||||
} catch (error) {
|
||||
this.$message.warning('导入失败')
|
||||
}
|
||||
},
|
||||
importLocalChannels () {
|
||||
const options = {
|
||||
filters: [
|
||||
{ name: 'm3u file', extensions: ['m3u', 'm3u8'] },
|
||||
{ name: 'JSON file', extensions: ['json'] }
|
||||
{ name: '支持的文件格式', extensions: ['m3u', 'm3u8', 'json', 'txt'] }
|
||||
],
|
||||
properties: ['openFile', 'multiSelections']
|
||||
}
|
||||
@@ -389,8 +435,9 @@ export default {
|
||||
this.updateChannelList()
|
||||
})
|
||||
})
|
||||
} else {
|
||||
// Import Json file
|
||||
this.$message.success('导入成功')
|
||||
}
|
||||
if (file.endsWith('json')) {
|
||||
const importedList = JSON.parse(fs.readFileSync(file))
|
||||
importedList.forEach(ele => {
|
||||
const commonEle = this.channelList.find(e => e.name === ele.name)
|
||||
@@ -404,9 +451,41 @@ export default {
|
||||
}
|
||||
})
|
||||
this.updateDatabase()
|
||||
this.$message.success('导入成功')
|
||||
}
|
||||
if (file.endsWith('txt')) {
|
||||
try {
|
||||
const docs = []
|
||||
let id = this.channelList.length ? this.channelList.slice(-1)[0].id + 1 : 1
|
||||
const playlist = fs.readFileSync(file, 'utf8')
|
||||
const result = playlist.split('\n')
|
||||
const supportFormats = /\.(m3u8|flv)$/
|
||||
for (const i of result) {
|
||||
if (i.includes('http') && supportFormats.test(i)) {
|
||||
const j = i.split(',')
|
||||
const doc = {
|
||||
id: id,
|
||||
name: j[0],
|
||||
url: j[1],
|
||||
isActive: true
|
||||
}
|
||||
id += 1
|
||||
docs.push(doc)
|
||||
}
|
||||
}
|
||||
// 获取url不重复的列表
|
||||
const uniqueList = [...new Map(docs.map(item => [item.url, item])).values()]
|
||||
iptv.clear().then(res => {
|
||||
iptv.bulkAdd(uniqueList).then(e => { // 支持导入同名频道,群里反馈
|
||||
this.updateChannelList()
|
||||
})
|
||||
})
|
||||
this.$message.success('导入成功')
|
||||
} catch (error) {
|
||||
this.$message.warning('导入失败')
|
||||
}
|
||||
}
|
||||
})
|
||||
this.$message.success('导入成功')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
<polyline points="12 5 12 12 16 16"></polyline>
|
||||
</svg>
|
||||
</span>
|
||||
<span class="zy-svg" @click="starEvent" :class="isStar ? 'active' : ''" v-show="right.list.length > 0">
|
||||
<span class="zy-svg" @click="starEvent" :class="isStar ? 'active' : ''" v-show="right.list.length > 0 || isStar">
|
||||
<svg role="img" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" aria-labelledby="favouriteIconTitle">
|
||||
<title id="favouriteIconTitle">收藏</title>
|
||||
<path d="M12,21 L10.55,19.7051771 C5.4,15.1242507 2,12.1029973 2,8.39509537 C2,5.37384196 4.42,3 7.5,3 C9.24,3 10.91,3.79455041 12,5.05013624 C13.09,3.79455041 14.76,3 16.5,3 C19.58,3 22,5.37384196 22,8.39509537 C22,12.1029973 18.6,15.1242507 13.45,19.7149864 L12,21 Z"></path>
|
||||
@@ -217,7 +217,7 @@
|
||||
</div>
|
||||
</transition>
|
||||
<transition name="slideX">
|
||||
<div v-if="state.showChannelList" class="list" v-clickoutside="closeListEvent">
|
||||
<div v-if="state.showChannelList && channelList && channelList.length > 0" class="list" v-clickoutside="closeListEvent">
|
||||
<div class="list-top">
|
||||
<span class="list-top-title">频道列表</span>
|
||||
<span class="list-top-close zy-svg" @click="state.showChannelList = false">
|
||||
@@ -342,7 +342,7 @@ export default {
|
||||
videoTitle: true,
|
||||
airplay: true,
|
||||
closeVideoTouch: true,
|
||||
ignores: ['cssFullscreen', 'replay', 'error'], // 为了切换播放器类型时避免显示错误刷新,暂时忽略错误
|
||||
ignores: ['replay', 'error'], // 为了切换播放器类型时避免显示错误刷新,暂时忽略错误
|
||||
preloadTime: 300
|
||||
},
|
||||
state: {
|
||||
@@ -445,6 +445,9 @@ export default {
|
||||
set (val) {
|
||||
this.SET_DetailCache(val)
|
||||
}
|
||||
},
|
||||
VideoEssentialInfo () {
|
||||
return this.video.key + '@' + this.video.info.id + '@' + this.video.info.index
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -458,12 +461,11 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
video: {
|
||||
VideoEssentialInfo: {
|
||||
handler () {
|
||||
if (this.changingIPTV) return
|
||||
this.getUrls()
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
setting: {
|
||||
handler () {
|
||||
@@ -639,6 +641,7 @@ export default {
|
||||
},
|
||||
playVideo (index = 0, time = 0) {
|
||||
this.isLive = false
|
||||
this.isStar = false
|
||||
this.exportablePlaylist = false
|
||||
this.fetchPlaylist().then(async (fullList) => {
|
||||
let playlist = fullList[0].list // ZY支持的已移到首位
|
||||
@@ -654,9 +657,9 @@ export default {
|
||||
const currentSite = await sites.find({ key: this.video.key })
|
||||
this.$message.info('即将调用解析接口播放,请等待...')
|
||||
if (currentSite.jiexiUrl) {
|
||||
this.onlineUrl = /^\s*(default|默认)\s*$/i.test(currentSite.jiexiUrl) ? this.setting.defaultParseURL + url : currentSite.jiexiUrl + url
|
||||
this.onlineUrl = currentSite.jiexiUrl + url
|
||||
} else {
|
||||
this.onlineUrl = url
|
||||
this.onlineUrl = this.setting.defaultParseURL + url
|
||||
}
|
||||
this.videoPlaying('online')
|
||||
return
|
||||
@@ -710,7 +713,7 @@ export default {
|
||||
name: res.name
|
||||
})
|
||||
resolve(res.fullList)
|
||||
})
|
||||
}).catch(err => { this.$message.error('播放地址可能已失效,请换源并调整收藏', err); this.name = this.video.info.name; this.updateStar(); this.otherEvent() })
|
||||
} else {
|
||||
res = this.DetailCache[cacheKey]
|
||||
this.name = res.name
|
||||
@@ -1567,7 +1570,7 @@ export default {
|
||||
},
|
||||
minMaxEvent () {
|
||||
win.on('minimize', () => {
|
||||
if (this.xg && this.xg.hasStart) {
|
||||
if (this.xg && this.xg.hasStart && this.setting.pauseWhenMinimize) {
|
||||
this.xg.pause()
|
||||
}
|
||||
})
|
||||
@@ -1663,6 +1666,9 @@ export default {
|
||||
cursor: pointer;
|
||||
margin-left: 3px;
|
||||
}
|
||||
.xgplayer-skin-default .xg-btn-playPrev {
|
||||
margin-left: 50px;
|
||||
}
|
||||
.xgplayer-skin-default .xg-btn-quitMiniMode {
|
||||
display: none;
|
||||
}
|
||||
|
||||
@@ -1,39 +1,63 @@
|
||||
<template>
|
||||
<div class="listpage" id="recommendations">
|
||||
<div class="listpage-header" id="recommendations-header">
|
||||
<el-switch v-model="setting.recommendationViewMode" active-text="海报" active-value="picture" inactive-text="列表" inactive-value="table" @change="updateViewMode"></el-switch>
|
||||
<el-select v-model="selectedRecommendationType" size="small" slot="prepend"
|
||||
:popper-append-to-body="false"
|
||||
popper-class="popper"
|
||||
default-first-option placeholder="请选择"
|
||||
@change="changeRecommendationTypeEvent">
|
||||
<el-option
|
||||
v-for="item in recommendationTypes"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-button type="text">视频数:{{ recommendations.length }}</el-button>
|
||||
<el-select v-model="selectedAreas" size="small" multiple placeholder="地区" popper-class="popper" :popper-append-to-body="false">
|
||||
<el-option
|
||||
v-for="item in areas"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-select v-model="selectedTypes" size="small" multiple placeholder="类型" popper-class="popper" :popper-append-to-body="false">
|
||||
<el-option
|
||||
v-for="item in types"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-select v-model="sortKeyword" size="small" placeholder="排序" popper-class="popper" :popper-append-to-body="false">
|
||||
<el-option
|
||||
v-for="item in sortKeywords"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-button :loading="loading" @click.stop="updateEvent" icon="el-icon-refresh">更新推荐</el-button>
|
||||
</div>
|
||||
<div class="toolbar" v-show="showToolbar">
|
||||
<el-select v-model="selectedAreas" size="small" multiple placeholder="地区" popper-class="popper" :popper-append-to-body="false" @remove-tag="refreshFilteredList" @change="refreshFilteredList">
|
||||
<el-option
|
||||
v-for="item in areas"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-select v-model="selectedTypes" size="small" multiple placeholder="类型" popper-class="popper" :popper-append-to-body="false" @remove-tag="refreshFilteredList" @change="refreshFilteredList">
|
||||
<el-option
|
||||
v-for="item in types"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-select v-model="sortKeyword" size="small" placeholder="排序" popper-class="popper" :popper-append-to-body="false" @change="refreshFilteredList">
|
||||
<el-option
|
||||
v-for="item in sortKeywords"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<span>
|
||||
上映区间:
|
||||
<el-input-number size="small" v-model="selectedYears.start" :min=0 :max="new Date().getFullYear()" controls-position="right" step-strictly @change="refreshFilteredList"></el-input-number>
|
||||
至
|
||||
<el-input-number size="small" v-model="selectedYears.end" :min=0 :max="new Date().getFullYear()" controls-position="right" step-strictly @change="refreshFilteredList"></el-input-number>
|
||||
</span>
|
||||
</div>
|
||||
<el-divider class="listpage-header-divider" content-position="right">
|
||||
<el-button type="text" size="mini" @click="toggleViewMode">视图切换</el-button>
|
||||
<el-button type="text" size="mini" @click='() => { showToolbar = !showToolbar; if (!showToolbar) this.refreshFilteredList() }' title="收起工具栏会重置筛选排序">{{ showToolbar ? '隐藏工具栏' : '显示工具栏' }}</el-button>
|
||||
<el-button type="text" size="mini" @click="backTop">回到顶部</el-button>
|
||||
</el-divider>
|
||||
<div class="listpage-body" id="recommendations-body" >
|
||||
<div class="show-table" id="star-table" v-if="setting.recommendationViewMode === 'table'">
|
||||
<el-table size="mini" fit height="100%" row-key="id"
|
||||
ref="recommendationsTable"
|
||||
:data="filteredRecommendations"
|
||||
:data="filteredList"
|
||||
@row-click="detailEvent">
|
||||
<el-table-column
|
||||
prop="name"
|
||||
@@ -55,13 +79,13 @@
|
||||
width="100"
|
||||
align="center">
|
||||
</el-table-column>
|
||||
<el-table-column v-if="filteredRecommendations.some(e => e.rate)"
|
||||
<el-table-column v-if="filteredList.some(e => e.rate)"
|
||||
prop="rate"
|
||||
align="center"
|
||||
width="100"
|
||||
label="豆瓣评分">
|
||||
</el-table-column>
|
||||
<el-table-column v-if="filteredRecommendations.some(e => e.detail.note)"
|
||||
<el-table-column v-if="filteredList.some(e => e.detail.note)"
|
||||
prop="detail.note"
|
||||
label="备注">
|
||||
</el-table-column>
|
||||
@@ -74,13 +98,12 @@
|
||||
<el-button @click.stop="playEvent(scope.row)" type="text">播放</el-button>
|
||||
<el-button @click.stop="shareEvent(scope.row)" type="text">分享</el-button>
|
||||
<el-button @click.stop="downloadEvent(scope.row)" type="text">下载</el-button>
|
||||
<el-button @click.stop="deleteEvent(scope.row)" type="text">删除</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="show-picture" id="star-picture" v-if="setting.recommendationViewMode === 'picture'">
|
||||
<Waterfall ref="recommendationsWaterfall" :list="filteredRecommendations" :gutter="20" :width="240"
|
||||
<Waterfall ref="recommendationsWaterfall" :list="filteredList" :gutter="20" :width="240"
|
||||
:breakpoints="{
|
||||
1200: { //当屏幕宽度小于等于1200
|
||||
rowPerView: 4,
|
||||
@@ -106,7 +129,6 @@
|
||||
<span class="o-play" @click="playEvent(props.data)">播放</span>
|
||||
<span class="o-share" @click="shareEvent(props.data)">分享</span>
|
||||
<span class="o-star" @click="downloadEvent(props.data)">下载</span>
|
||||
<span class="o-star" @click="deleteEvent(props.data)">删除</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -126,10 +148,12 @@
|
||||
</template>
|
||||
<script>
|
||||
import { mapMutations } from 'vuex'
|
||||
import { history, recommendation, setting } from '../lib/dexie'
|
||||
import { history, recommendation, setting, sites, cachedMovies } from '../lib/dexie'
|
||||
import zy from '../lib/site/tools'
|
||||
import Waterfall from 'vue-waterfall-plugin'
|
||||
import axios from 'axios'
|
||||
const { clipboard } = require('electron')
|
||||
|
||||
export default {
|
||||
name: 'recommendations',
|
||||
data () {
|
||||
@@ -138,11 +162,45 @@ export default {
|
||||
sites: [],
|
||||
loading: false,
|
||||
types: [],
|
||||
selectedTypes: [],
|
||||
areas: [],
|
||||
filteredList: [],
|
||||
// 不同推荐
|
||||
recommendationsDefault: [],
|
||||
recommendationTypes: ['作者推荐', '豆瓣热门电影', '豆瓣高分电影', '豆瓣热门剧集', '豆瓣热门美剧', '豆瓣热门英剧', '豆瓣热门国产剧', '豆瓣热门综艺', '豆瓣热门动漫', '豆瓣热门纪录片', '豆瓣热门动画电影'],
|
||||
selectedRecommendationType: '作者推荐',
|
||||
// Toolbar
|
||||
showToolbar: false,
|
||||
selectedAreas: [],
|
||||
selectedTypes: [],
|
||||
sortKeyword: '',
|
||||
sortKeywords: ['上映', '评分', '默认']
|
||||
sortKeywords: ['按片名', '按上映年份', '按更新时间', '按评分'],
|
||||
selectedYears: { start: 0, end: new Date().getFullYear() },
|
||||
// 缓存数据
|
||||
localCachedMovies: [],
|
||||
// 豆瓣
|
||||
douban: {
|
||||
page_limit: 50,
|
||||
hotMoviePageStart: 0,
|
||||
hotmovie: [],
|
||||
hotTVPageStart: 0,
|
||||
hotTV: [],
|
||||
highRateMoviePageStart: 0,
|
||||
highRateMovie: [],
|
||||
hotAnimePageStart: 0,
|
||||
hotAnime: [],
|
||||
hotDocumentaryPageStart: 0,
|
||||
hotDocumentary: [],
|
||||
hotTVShowPageStart: 0,
|
||||
hotTVShow: [],
|
||||
hotCartonMoviePageStart: 0,
|
||||
hotCartonMovie: [],
|
||||
hotAmericanTVSeriesPageStart: 0,
|
||||
hotAmericanTVSeries: [],
|
||||
hotBritishTVSeriesPageStart: 0,
|
||||
hotBritishTVSeries: [],
|
||||
hotChineseTVSeriesPageStart: 0,
|
||||
hotChineseTVSeries: []
|
||||
}
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@@ -188,11 +246,6 @@ export default {
|
||||
set (val) {
|
||||
this.SET_SETTING(val)
|
||||
}
|
||||
},
|
||||
filteredRecommendations () {
|
||||
let filteredData = this.recommendations.filter(x => (this.selectedAreas.length === 0) || this.selectedAreas.includes(x.detail.area))
|
||||
filteredData = filteredData.filter(x => (this.selectedTypes.length === 0) || this.selectedTypes.includes(x.detail.type))
|
||||
return filteredData
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -201,44 +254,130 @@ export default {
|
||||
if (this.$refs.recommendationsWaterfall) this.$refs.recommendationsWaterfall.resize()
|
||||
}
|
||||
},
|
||||
sortKeyword () {
|
||||
switch (this.sortKeyword) {
|
||||
case '上映':
|
||||
this.recommendations = this.recommendations.sort(function (a, b) {
|
||||
return b.detail.year - a.detail.year
|
||||
})
|
||||
break
|
||||
case '评分':
|
||||
this.recommendations.sort(function (a, b) {
|
||||
return b.rate - a.rate
|
||||
})
|
||||
break
|
||||
case '默认':
|
||||
this.recommendations.sort(function (a, b) {
|
||||
return b.id - a.id
|
||||
})
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
recommendations: {
|
||||
handler (recommendations) {
|
||||
this.areas = [...new Set(recommendations.map(ele => ele.detail.area))].filter(x => x)
|
||||
this.types = [...new Set(recommendations.map(ele => ele.detail.type))].filter(x => x)
|
||||
this.refreshFilteredList()
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['SET_VIEW', 'SET_DETAIL', 'SET_VIDEO', 'SET_SHARE', 'SET_SETTING']),
|
||||
detailEvent (e) {
|
||||
this.detail = {
|
||||
show: true,
|
||||
key: e.key,
|
||||
info: {
|
||||
id: e.ids,
|
||||
name: e.name
|
||||
changeRecommendationTypeEvent () {
|
||||
if (this.selectedRecommendationType === '作者推荐') {
|
||||
this.recommendations = this.recommendationsDefault
|
||||
} else {
|
||||
if (this.selectedRecommendationType === '豆瓣热门电影') {
|
||||
this.recommendations = [...this.douban.hotmovie]
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣高分电影') {
|
||||
this.recommendations = [...this.douban.highRateMovie]
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门剧集') {
|
||||
this.recommendations = [...this.douban.hotTV]
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门美剧') {
|
||||
this.recommendations = [...this.douban.hotAmericanTVSeries]
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门英剧') {
|
||||
this.recommendations = [...this.douban.hotBritishTVSeries]
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门国产剧') {
|
||||
this.recommendations = [...this.douban.hotChineseTVSeries]
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门动漫') {
|
||||
this.recommendations = [...this.douban.hotAnime]
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门纪录片') {
|
||||
this.recommendations = [...this.douban.hotDocumentary]
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门综艺') {
|
||||
this.recommendations = [...this.douban.hotTVShow]
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门动画电影') {
|
||||
this.recommendations = [...this.douban.hotCartonMovie]
|
||||
}
|
||||
if (this.recommendations.length === 0) {
|
||||
this.updateDoubanRecommendationsEvent()
|
||||
}
|
||||
}
|
||||
},
|
||||
getRecommendationsDoubanMovieOrTV (doubanUrl) {
|
||||
axios.get(doubanUrl).then(res => {
|
||||
if (res.data) {
|
||||
res.data.subjects.forEach(element => {
|
||||
const localCachedMovie = this.localCachedMovies.find(e => e.key === this.sites[0].key && e.name === element.title)
|
||||
if (localCachedMovie) {
|
||||
this.updateDoubanRecommendataions(localCachedMovie)
|
||||
} else {
|
||||
this.searchAndCacheMovie(element)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
updateDoubanRecommendataions (movie) {
|
||||
this.recommendations.push(movie)
|
||||
if (this.selectedRecommendationType === '豆瓣热门电影') {
|
||||
this.douban.hotmovie.push(movie)
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣高分电影') {
|
||||
this.douban.highRateMovie.push(movie)
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门剧集') {
|
||||
this.douban.hotTV.push(movie)
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门美剧') {
|
||||
this.douban.hotAmericanTVSeries.push(movie)
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门英剧') {
|
||||
this.douban.hotBritishTVSeries.push(movie)
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门国产剧') {
|
||||
this.douban.hotChineseTVSeries.push(movie)
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门动漫') {
|
||||
this.douban.hotAnime.push(movie)
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门纪录片') {
|
||||
this.douban.hotDocumentary.push(movie)
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门综艺') {
|
||||
this.douban.hotTVShow.push(movie)
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门动画电影') {
|
||||
this.douban.hotCartonMovie.push(movie)
|
||||
}
|
||||
},
|
||||
searchAndCacheMovie (element) {
|
||||
zy.searchFirstDetail(this.sites[0].key, element.title).then(detailRes => {
|
||||
if (detailRes) {
|
||||
const doc = {
|
||||
key: this.sites[0].key,
|
||||
ids: detailRes.id,
|
||||
site: this.sites[0],
|
||||
name: detailRes.name,
|
||||
detail: detailRes,
|
||||
rate: element.rate
|
||||
}
|
||||
this.updateDoubanRecommendataions(doc)
|
||||
this.localCachedMovies.push(doc)
|
||||
cachedMovies.add(doc)
|
||||
}
|
||||
})
|
||||
},
|
||||
updateEvent () {
|
||||
const url = 'https://gitee.com/cuiocean/ZY-Player-Resources/raw/main/Recommendations/Recommendations.json'
|
||||
if (this.selectedRecommendationType === '作者推荐') {
|
||||
this.updateAuthorRecommendataions()
|
||||
} else {
|
||||
this.updateDoubanRecommendationsEvent()
|
||||
}
|
||||
},
|
||||
updateAuthorRecommendataions () {
|
||||
const url = 'https://raw.githubusercontent.com/cuiocean/ZY-Player-Resources/main/Recommendations/Recommendations.json'
|
||||
this.loading = true
|
||||
const axios = require('axios')
|
||||
axios.get(url).then(res => {
|
||||
if (res.status === 200) {
|
||||
if (res.data.length > 0) {
|
||||
@@ -255,6 +394,120 @@ export default {
|
||||
this.$message.warning('最新的推荐数据保存在Github上,请考虑使用代理或者等待下一版本内置数据更新.')
|
||||
})
|
||||
},
|
||||
updateDoubanRecommendationsEvent () {
|
||||
let doubanUrl = ''
|
||||
if (this.selectedRecommendationType === '豆瓣热门电影') {
|
||||
doubanUrl = `https://movie.douban.com/j/search_subjects?type=movie&tag=热门&sort=recommend&page_limit=${this.douban.page_limit}&page_start=${this.douban.hotMoviePageStart}`
|
||||
this.douban.hotMoviePageStart = this.douban.hotMoviePageStart + this.douban.page_limit
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门剧集') {
|
||||
doubanUrl = `https://movie.douban.com/j/search_subjects?type=tv&tag=热门&sort=recommend&page_limit=${this.douban.page_limit}&page_start=${this.douban.hotTVPageStart}`
|
||||
this.douban.hotTVPageStart = this.douban.hotTVPageStart + this.douban.page_limit
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门美剧') {
|
||||
doubanUrl = `https://movie.douban.com/j/search_subjects?type=tv&tag=美剧&sort=recommend&page_limit=${this.douban.page_limit}&page_start=${this.douban.hotCartonMoviePageStart}`
|
||||
this.douban.hotCartonMoviePageStart = this.douban.hotCartonMoviePageStart + this.douban.page_limit
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门英剧') {
|
||||
doubanUrl = `https://movie.douban.com/j/search_subjects?type=tv&tag=英剧&sort=recommend&page_limit=${this.douban.page_limit}&page_start=${this.douban.hotBritishTVSeriesPageStart}`
|
||||
this.douban.hotBritishTVSeriesPageStart = this.douban.hotBritishTVSeriesPageStart + this.douban.page_limit
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门国产剧') {
|
||||
doubanUrl = `https://movie.douban.com/j/search_subjects?type=tv&tag=国产剧&sort=recommend&page_limit=${this.douban.page_limit}&page_start=${this.douban.hotChineseTVSeriesPageStart}`
|
||||
this.douban.hotChineseTVSeriesPageStart = this.douban.hotChineseTVSeriesPageStart + this.douban.page_limit
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣高分电影') {
|
||||
doubanUrl = `https://movie.douban.com/j/search_subjects?type=movie&tag=豆瓣高分&sort=recommend&page_limit=${this.douban.page_limit}&page_start=${this.douban.highRateMoviePageStart}`
|
||||
this.douban.highRateMoviePageStart = this.douban.highRateMoviePageStart + this.douban.page_limit
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门动漫') {
|
||||
doubanUrl = `https://movie.douban.com/j/search_subjects?type=tv&tag=日本动画&sort=recommend&page_limit=${this.douban.page_limit}&page_start=${this.douban.hotAnimePageStart}`
|
||||
this.douban.hotAnimePageStart = this.douban.hotAnimePageStart + this.douban.page_limit
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门纪录片') {
|
||||
doubanUrl = `https://movie.douban.com/j/search_subjects?type=tv&tag=纪录片&sort=recommend&page_limit=${this.douban.page_limit}&page_start=${this.douban.hotDocumentaryPageStart}`
|
||||
this.douban.hotDocumentaryPageStart = this.douban.hotDocumentaryPageStart + this.douban.page_limit
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门综艺') {
|
||||
doubanUrl = `https://movie.douban.com/j/search_subjects?type=tv&tag=综艺&sort=recommend&page_limit=${this.douban.page_limit}&page_start=${this.douban.hotTVShowPageStart}`
|
||||
this.douban.hotTVShowPageStart = this.douban.hotTVShowPageStart + this.douban.page_limit
|
||||
}
|
||||
if (this.selectedRecommendationType === '豆瓣热门动画电影') {
|
||||
doubanUrl = `https://movie.douban.com/j/search_subjects?type=movie&tag=动画&sort=recommend&page_limit=${this.douban.page_limit}&page_start=${this.douban.hotCartonMoviePageStart}`
|
||||
this.douban.hotCartonMoviePageStart = this.douban.hotCartonMoviePageStart + this.douban.page_limit
|
||||
}
|
||||
this.getRecommendationsDoubanMovieOrTV(doubanUrl)
|
||||
},
|
||||
toggleViewMode () {
|
||||
this.setting.recommendationViewMode = this.setting.recommendationViewMode === 'picture' ? 'table' : 'picture'
|
||||
if (this.setting.recommendationViewMode === 'table') {
|
||||
setTimeout(() => { this.rowDrop() }, 100)
|
||||
} else {
|
||||
setTimeout(() => { if (this.$refs.recommendationsWaterfall) this.$refs.recommendationsWaterfall.refresh() }, 700)
|
||||
}
|
||||
setting.find().then(res => {
|
||||
res.recommendationViewMode = this.setting.recommendationViewMode
|
||||
setting.update(res)
|
||||
})
|
||||
},
|
||||
backTop () {
|
||||
if (this.setting.recommendationViewMode === 'picture') {
|
||||
document.getElementById('recommendations-body').scrollTop = 0
|
||||
} else {
|
||||
this.$refs.recommendationsTable.bodyWrapper.scrollTop = 0
|
||||
}
|
||||
},
|
||||
refreshFilteredList () {
|
||||
if (!this.showToolbar) {
|
||||
this.sortKeyword = ''
|
||||
this.selectedAreas = []
|
||||
this.selectedSearchClassNames = []
|
||||
this.selectedYears.start = 0
|
||||
this.selectedYears.end = new Date().getFullYear()
|
||||
this.filteredList = this.recommendations
|
||||
} else {
|
||||
let filteredData = this.recommendations
|
||||
filteredData = filteredData.filter(x => (this.selectedAreas.length === 0) || this.selectedAreas.includes(x.detail.area))
|
||||
filteredData = filteredData.filter(x => (this.selectedTypes.length === 0) || this.selectedTypes.includes(x.detail.type))
|
||||
filteredData = filteredData.filter(res => res.detail.year >= this.selectedYears.start)
|
||||
filteredData = filteredData.filter(res => res.detail.year <= this.selectedYears.end)
|
||||
switch (this.sortKeyword) {
|
||||
case '按上映年份':
|
||||
filteredData.sort(function (a, b) {
|
||||
return a.detail.year - b.detail.year
|
||||
})
|
||||
break
|
||||
case '按片名':
|
||||
filteredData.sort(function (a, b) {
|
||||
return a.detail.name.localeCompare(b.detail.name, 'zh')
|
||||
})
|
||||
break
|
||||
case '按更新时间':
|
||||
filteredData.sort(function (a, b) {
|
||||
return new Date(b.detail.last) - new Date(a.detail.last)
|
||||
})
|
||||
break
|
||||
case '按评分':
|
||||
filteredData.sort(function (a, b) {
|
||||
return b.rate - a.rate
|
||||
})
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
this.filteredList = filteredData
|
||||
}
|
||||
},
|
||||
detailEvent (e) {
|
||||
this.detail = {
|
||||
show: true,
|
||||
key: e.key,
|
||||
info: {
|
||||
id: e.ids,
|
||||
name: e.name
|
||||
}
|
||||
}
|
||||
},
|
||||
async playEvent (e) {
|
||||
const db = await history.find({ site: e.key, ids: e.ids })
|
||||
if (db) {
|
||||
@@ -264,14 +517,6 @@ export default {
|
||||
}
|
||||
this.view = 'Play'
|
||||
},
|
||||
deleteEvent (e) {
|
||||
recommendation.remove(e.id).then(res => {
|
||||
if (res) {
|
||||
this.$message.warning('删除失败')
|
||||
}
|
||||
this.getRecommendations()
|
||||
})
|
||||
},
|
||||
shareEvent (e) {
|
||||
this.share = {
|
||||
show: true,
|
||||
@@ -295,6 +540,7 @@ export default {
|
||||
this.recommendations = res.sort(function (a, b) {
|
||||
return b.id - a.id
|
||||
})
|
||||
this.recommendationsDefault = this.recommendations
|
||||
this.getFilterData()
|
||||
})
|
||||
},
|
||||
@@ -308,10 +554,24 @@ export default {
|
||||
res.recommendationViewMode = this.setting.recommendationViewMode
|
||||
setting.update(res)
|
||||
})
|
||||
},
|
||||
getAllSites () {
|
||||
sites.all().then(res => {
|
||||
if (res.length > 0) {
|
||||
this.sites = res.filter(item => item.isActive)
|
||||
}
|
||||
})
|
||||
},
|
||||
getCachedMovies () {
|
||||
cachedMovies.all().then(res => {
|
||||
this.localCachedMovies = res
|
||||
})
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.getAllSites()
|
||||
this.getRecommendations()
|
||||
this.getCachedMovies()
|
||||
},
|
||||
mounted () {
|
||||
addEventListener('resize', () => {
|
||||
|
||||
@@ -93,9 +93,6 @@
|
||||
<div class="zy-select">
|
||||
<div class="vs-placeholder vs-noAfter" @click="show.configSitesDataUrlDialog = true">设置源站接口文件</div>
|
||||
</div>
|
||||
<div class="zy-input" @click="toggleExcludeRootClasses">
|
||||
<input type="checkbox" v-model = "d.excludeRootClasses" @change="updateSettingEvent"> 屏蔽主分类
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="site">
|
||||
@@ -113,6 +110,15 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="site">
|
||||
<div class="title">窗口及播放</div>
|
||||
<div class="site-box">
|
||||
<div class="zy-input">
|
||||
<input type="checkbox" v-model = "d.restoreWindowPositionAndSize" @change="updateSettingEvent"> 记录并恢复窗口位置和大小
|
||||
<input type="checkbox" v-model = "d.pauseWhenMinimize" @change="updateSettingEvent"> 最小化时暂停播放
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="theme">
|
||||
<div class="title">主题</div>
|
||||
<div class="theme-box">
|
||||
@@ -167,7 +173,7 @@
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="closeDialog">取消</el-button>
|
||||
<el-button type="danger" @click="get7kParseURL">重置</el-button>
|
||||
<el-button type="danger" @click="resetDefaultParseURL">重置</el-button>
|
||||
<el-button type="primary" @click="configDefaultParseURL">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
@@ -181,7 +187,7 @@
|
||||
</el-form>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="closeDialog">取消</el-button>
|
||||
<el-button type="danger" @click="getDefaultdeSitesDataURL">重置</el-button>
|
||||
<el-button type="danger" @click="resetDefaultSitesDataURL">重置</el-button>
|
||||
<el-button type="primary" @click="configSitesDataURL">确定</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
@@ -328,17 +334,13 @@ export default {
|
||||
this.d = res
|
||||
this.setting = this.d
|
||||
if (!this.setting.defaultParseURL) this.configDefaultParseURL()
|
||||
if (!this.setting.sitesDataURL) this.getDefaultdeSitesDataURL()
|
||||
if (!this.setting.sitesDataURL) this.resetDefaultSitesDataURL()
|
||||
})
|
||||
},
|
||||
getDefaultSites () {
|
||||
this.getDefaultdeSitesDataURL()
|
||||
const axios = require('axios')
|
||||
axios.get(this.setting.sitesDataURL).then(res => {
|
||||
if (res.status === 200) {
|
||||
if (res.data.length > 0) {
|
||||
sites.clear().then(sites.bulkAdd(res.data))
|
||||
}
|
||||
zy.getDefaultSites(this.setting.sitesDataURL).then(res => {
|
||||
if (res.length > 0) {
|
||||
sites.clear().then(sites.bulkAdd(res))
|
||||
}
|
||||
}).catch(error => {
|
||||
this.$message.error('获取云端源站失败. ' + error)
|
||||
@@ -378,25 +380,20 @@ export default {
|
||||
this.d.excludeRootClasses = !this.d.excludeRootClasses
|
||||
this.updateSettingEvent()
|
||||
},
|
||||
async get7kParseURL () {
|
||||
this.$message.info('正在获取7K源解析地址...')
|
||||
const parseURL = await zy.get7kParseURL()
|
||||
if (parseURL.startsWith('http')) {
|
||||
this.$message.success('获取成功,更新应用默认解析接口地址...')
|
||||
this.setting.defaultParseURL = parseURL
|
||||
}
|
||||
async resetDefaultParseURL () {
|
||||
this.setting.defaultParseURL = 'https://jx.bpba.cc/?v='
|
||||
},
|
||||
async configDefaultParseURL () {
|
||||
if (!this.setting.defaultParseURL) await this.get7kParseURL()
|
||||
this.d.defaultParseURL = this.setting.defaultParseURL.trim()
|
||||
if (!this.setting.defaultParseURL) await this.resetDefaultParseURL()
|
||||
this.d.defaultParseURL = this.setting.defaultParseURL?.trim()
|
||||
this.show.configDefaultParseUrlDialog = false
|
||||
this.updateSettingEvent()
|
||||
},
|
||||
getDefaultdeSitesDataURL () {
|
||||
resetDefaultSitesDataURL () {
|
||||
this.setting.sitesDataURL = 'https://gitee.com/cuiocean/ZY-Player-Resources/raw/main/Sites/Sites.json'
|
||||
},
|
||||
configSitesDataURL () {
|
||||
if (!this.setting.sitesDataURL) this.getDefaultdeSitesDataURL()
|
||||
if (!this.setting.sitesDataURL) this.resetDefaultSitesDataURL()
|
||||
this.d.sitesDataURL = this.setting.sitesDataURL
|
||||
this.show.configSitesDataUrlDialog = false
|
||||
this.updateSettingEvent()
|
||||
|
||||
@@ -1,17 +1,56 @@
|
||||
<template>
|
||||
<div class="listpage" id="star">
|
||||
<div class="listpage-header" id="star-header">
|
||||
<el-switch v-model="setting.starViewMode" active-text="海报" active-value="picture" inactive-text="列表" inactive-value="table" @change="updateViewMode"></el-switch>
|
||||
<el-button @click.stop="exportFavoritesEvent" icon="el-icon-upload2" title="导出全部,自动添加扩展名">导出</el-button>
|
||||
<el-button @click.stop="importFavoritesEvent" icon="el-icon-download" title="支持同时导入多个文件">导入</el-button>
|
||||
<el-button @click.stop="removeSelectedItems" icon="el-icon-delete-solid">{{ multipleSelection.length === 0 ? "清空" : "删除所选" }}</el-button>
|
||||
<el-button @click.stop="updateAllEvent" icon="el-icon-refresh">同步所有收藏</el-button>
|
||||
<b-button-group>
|
||||
<el-switch v-model="onlyShowItemsHasUpdate" active-text="有更新" inactive-text="全部" @change="refreshFilteredList"></el-switch>
|
||||
<el-button @click.stop="updateAllEvent" icon="el-icon-refresh">检查更新</el-button>
|
||||
</b-button-group>
|
||||
</div>
|
||||
<div class="toolbar" v-show="showToolbar">
|
||||
<el-select v-model="selectedAreas" size="small" multiple placeholder="地区" popper-class="popper" :popper-append-to-body="false" @remove-tag="refreshFilteredList" @change="refreshFilteredList">
|
||||
<el-option
|
||||
v-for="item in areas"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-select v-model="selectedTypes" size="small" multiple placeholder="类型" popper-class="popper" :popper-append-to-body="false" @remove-tag="refreshFilteredList" @change="refreshFilteredList">
|
||||
<el-option
|
||||
v-for="item in types"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<el-select v-model="sortKeyword" size="small" placeholder="排序" popper-class="popper" :popper-append-to-body="false" @change="refreshFilteredList">
|
||||
<el-option
|
||||
v-for="item in sortKeywords"
|
||||
:key="item"
|
||||
:label="item"
|
||||
:value="item">
|
||||
</el-option>
|
||||
</el-select>
|
||||
<span>
|
||||
上映区间:
|
||||
<el-input-number size="small" v-model="selectedYears.start" :min=0 :max="new Date().getFullYear()" controls-position="right" step-strictly @change="refreshFilteredList"></el-input-number>
|
||||
至
|
||||
<el-input-number size="small" v-model="selectedYears.end" :min=0 :max="new Date().getFullYear()" controls-position="right" step-strictly @change="refreshFilteredList"></el-input-number>
|
||||
</span>
|
||||
</div>
|
||||
<el-divider class="listpage-header-divider" content-position="right">
|
||||
<el-button type="text" size="mini" @click="toggleViewMode">视图切换</el-button>
|
||||
<el-button type="text" size="mini" @click='() => { showToolbar = !showToolbar; if (!showToolbar) this.refreshFilteredList() }' title="收起工具栏会重置筛选排序">{{ showToolbar ? '隐藏工具栏' : '显示工具栏' }}</el-button>
|
||||
<el-button type="text" size="mini" @click="backTop">回到顶部</el-button>
|
||||
</el-divider>
|
||||
<div class="listpage-body" id="star-body">
|
||||
<div class="show-table" id="star-table" v-if="setting.starViewMode === 'table'">
|
||||
<el-table size="mini" fit height="100%" row-key="id"
|
||||
ref="starTable"
|
||||
:data="list"
|
||||
:data="filteredList"
|
||||
:cell-class-name="checkUpdate"
|
||||
@row-click="detailEvent"
|
||||
@sort-change="handleSortChange"
|
||||
@@ -84,7 +123,7 @@
|
||||
</el-table>
|
||||
</div>
|
||||
<div class="show-picture" id="star-picture" v-if="setting.starViewMode === 'picture'">
|
||||
<Waterfall ref="starWaterfall" :list="list" :gutter="20" :width="240"
|
||||
<Waterfall ref="starWaterfall" :list="filteredList" :gutter="20" :width="240"
|
||||
:breakpoints="{
|
||||
1200: { //当屏幕宽度小于等于1200
|
||||
rowPerView: 4,
|
||||
@@ -155,7 +194,18 @@ export default {
|
||||
shiftDown: false,
|
||||
selectionBegin: '',
|
||||
selectionEnd: '',
|
||||
multipleSelection: []
|
||||
multipleSelection: [],
|
||||
filteredList: [],
|
||||
areas: [],
|
||||
types: [],
|
||||
// Toolbar
|
||||
showToolbar: false,
|
||||
selectedAreas: [],
|
||||
selectedTypes: [],
|
||||
sortKeyword: '',
|
||||
sortKeywords: ['按片名', '按上映年份', '按更新时间'],
|
||||
selectedYears: { start: 0, end: new Date().getFullYear() },
|
||||
onlyShowItemsHasUpdate: false
|
||||
}
|
||||
},
|
||||
components: {
|
||||
@@ -225,10 +275,77 @@ export default {
|
||||
this.numNoUpdate = 0
|
||||
this.$message.warning('未查询到任何更新')
|
||||
}
|
||||
},
|
||||
list: {
|
||||
handler (list) {
|
||||
this.areas = [...new Set(list.map(ele => ele.detail.area))].filter(x => x)
|
||||
this.types = [...new Set(list.map(ele => ele.detail.type))].filter(x => x)
|
||||
this.refreshFilteredList()
|
||||
},
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
...mapMutations(['SET_VIEW', 'SET_DETAIL', 'SET_VIDEO', 'SET_SHARE', 'SET_SETTING']),
|
||||
toggleViewMode () {
|
||||
this.setting.starViewMode = this.setting.starViewMode === 'picture' ? 'table' : 'picture'
|
||||
if (this.setting.starViewMode === 'table') {
|
||||
setTimeout(() => { this.rowDrop() }, 100)
|
||||
this.showShiftPrompt()
|
||||
} else {
|
||||
setTimeout(() => { if (this.$refs.starWaterfall) this.$refs.starWaterfall.refresh() }, 700)
|
||||
}
|
||||
setting.find().then(res => {
|
||||
res.starViewMode = this.setting.starViewMode
|
||||
setting.update(res)
|
||||
})
|
||||
},
|
||||
backTop () {
|
||||
if (this.setting.starViewMode === 'picture') {
|
||||
document.getElementById('star-body').scrollTop = 0
|
||||
} else {
|
||||
this.$refs.starTable.bodyWrapper.scrollTop = 0
|
||||
}
|
||||
},
|
||||
refreshFilteredList () {
|
||||
if (!this.showToolbar) {
|
||||
this.sortKeyword = ''
|
||||
this.selectedAreas = []
|
||||
this.selectedSearchClassNames = []
|
||||
this.selectedYears.start = 0
|
||||
this.selectedYears.end = new Date().getFullYear()
|
||||
this.filteredList = this.list
|
||||
} else {
|
||||
let filteredData = this.list
|
||||
filteredData = filteredData.filter(x => (this.selectedAreas.length === 0) || this.selectedAreas.includes(x.detail.area))
|
||||
filteredData = filteredData.filter(x => (this.selectedTypes.length === 0) || this.selectedTypes.includes(x.detail.type))
|
||||
filteredData = filteredData.filter(res => res.detail.year >= this.selectedYears.start)
|
||||
filteredData = filteredData.filter(res => res.detail.year <= this.selectedYears.end)
|
||||
switch (this.sortKeyword) {
|
||||
case '按上映年份':
|
||||
filteredData.sort(function (a, b) {
|
||||
return a.detail.year - b.detail.year
|
||||
})
|
||||
break
|
||||
case '按片名':
|
||||
filteredData.sort(function (a, b) {
|
||||
return a.detail.name.localeCompare(b.detail.name, 'zh')
|
||||
})
|
||||
break
|
||||
case '按更新时间':
|
||||
filteredData.sort(function (a, b) {
|
||||
return new Date(b.detail.last) - new Date(a.detail.last)
|
||||
})
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
this.filteredList = filteredData
|
||||
}
|
||||
if (this.onlyShowItemsHasUpdate) {
|
||||
this.filteredList = this.filteredList.filter(x => x.hasUpdate)
|
||||
}
|
||||
},
|
||||
handleSortChange (column, prop, order) {
|
||||
this.updateDatabase()
|
||||
},
|
||||
@@ -331,7 +448,7 @@ export default {
|
||||
star.get(e.id).then(resStar => {
|
||||
if (!e.hasUpdate && e.detail.last !== doc.detail.last) {
|
||||
doc.hasUpdate = true
|
||||
const msg = `同步"${e.name}"成功, 检查到更新。`
|
||||
const msg = `检查到"${e.name}"有更新。`
|
||||
this.$message.success(msg)
|
||||
} else {
|
||||
this.numNoUpdate += 1
|
||||
@@ -340,7 +457,7 @@ export default {
|
||||
this.getFavorites()
|
||||
})
|
||||
} catch (err) {
|
||||
const msg = `同步"${e.name}"失败, 请重试。`
|
||||
const msg = `更新"${e.name}"失败, 请重试。`
|
||||
this.$message.warning(msg, err)
|
||||
}
|
||||
},
|
||||
@@ -488,18 +605,6 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
updateViewMode () {
|
||||
if (this.setting.starViewMode === 'table') {
|
||||
setTimeout(() => { this.rowDrop() }, 100)
|
||||
this.showShiftPrompt()
|
||||
} else {
|
||||
setTimeout(() => { if (this.$refs.starWaterfall) this.$refs.starWaterfall.refresh() }, 700)
|
||||
}
|
||||
setting.find().then(res => {
|
||||
res.starViewMode = this.setting.starViewMode
|
||||
setting.update(res)
|
||||
})
|
||||
},
|
||||
showShiftPrompt () {
|
||||
if (this.setting.shiftTooltipLimitTimes === undefined) this.setting.shiftTooltipLimitTimes = 5
|
||||
if (this.setting.shiftTooltipLimitTimes) {
|
||||
|
||||
28
src/lib/dexie/cachedMovies.js
Normal file
28
src/lib/dexie/cachedMovies.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import db from './dexie'
|
||||
const { cachedMovies } = db
|
||||
export default {
|
||||
async add (doc) {
|
||||
return await cachedMovies.add(doc)
|
||||
},
|
||||
async bulkAdd (doc) {
|
||||
return await cachedMovies.bulkAdd(doc)
|
||||
},
|
||||
async find (doc) {
|
||||
return await cachedMovies.where(doc).first()
|
||||
},
|
||||
async update (id, docs) {
|
||||
return await cachedMovies.update(id, docs)
|
||||
},
|
||||
async all () {
|
||||
return await cachedMovies.toArray()
|
||||
},
|
||||
async remove (id) {
|
||||
return await cachedMovies.delete(id)
|
||||
},
|
||||
async get (id) {
|
||||
return await cachedMovies.get(id)
|
||||
},
|
||||
async clear () {
|
||||
return await cachedMovies.clear()
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
import Dexie from 'dexie'
|
||||
import { setting, sites, localKey, iptv, recommendations } from './initData'
|
||||
import { sites, localKey, iptv, recommendations, iniSetting } from './initData'
|
||||
|
||||
const db = new Dexie('zy')
|
||||
|
||||
db.version(4).stores({
|
||||
search: '++id, keywords',
|
||||
setting: 'id, theme, site, shortcut, view, volume, externalPlayer, searchGroup, excludeRootClasses, excludeR18Films, forwardTimeInSec, starViewMode, recommandationViewMode, searchViewMode, password, proxy, allowPassWhenIptvCheck, autocleanWhenIptvCheck',
|
||||
@@ -59,8 +58,51 @@ db.version(8).stores({
|
||||
})
|
||||
})
|
||||
|
||||
db.version(9).stores({
|
||||
history: '++id, [site+ids], name, type, year, index, time, duration, detail, onlinePlay, hasUpdate'
|
||||
})
|
||||
|
||||
db.version(10).stores({
|
||||
setting: 'id, theme, shortcut, view, volume, externalPlayer, searchGroup, excludeRootClasses, excludeR18Films, forwardTimeInSec, starViewMode, recommandationViewMode, searchViewMode, password, proxy, allowPassWhenIptvCheck, autocleanWhenIptvCheck, rootClassFilter, r18ClassFilter, classFilter'
|
||||
}).upgrade(trans => {
|
||||
trans.setting.toCollection().modify(setting => {
|
||||
delete setting.site
|
||||
setting.rootClassFilter = ['电影', '电影片', '电视剧', '连续剧', '综艺', '动漫']
|
||||
setting.r18ClassFilter = ['伦理', '论理', '倫理', '福利', '激情', '理论', '写真', '情色', '美女', '街拍', '赤足', '性感', '里番', 'VIP']
|
||||
setting.classFilter = ['电影', '电影片', '电视剧', '连续剧', '综艺', '动漫', '伦理', '论理', '倫理', '福利', '激情', '理论', '写真', '情色', '美女', '街拍', '赤足', '性感', '里番', 'VIP']
|
||||
})
|
||||
})
|
||||
|
||||
db.version(11).stores({
|
||||
setting: 'id, theme, shortcut, view, volume, externalPlayer, searchGroup, excludeRootClasses, excludeR18Films, forwardTimeInSec, starViewMode, recommandationViewMode,' +
|
||||
'searchViewMode, password, proxy, allowPassWhenIptvCheck, autocleanWhenIptvCheck, rootClassFilter, r18ClassFilter, classFilter, restoreWindowPositionAndSize, windowPositionAndSize, pauseWhenMinimize',
|
||||
cachedMovies: '++id, [key+ids], site, name, detail, index, rate, hasUpdate'
|
||||
}).upgrade(trans => {
|
||||
trans.setting.toCollection().modify(setting => {
|
||||
setting.restoreWindowPositionAndSize = false
|
||||
setting.windowPositionAndSize = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 1080,
|
||||
height: 720
|
||||
}
|
||||
setting.pauseWhenMinimize = false
|
||||
})
|
||||
})
|
||||
|
||||
db.version(11).stores({
|
||||
setting: 'id, theme, shortcut, view, volume, externalPlayer, searchGroup, excludeRootClasses, excludeR18Films, forwardTimeInSec, starViewMode, recommandationViewMode,' +
|
||||
'searchViewMode, password, proxy, allowPassWhenIptvCheck, autocleanWhenIptvCheck, rootClassFilter, r18ClassFilter, classFilter, restoreWindowPositionAndSize,' +
|
||||
'windowPositionAndSize, pauseWhenMinimize, sitesDataURL, defaultParseURL'
|
||||
}).upgrade(trans => {
|
||||
trans.setting.toCollection().modify(setting => {
|
||||
setting.sitesDataURL = 'https://gitee.com/cuiocean/ZY-Player-Resources/raw/main/Sites/Sites.json'
|
||||
setting.defaultParseURL = 'https://jx.bpba.cc/?v='
|
||||
})
|
||||
})
|
||||
|
||||
db.on('populate', () => {
|
||||
db.setting.bulkAdd(setting)
|
||||
db.setting.bulkAdd(iniSetting)
|
||||
db.sites.bulkAdd(sites)
|
||||
db.shortcut.bulkAdd(localKey)
|
||||
db.iptv.bulkAdd(iptv)
|
||||
|
||||
@@ -19,6 +19,9 @@ export default {
|
||||
async remove (id) {
|
||||
return await history.delete(id)
|
||||
},
|
||||
async get (id) {
|
||||
return await history.get(id)
|
||||
},
|
||||
async clear () {
|
||||
return await history.clear()
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import search from './search'
|
||||
import iptv from './iptv'
|
||||
import channelList from './channelList'
|
||||
import recommendation from './recommendation'
|
||||
import cachedMovies from './cachedMovies'
|
||||
|
||||
export {
|
||||
history,
|
||||
@@ -19,5 +20,6 @@ export {
|
||||
iptv,
|
||||
channelList,
|
||||
search,
|
||||
recommendation
|
||||
recommendation,
|
||||
cachedMovies
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
82
src/lib/dexie/iniData/iniSetting.json
Normal file
82
src/lib/dexie/iniData/iniSetting.json
Normal file
@@ -0,0 +1,82 @@
|
||||
[{
|
||||
"id": 0,
|
||||
"theme": "light",
|
||||
"shortcut": true,
|
||||
"view": "picture",
|
||||
"externalPlayer": "",
|
||||
"searchGroup": "全站",
|
||||
"excludeRootClasses": true,
|
||||
"excludeR18Films": true,
|
||||
"forwardTimeInSec": 5,
|
||||
"waitingTimeInSec": 15,
|
||||
"starViewMode": "picture",
|
||||
"recommendationViewMode": "picture",
|
||||
"historyViewMode": "picture",
|
||||
"searchViewMode": "picture",
|
||||
"password": "",
|
||||
"proxy": {
|
||||
"type": "none",
|
||||
"scheme": "",
|
||||
"url": "",
|
||||
"port": ""
|
||||
},
|
||||
"allowPassWhenIptvCheck": true,
|
||||
"autocleanWhenIptvCheck": false,
|
||||
"autoChangeSourceWhenIptvStalling": true,
|
||||
"shortcutModified": false,
|
||||
"sitesDataURL": "https://gitee.com/cuiocean/ZY-Player-Resources/raw/main/Sites/Sites.json",
|
||||
"rootClassFilter": [
|
||||
"电影",
|
||||
"电影片",
|
||||
"电视剧",
|
||||
"连续剧",
|
||||
"综艺",
|
||||
"动漫"
|
||||
],
|
||||
"r18ClassFilter": [
|
||||
"伦理",
|
||||
"论理",
|
||||
"倫理",
|
||||
"福利",
|
||||
"激情",
|
||||
"理论",
|
||||
"写真",
|
||||
"情色",
|
||||
"美女",
|
||||
"街拍",
|
||||
"赤足",
|
||||
"性感",
|
||||
"里番",
|
||||
"VIP"
|
||||
],
|
||||
"classFilter": [
|
||||
"电影",
|
||||
"电影片",
|
||||
"电视剧",
|
||||
"连续剧",
|
||||
"综艺",
|
||||
"动漫",
|
||||
"伦理",
|
||||
"论理",
|
||||
"倫理",
|
||||
"福利",
|
||||
"激情",
|
||||
"理论",
|
||||
"写真",
|
||||
"情色",
|
||||
"美女",
|
||||
"街拍",
|
||||
"赤足",
|
||||
"性感",
|
||||
"里番",
|
||||
"VIP"
|
||||
],
|
||||
"restoreWindowPositionAndSize": false,
|
||||
"windowPositionAndSize": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"width": 1080,
|
||||
"height": 720
|
||||
},
|
||||
"pauseWhenMinimize": false
|
||||
}]
|
||||
112
src/lib/dexie/iniData/localKey.json
Normal file
112
src/lib/dexie/iniData/localKey.json
Normal file
@@ -0,0 +1,112 @@
|
||||
[
|
||||
{
|
||||
"name": "playAndPause",
|
||||
"desc": "播放或暂停",
|
||||
"key": "space"
|
||||
},
|
||||
{
|
||||
"name": "forward",
|
||||
"desc": "快进",
|
||||
"key": "right"
|
||||
},
|
||||
{
|
||||
"name": "back",
|
||||
"desc": "快退",
|
||||
"key": "left"
|
||||
},
|
||||
{
|
||||
"name": "volumeUp",
|
||||
"desc": "音量调高",
|
||||
"key": "up"
|
||||
},
|
||||
{
|
||||
"name": "volumeDown",
|
||||
"desc": "音量调低",
|
||||
"key": "down"
|
||||
},
|
||||
{
|
||||
"name": "mute",
|
||||
"desc": "静音",
|
||||
"key": "m"
|
||||
},
|
||||
{
|
||||
"name": "top",
|
||||
"desc": "置顶或退出置顶",
|
||||
"key": "t"
|
||||
},
|
||||
{
|
||||
"name": "fullscreen",
|
||||
"desc": "进入或退出全屏",
|
||||
"key": "f"
|
||||
},
|
||||
{
|
||||
"name": "escape",
|
||||
"desc": "退出全屏/精简模式",
|
||||
"key": "esc"
|
||||
},
|
||||
{
|
||||
"name": "next",
|
||||
"desc": "下一集",
|
||||
"key": "alt+right"
|
||||
},
|
||||
{
|
||||
"name": "prev",
|
||||
"desc": "上一集",
|
||||
"key": "alt+left"
|
||||
},
|
||||
{
|
||||
"name": "home",
|
||||
"desc": "跳到视频开始位置",
|
||||
"key": "home"
|
||||
},
|
||||
{
|
||||
"name": "end",
|
||||
"desc": "跳到视频结束位置",
|
||||
"key": "end"
|
||||
},
|
||||
{
|
||||
"name": "startPosition",
|
||||
"desc": "标记片头",
|
||||
"key": "ctrl+home"
|
||||
},
|
||||
{
|
||||
"name": "endPosition",
|
||||
"desc": "标记片尾",
|
||||
"key": "ctrl+end"
|
||||
},
|
||||
{
|
||||
"name": "clearPosition",
|
||||
"desc": "清除标记",
|
||||
"key": "ctrl+del"
|
||||
},
|
||||
{
|
||||
"name": "opacityUp",
|
||||
"desc": "透明度调高",
|
||||
"key": "alt+up"
|
||||
},
|
||||
{
|
||||
"name": "opacityDown",
|
||||
"desc": "透明度调低",
|
||||
"key": "alt+down"
|
||||
},
|
||||
{
|
||||
"name": "playbackRateUp",
|
||||
"desc": "播放倍速加快",
|
||||
"key": "pageup"
|
||||
},
|
||||
{
|
||||
"name": "playbackRateDown",
|
||||
"desc": "播放倍速减慢",
|
||||
"key": "pagedown"
|
||||
},
|
||||
{
|
||||
"name": "mini",
|
||||
"desc": "进入或退出mini模式",
|
||||
"key": "alt+m"
|
||||
},
|
||||
{
|
||||
"name": "resetMini",
|
||||
"desc": "重置mini窗口",
|
||||
"key": "ctrl+0"
|
||||
}
|
||||
]
|
||||
@@ -1,145 +1,3 @@
|
||||
const setting = [
|
||||
{
|
||||
id: 0,
|
||||
theme: 'light',
|
||||
shortcut: true,
|
||||
view: 'picture',
|
||||
externalPlayer: '',
|
||||
searchGroup: '全站',
|
||||
excludeRootClasses: true,
|
||||
excludeR18Films: true,
|
||||
forwardTimeInSec: 5,
|
||||
waitingTimeInSec: 15,
|
||||
starViewMode: 'picture',
|
||||
recommendationViewMode: 'picture',
|
||||
historyViewMode: 'picture',
|
||||
searchViewMode: 'picture',
|
||||
password: '',
|
||||
proxy: {
|
||||
type: 'none',
|
||||
scheme: '',
|
||||
url: '',
|
||||
port: ''
|
||||
},
|
||||
allowPassWhenIptvCheck: true,
|
||||
autocleanWhenIptvCheck: false,
|
||||
autoChangeSourceWhenIptvStalling: true
|
||||
}
|
||||
]
|
||||
|
||||
const localKey = [
|
||||
{
|
||||
name: 'playAndPause',
|
||||
desc: '播放或暂停',
|
||||
key: 'space'
|
||||
},
|
||||
{
|
||||
name: 'forward',
|
||||
desc: '快进',
|
||||
key: 'right'
|
||||
},
|
||||
{
|
||||
name: 'back',
|
||||
desc: '快退',
|
||||
key: 'left'
|
||||
},
|
||||
{
|
||||
name: 'volumeUp',
|
||||
desc: '音量调高',
|
||||
key: 'up'
|
||||
},
|
||||
{
|
||||
name: 'volumeDown',
|
||||
desc: '音量调低',
|
||||
key: 'down'
|
||||
},
|
||||
{
|
||||
name: 'mute',
|
||||
desc: '静音',
|
||||
key: 'm'
|
||||
},
|
||||
{
|
||||
name: 'top',
|
||||
desc: '置顶或退出置顶',
|
||||
key: 't'
|
||||
},
|
||||
{
|
||||
name: 'fullscreen',
|
||||
desc: '进入或退出全屏',
|
||||
key: 'f'
|
||||
},
|
||||
{
|
||||
name: 'escape',
|
||||
desc: '退出全屏/精简模式',
|
||||
key: 'esc'
|
||||
},
|
||||
{
|
||||
name: 'next',
|
||||
desc: '下一集',
|
||||
key: 'alt+right'
|
||||
},
|
||||
{
|
||||
name: 'prev',
|
||||
desc: '上一集',
|
||||
key: 'alt+left'
|
||||
},
|
||||
{
|
||||
name: 'home',
|
||||
desc: '跳到视频开始位置',
|
||||
key: 'home'
|
||||
},
|
||||
{
|
||||
name: 'end',
|
||||
desc: '跳到视频结束位置',
|
||||
key: 'end'
|
||||
},
|
||||
{
|
||||
name: 'startPosition',
|
||||
desc: '标记片头',
|
||||
key: 'ctrl+home'
|
||||
},
|
||||
{
|
||||
name: 'endPosition',
|
||||
desc: '标记片尾',
|
||||
key: 'ctrl+end'
|
||||
},
|
||||
{
|
||||
name: 'clearPosition',
|
||||
desc: '清除标记',
|
||||
key: 'ctrl+del'
|
||||
},
|
||||
{
|
||||
name: 'opacityUp',
|
||||
desc: '透明度调高',
|
||||
key: 'alt+up'
|
||||
},
|
||||
{
|
||||
name: 'opacityDown',
|
||||
desc: '透明度调低',
|
||||
key: 'alt+down'
|
||||
},
|
||||
{
|
||||
name: 'playbackRateUp',
|
||||
desc: '播放倍速加快',
|
||||
key: 'pageup'
|
||||
},
|
||||
{
|
||||
name: 'playbackRateDown',
|
||||
desc: '播放倍速减慢',
|
||||
key: 'pagedown'
|
||||
},
|
||||
{
|
||||
name: 'mini',
|
||||
desc: '进入或退出mini模式',
|
||||
key: 'alt+m'
|
||||
},
|
||||
{
|
||||
name: 'resetMini',
|
||||
desc: '重置mini窗口',
|
||||
key: 'ctrl+0'
|
||||
}
|
||||
]
|
||||
|
||||
const getSite = (key) => {
|
||||
for (const i of sites) {
|
||||
if (key === i.key) {
|
||||
@@ -151,11 +9,13 @@ const getSite = (key) => {
|
||||
const sites = require('./iniData/Sites.json')
|
||||
const iptv = require('./iniData/Iptv.json')
|
||||
const recommendations = require('./iniData/Recommendations.json')
|
||||
const iniSetting = require('./iniData/iniSetting.json')
|
||||
const localKey = require('./iniData/localKey.json')
|
||||
export {
|
||||
setting,
|
||||
sites,
|
||||
iptv,
|
||||
recommendations,
|
||||
iniSetting,
|
||||
localKey,
|
||||
getSite
|
||||
}
|
||||
|
||||
@@ -5,6 +5,12 @@ export default {
|
||||
async find () {
|
||||
return await setting.get({ id: 0 })
|
||||
},
|
||||
async bulkAdd (doc) {
|
||||
return await setting.bulkAdd(doc)
|
||||
},
|
||||
async add (doc) {
|
||||
return await setting.add(doc)
|
||||
},
|
||||
async update (docs) {
|
||||
return await setting.update(0, docs)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import Vue from 'vue'
|
||||
import { Message, Button, Table, TableColumn, Tag, Input, InputNumber, Dialog, Form, FormItem, Switch, Select, Option, Checkbox, Autocomplete, Col, Tree, Divider, Progress } from 'element-ui'
|
||||
import { Message, Button, Table, TableColumn, Tag, Input, InputNumber, Dialog, Form, FormItem, Switch, Select, Option, Checkbox, Autocomplete, Col, Tree, Divider, Progress, MessageBox } from 'element-ui'
|
||||
import Plugin from 'v-fit-columns'
|
||||
import { ButtonGroupPlugin } from 'bootstrap-vue'
|
||||
Vue.use(ButtonGroupPlugin)
|
||||
Vue.use(Button)
|
||||
Vue.use(Col)
|
||||
Vue.use(Table)
|
||||
@@ -21,3 +23,4 @@ Vue.use(Tree)
|
||||
Vue.use(Divider)
|
||||
Vue.use(Progress)
|
||||
Vue.prototype.$message = Message
|
||||
Vue.prototype.$msgbox = MessageBox
|
||||
|
||||
@@ -35,29 +35,29 @@ const onlineVideo = {
|
||||
},
|
||||
playVideoOnBde4 (videoName, videoIndex) {
|
||||
videoName = videoName.replace(/\s/g, '')
|
||||
var url = `https://bde4.com/search/${videoName}`
|
||||
const url = `https://bde4.com/search/${videoName}`
|
||||
axios.get(url).then(res => {
|
||||
const $ = cheerio.load(res.data)
|
||||
var e = $('div.search-list')
|
||||
var searchResult = $(e).find('div>div>div>div>a').toArray()
|
||||
const e = $('div.search-list')
|
||||
const searchResult = $(e).find('div>div>div>div>a').toArray()
|
||||
// 获取第一个搜索结果的视频链接
|
||||
var detailPageLink = $(searchResult[0]).attr('href')
|
||||
const detailPageLink = $(searchResult[0]).attr('href')
|
||||
// 获取第一个搜索结果的title
|
||||
var title = $(searchResult[0]).attr('title')
|
||||
const title = $(searchResult[0]).attr('title')
|
||||
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
||||
// 如果第一个搜索结果不符合,打开搜索页面
|
||||
open(url)
|
||||
} else {
|
||||
var detailPageFullLink = 'https://bde4.com/' + detailPageLink
|
||||
const detailPageFullLink = 'https://bde4.com/' + detailPageLink
|
||||
// 解析详情页面
|
||||
axios.get(detailPageFullLink).then(res => {
|
||||
const $ = cheerio.load(res.data)
|
||||
var e = $('div.info1')
|
||||
var videoList = $(e).find('a').toArray()
|
||||
var videoFullLink = detailPageFullLink
|
||||
const d = $('div.info1')
|
||||
const videoList = $(d).find('a').toArray()
|
||||
let videoFullLink = detailPageFullLink
|
||||
// 获取index视频链接
|
||||
if (videoIndex < videoList.length) {
|
||||
var indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||
const indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||
if (indexVideoLink.includes('.htm')) {
|
||||
videoFullLink = 'https://bde4.com' + indexVideoLink
|
||||
}
|
||||
@@ -69,31 +69,31 @@ const onlineVideo = {
|
||||
},
|
||||
playVideoOnK1080 (videoName, videoIndex) {
|
||||
videoName = videoName.replace(/\s/g, '')
|
||||
var url = `https://k1080.net/vodsearch123/-------------.html?wd=${videoName}&submit=`
|
||||
const url = `https://k1080.net/vodsearch123/-------------.html?wd=${videoName}&submit=`
|
||||
axios.get(url).then(res => {
|
||||
const $ = cheerio.load(res.data)
|
||||
var e = $('#searchList')
|
||||
var searchResult = $(e).find('li>div>a').toArray()
|
||||
const e = $('#searchList')
|
||||
const searchResult = $(e).find('li>div>a').toArray()
|
||||
// 获取第一个搜索结果的视频链接
|
||||
var detailPageLink = $(searchResult[0]).attr('href')
|
||||
const detailPageLink = $(searchResult[0]).attr('href')
|
||||
// 获取第一个搜索结果的title
|
||||
var title = $(searchResult[0]).attr('title')
|
||||
const title = $(searchResult[0]).attr('title')
|
||||
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
||||
// 如果第一个搜索结果不符合,打开搜索页面
|
||||
open(url)
|
||||
} else {
|
||||
// 解析详情页面
|
||||
var detailPageFullLink = 'https://k1080.net' + detailPageLink
|
||||
const detailPageFullLink = 'https://k1080.net' + detailPageLink
|
||||
axios.get(detailPageFullLink).then(res2 => {
|
||||
const $ = cheerio.load(res2.data)
|
||||
// 获取playlist1
|
||||
var e = $('#playlist1')
|
||||
const d = $('#playlist1')
|
||||
// 获取所有视频链接
|
||||
var videoList = $(e).find('div>ul>li>a').toArray()
|
||||
var videoFullLink = detailPageFullLink
|
||||
const videoList = $(d).find('div>ul>li>a').toArray()
|
||||
let videoFullLink = detailPageFullLink
|
||||
// 获取index视频链接
|
||||
if (videoIndex < videoList.length) {
|
||||
var indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||
const indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||
if (indexVideoLink.includes('.htm')) {
|
||||
videoFullLink = 'https://k1080.net' + indexVideoLink
|
||||
}
|
||||
@@ -105,31 +105,31 @@ const onlineVideo = {
|
||||
},
|
||||
playVideoOnSubaibai (videoName, videoIndex) {
|
||||
videoName = videoName.replace(/\s/g, '')
|
||||
var url = `https://www.subaibai.com/xssearch?q=${videoName}`
|
||||
const url = `https://www.subaibai.com/xssearch?q=${videoName}`
|
||||
axios.get(url).then(res => {
|
||||
const $ = cheerio.load(res.data)
|
||||
var e = $('div.search_list')
|
||||
var searchResult = $(e).find('div>ul>li>h3>a').toArray()
|
||||
const e = $('div.search_list')
|
||||
const searchResult = $(e).find('div>ul>li>h3>a').toArray()
|
||||
// 获取第一个搜索结果的视频链接
|
||||
var detailPageLink = $(searchResult[0]).attr('href')
|
||||
const detailPageLink = $(searchResult[0]).attr('href')
|
||||
// 获取第一个搜索结果的title
|
||||
var title = $(searchResult[0]).text()
|
||||
const title = $(searchResult[0]).text()
|
||||
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
||||
// 如果第一个搜索结果不符合,打开搜索页面
|
||||
open(url)
|
||||
} else {
|
||||
// 解析详情页面
|
||||
var detailPageFullLink = detailPageLink
|
||||
const detailPageFullLink = detailPageLink
|
||||
axios.get(detailPageFullLink).then(res2 => {
|
||||
const $ = cheerio.load(res2.data)
|
||||
// 获取playlist1
|
||||
var e = $('div.paly_list_btn')
|
||||
const d = $('div.paly_list_btn')
|
||||
// 获取所有视频链接
|
||||
var videoList = $(e).find('a').toArray()
|
||||
const videoList = $(d).find('a').toArray()
|
||||
// 获取index视频链接
|
||||
var videoFullLink = detailPageFullLink
|
||||
let videoFullLink = detailPageFullLink
|
||||
if (videoIndex < videoList.length) {
|
||||
var indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||
const indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||
if (indexVideoLink.includes('.htm')) {
|
||||
videoFullLink = indexVideoLink
|
||||
}
|
||||
@@ -141,31 +141,31 @@ const onlineVideo = {
|
||||
},
|
||||
playVideoOnYhdm (videoName, videoIndex) {
|
||||
videoName = videoName.replace(/\s/g, '')
|
||||
var url = `http://www.yhdm.tv/search/${videoName}`
|
||||
const url = `http://www.yhdm.tv/search/${videoName}`
|
||||
axios.get(url).then(res => {
|
||||
const $ = cheerio.load(res.data)
|
||||
var e = $('div.lpic')
|
||||
var searchResult = $(e).find('div>ul>li>h2>a').toArray()
|
||||
const e = $('div.lpic')
|
||||
const searchResult = $(e).find('div>ul>li>h2>a').toArray()
|
||||
// 获取第一个搜索结果的视频链接
|
||||
var detailPageLink = $(searchResult[0]).attr('href')
|
||||
const detailPageLink = $(searchResult[0]).attr('href')
|
||||
// 获取第一个搜索结果的title
|
||||
var title = $(searchResult[0]).attr('title')
|
||||
const title = $(searchResult[0]).attr('title')
|
||||
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
||||
// 如果第一个搜索结果不符合,打开搜索页面
|
||||
open(url)
|
||||
} else {
|
||||
// 解析详情页面
|
||||
var detailPageFullLink = 'http://www.yhdm.tv/' + detailPageLink
|
||||
const detailPageFullLink = 'http://www.yhdm.tv/' + detailPageLink
|
||||
axios.get(detailPageFullLink).then(res2 => {
|
||||
const $ = cheerio.load(res2.data)
|
||||
// 获取playlist1
|
||||
var e = $('div.movurl')
|
||||
const d = $('div.movurl')
|
||||
// 获取所有视频链接
|
||||
var videoList = $(e).find('div>ul>li>a').toArray()
|
||||
const videoList = $(d).find('div>ul>li>a').toArray()
|
||||
// 获取index视频链接
|
||||
var videoFullLink = detailPageFullLink
|
||||
let videoFullLink = detailPageFullLink
|
||||
if (videoIndex < videoList.length) {
|
||||
var indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||
const indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||
if (indexVideoLink.includes('.htm')) {
|
||||
videoFullLink = 'http://www.yhdm.tv/' + indexVideoLink
|
||||
}
|
||||
@@ -177,31 +177,31 @@ const onlineVideo = {
|
||||
},
|
||||
playVideoOndmdm2020 (videoName, videoIndex) {
|
||||
videoName = videoName.replace(/\s/g, '')
|
||||
var url = `http://www.dmdm2020.com/dongmansearch.html?wd=${videoName}&submit=`
|
||||
const url = `http://www.dmdm2020.com/dongmansearch.html?wd=${videoName}&submit=`
|
||||
axios.get(url).then(res => {
|
||||
const $ = cheerio.load(res.data)
|
||||
var e = $('#searchList')
|
||||
var searchResult = $(e).find('ul>li>div>h4>a').toArray()
|
||||
const e = $('#searchList')
|
||||
const searchResult = $(e).find('ul>li>div>h4>a').toArray()
|
||||
// 获取第一个搜索结果的视频链接
|
||||
var detailPageLink = $(searchResult[0]).attr('href')
|
||||
const detailPageLink = $(searchResult[0]).attr('href')
|
||||
// 获取第一个搜索结果的title
|
||||
var title = $(searchResult[0]).text()
|
||||
const title = $(searchResult[0]).text()
|
||||
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
||||
// 如果第一个搜索结果不符合,打开搜索页面
|
||||
open(url)
|
||||
} else {
|
||||
// 解析详情页面
|
||||
var detailPageFullLink = 'http://www.dmdm2020.com' + detailPageLink
|
||||
const detailPageFullLink = 'http://www.dmdm2020.com' + detailPageLink
|
||||
axios.get(detailPageFullLink).then(res2 => {
|
||||
const $ = cheerio.load(res2.data)
|
||||
// 获取playlist1
|
||||
var e = $('#playlist1')
|
||||
const d = $('#playlist1')
|
||||
// 获取所有视频链接
|
||||
var videoList = $(e).find('div>ul>li>a').toArray()
|
||||
const videoList = $(d).find('div>ul>li>a').toArray()
|
||||
// 获取index视频链接
|
||||
var videoFullLink = detailPageFullLink
|
||||
let videoFullLink = detailPageFullLink
|
||||
if (videoIndex < videoList.length) {
|
||||
var indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||
const indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||
if (indexVideoLink.includes('.htm')) {
|
||||
videoFullLink = 'http://www.dmdm2020.com' + indexVideoLink
|
||||
}
|
||||
@@ -213,31 +213,31 @@ const onlineVideo = {
|
||||
},
|
||||
playVideoOnSyrme (videoName, videoIndex) {
|
||||
videoName = videoName.replace(/\s/g, '')
|
||||
var url = `https://syrme.top/searchs?q=${videoName}`
|
||||
const url = `https://syrme.top/searchs?q=${videoName}`
|
||||
axios.get(url).then(res => {
|
||||
const $ = cheerio.load(res.data)
|
||||
var e = $('ul.MovieList')
|
||||
var searchResult = $(e).find('ul>li>article>a').toArray()
|
||||
const e = $('ul.MovieList')
|
||||
const searchResult = $(e).find('ul>li>article>a').toArray()
|
||||
// 获取第一个搜索结果的视频链接
|
||||
var detailPageLink = $(searchResult[0]).attr('href')
|
||||
const detailPageLink = $(searchResult[0]).attr('href')
|
||||
// 获取第一个搜索结果的title
|
||||
var title = $(searchResult[0]).find('a>h2').text()
|
||||
const title = $(searchResult[0]).find('a>h2').text()
|
||||
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
||||
// 如果第一个搜索结果不符合,打开搜索页面
|
||||
open(url)
|
||||
} else {
|
||||
// 解析详情页面
|
||||
var detailPageFullLink = 'https://syrme.top' + detailPageLink
|
||||
const detailPageFullLink = 'https://syrme.top' + detailPageLink
|
||||
axios.get(detailPageFullLink).then(res2 => {
|
||||
const $ = cheerio.load(res2.data)
|
||||
// 获取playlist1
|
||||
var e = $('#categories-2')
|
||||
const d = $('#categories-2')
|
||||
// 获取所有视频链接
|
||||
var videoList = $(e).find('div>ul>li>a').toArray()
|
||||
const videoList = $(d).find('div>ul>li>a').toArray()
|
||||
// 获取index视频链接
|
||||
var videoFullLink = detailPageFullLink
|
||||
let videoFullLink = detailPageFullLink
|
||||
if (videoIndex < videoList.length) {
|
||||
var indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||
const indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||
videoFullLink = 'https://syrme.top' + indexVideoLink
|
||||
}
|
||||
open(videoFullLink)
|
||||
@@ -247,31 +247,31 @@ const onlineVideo = {
|
||||
},
|
||||
playVideoOnJpysvip (videoName, videoIndex) {
|
||||
videoName = videoName.replace(/\s/g, '')
|
||||
var url = `https://www.jpysvip.net/vodsearch/-------------.html?wd=${videoName}&submit=`
|
||||
const url = `https://www.jpysvip.net/vodsearch/-------------.html?wd=${videoName}&submit=`
|
||||
axios.get(url).then(res => {
|
||||
const $ = cheerio.load(res.data)
|
||||
var e = $('#searchList')
|
||||
var searchResult = $(e).find('ul>li>div>a').toArray()
|
||||
const e = $('#searchList')
|
||||
const searchResult = $(e).find('ul>li>div>a').toArray()
|
||||
// 获取第一个搜索结果的视频链接
|
||||
var detailPageLink = $(searchResult[0]).attr('href')
|
||||
const detailPageLink = $(searchResult[0]).attr('href')
|
||||
// 获取第一个搜索结果的title
|
||||
var title = $(searchResult[0]).attr('title')
|
||||
const title = $(searchResult[0]).attr('title')
|
||||
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
||||
// 如果第一个搜索结果不符合,打开搜索页面
|
||||
open(url)
|
||||
} else {
|
||||
// 解析详情页面
|
||||
var detailPageFullLink = 'https://www.jpysvip.net' + detailPageLink
|
||||
const detailPageFullLink = 'https://www.jpysvip.net' + detailPageLink
|
||||
axios.get(detailPageFullLink).then(res2 => {
|
||||
const $ = cheerio.load(res2.data)
|
||||
// 获取playlist1
|
||||
var e = $('#playlist1')
|
||||
const d = $('#playlist1')
|
||||
// 获取所有视频链接
|
||||
var videoList = $(e).find('div>ul>li>a').toArray()
|
||||
const videoList = $(d).find('div>ul>li>a').toArray()
|
||||
// 获取index视频链接
|
||||
var videoFullLink = detailPageFullLink
|
||||
let videoFullLink = detailPageFullLink
|
||||
if (videoIndex < videoList.length) {
|
||||
var indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||
const indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||
videoFullLink = 'https://www.jpysvip.net/' + indexVideoLink
|
||||
}
|
||||
open(videoFullLink)
|
||||
@@ -281,31 +281,31 @@ const onlineVideo = {
|
||||
},
|
||||
playVideoOnXhkan (videoName, videoIndex) {
|
||||
videoName = videoName.replace(/\s/g, '')
|
||||
var url = `https://www.xhkan.com/vodsearch.html?wd=${videoName}&submit=`
|
||||
const url = `https://www.xhkan.com/vodsearch.html?wd=${videoName}&submit=`
|
||||
axios.get(url).then(res => {
|
||||
const $ = cheerio.load(res.data)
|
||||
var e = $('#searchList')
|
||||
var searchResult = $(e).find('ul>li>div>a').toArray()
|
||||
const e = $('#searchList')
|
||||
const searchResult = $(e).find('ul>li>div>a').toArray()
|
||||
// 获取第一个搜索结果的视频链接
|
||||
var detailPageLink = $(searchResult[0]).attr('href')
|
||||
const detailPageLink = $(searchResult[0]).attr('href')
|
||||
// 获取第一个搜索结果的title
|
||||
var title = $(searchResult[0]).attr('title')
|
||||
const title = $(searchResult[0]).attr('title')
|
||||
if (title === null || title === undefined || !title.replace(/\s/g, '').includes(videoName)) {
|
||||
// 如果第一个搜索结果不符合,打开搜索页面
|
||||
open(url)
|
||||
} else {
|
||||
// 解析详情页面
|
||||
var detailPageFullLink = detailPageLink
|
||||
const detailPageFullLink = detailPageLink
|
||||
axios.get(detailPageFullLink).then(res2 => {
|
||||
const $ = cheerio.load(res2.data)
|
||||
// 获取playlist1
|
||||
var e = $('#playlist1')
|
||||
const d = $('#playlist1')
|
||||
// 获取所有视频链接
|
||||
var videoList = $(e).find('div>ul>li>a').toArray()
|
||||
const videoList = $(d).find('div>ul>li>a').toArray()
|
||||
// 获取index视频链接
|
||||
var videoFullLink = detailPageFullLink
|
||||
let videoFullLink = detailPageFullLink
|
||||
if (videoIndex < videoList.length) {
|
||||
var indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||
const indexVideoLink = $(videoList[videoIndex]).attr('href')
|
||||
videoFullLink = indexVideoLink
|
||||
}
|
||||
open(videoFullLink)
|
||||
|
||||
@@ -111,13 +111,16 @@ const zy = {
|
||||
axios.get(url).then(res => {
|
||||
const data = res.data
|
||||
const json = parser.parse(data, this.xmlConfig)
|
||||
const jsondata = json.rss === undefined ? json : json.rss
|
||||
const jsondata = json?.rss === undefined ? json : json.rss
|
||||
if (!jsondata?.class || !jsondata?.list) resolve()
|
||||
const arr = []
|
||||
if (jsondata.class) {
|
||||
// 有些网站返回的分类名里会含有一串包含在{}内的字符串,移除掉
|
||||
const regex = /\{.*\}/i
|
||||
for (const i of jsondata.class.ty) {
|
||||
const j = {
|
||||
tid: i._id,
|
||||
name: i._t
|
||||
name: i._t.replace(regex, '')
|
||||
}
|
||||
arr.push(j)
|
||||
}
|
||||
@@ -216,16 +219,55 @@ const zy = {
|
||||
axios.get(url, { timeout: 3000 }).then(res => {
|
||||
const data = res.data
|
||||
const json = parser.parse(data, this.xmlConfig)
|
||||
const jsondata = json.rss === undefined ? json : json.rss
|
||||
const jsondata = json?.rss === undefined ? json : json.rss
|
||||
if (json && jsondata && jsondata.list) {
|
||||
let videoList = jsondata.list.video
|
||||
if (Object.prototype.toString.call(videoList) === '[object Object]') videoList = [].concat(videoList)
|
||||
videoList = videoList.filter(e => e.name.toLowerCase().includes(wd.toLowerCase()))
|
||||
if (videoList.length) {
|
||||
videoList = videoList?.filter(e => e.name.toLowerCase().includes(wd.toLowerCase()))
|
||||
if (videoList?.length) {
|
||||
resolve(videoList)
|
||||
} else {
|
||||
resolve()
|
||||
}
|
||||
} else {
|
||||
resolve()
|
||||
}
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
})
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 搜索资源详情
|
||||
* @param {*} key 资源网 key
|
||||
* @param {*} wd 搜索关键字
|
||||
* @returns
|
||||
*/
|
||||
searchFirstDetail (key, wd) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.getSite(key).then(res => {
|
||||
const site = res
|
||||
const url = `${site.api}?wd=${encodeURI(wd)}`
|
||||
axios.get(url, { timeout: 3000 }).then(res => {
|
||||
const data = res.data
|
||||
const json = parser.parse(data, this.xmlConfig)
|
||||
const jsondata = json?.rss === undefined ? json : json.rss
|
||||
if (json && jsondata && jsondata.list) {
|
||||
let videoList = jsondata.list.video
|
||||
if (Object.prototype.toString.call(videoList) === '[object Object]') videoList = [].concat(videoList)
|
||||
videoList = videoList?.filter(e => e.name.toLowerCase().includes(wd.toLowerCase()))
|
||||
if (videoList?.length) {
|
||||
this.detail(key, videoList[0].id).then(detailRes => {
|
||||
resolve(detailRes)
|
||||
})
|
||||
} else {
|
||||
resolve()
|
||||
}
|
||||
} else {
|
||||
resolve()
|
||||
}
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
@@ -248,8 +290,9 @@ const zy = {
|
||||
axios.get(url).then(res => {
|
||||
const data = res.data
|
||||
const json = parser.parse(data, this.xmlConfig)
|
||||
const jsondata = json.rss === undefined ? json : json.rss
|
||||
const videoList = jsondata.list.video
|
||||
const jsondata = json?.rss === undefined ? json : json.rss
|
||||
const videoList = jsondata?.list?.video
|
||||
if (!videoList) resolve()
|
||||
// Parse video lists
|
||||
let fullList = []
|
||||
let index = 0
|
||||
@@ -491,12 +534,40 @@ const zy = {
|
||||
})
|
||||
})
|
||||
},
|
||||
get7kParseURL () {
|
||||
/**
|
||||
* 获取豆瓣相关视频推荐列表
|
||||
* @param {*} name 视频名称
|
||||
* @param {*} year 视频年份
|
||||
* @returns 豆瓣相关视频推荐列表
|
||||
*/
|
||||
doubanRecommendations (name, year) {
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get('https://zy.7kjx.com/').then(res => {
|
||||
const $ = cheerio.load(res.data)
|
||||
const parseURL = $('body > div.container > div > div.stui-pannel > div.col-pd > p:contains("解析接口:")').first().find('a').text()
|
||||
resolve(parseURL)
|
||||
const nameToSearch = name.replace(/\s/g, '')
|
||||
const recommendations = []
|
||||
this.doubanLink(nameToSearch, year).then(link => {
|
||||
if (link.includes('https://www.douban.com/search')) {
|
||||
resolve(recommendations)
|
||||
} else {
|
||||
axios.get(link).then(response => {
|
||||
const $ = cheerio.load(response.data)
|
||||
$('div.recommendations-bd').find('div>dl>dd>a').each(function (index, element) {
|
||||
recommendations.push($(element).text())
|
||||
})
|
||||
resolve(recommendations)
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
})
|
||||
}
|
||||
}).catch(err => {
|
||||
reject(err)
|
||||
})
|
||||
})
|
||||
},
|
||||
getDefaultSites () {
|
||||
const url = 'https://gitee.com/cuiocean/ZY-Player-Resources/raw/main/Sites/Sites.json'
|
||||
return new Promise((resolve, reject) => {
|
||||
axios.get(url).then(res => {
|
||||
resolve(res.data)
|
||||
}).catch(err => { reject(err) })
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user