Compare commits

..

70 Commits

Author SHA1 Message Date
haiyangcui
69a397e24e Merge branch 'master' of https://github.com/Hunlongyu/ZY-Player 2020-08-30 13:48:01 +02:00
haiyangcui
c216352268 改进详情页面宽度 2020-08-30 13:47:39 +02:00
haiyangcui
89448d390f Install cheerio 2020-08-30 13:32:07 +02:00
haiyangcui
a853b02aa0 v2.4.5 2020-08-30 13:23:00 +02:00
haiyangcui
0443ce248f 重置源放最后 2020-08-30 13:03:51 +02:00
haiyangcui
8009c3197e 比较头两个搜索结果 2020-08-30 12:09:23 +02:00
haiyangcui
978d4e7181 2.4.5 2020-08-30 11:35:20 +02:00
haiyangcui
138b70263a 添加豆瓣评分 2020-08-30 11:34:22 +02:00
haiyangcui
7f48c91f97 如果没有选择本地播放器,选择在线播放 2020-08-30 10:49:08 +02:00
haiyangcui
7a494a54c0 详情页添加"豆瓣" 2020-08-30 10:28:57 +02:00
haiyangcui
97812af0fd v2.4.4 2020-08-28 15:00:56 +02:00
haiyangcui
490d7c963e 支持导入所有剧集到PotPlayer 2020-08-28 14:53:09 +02:00
haiyangcui
ed1afa2026 添加“重置源”功能 2020-08-28 12:58:16 +02:00
haiyangcui
7ef114d0e3 Change View的时候关闭Detail 2020-08-28 12:43:09 +02:00
haiyangcui
7f9b7fc2c8 Detail页面左边留出60px,侧边栏的宽度 2020-08-28 12:40:26 +02:00
haiyangcui
511820f873 修复历史记录里的下载功能 2020-08-27 17:01:22 +02:00
haiyangcui
af6dcb11bf 修复剧集的分享功能 2020-08-27 16:53:46 +02:00
haiyangcui
7ecad1ad8e 同步历史和收藏的operate buttons 2020-08-27 16:45:29 +02:00
haiyangcui
4d169f9d51 删除无用代码 2020-08-27 16:36:04 +02:00
haiyangcui
f3862e8385 格式化快捷键数据 2020-08-27 16:20:03 +02:00
haiyangcui
490d4839b7 没有更新的收藏跳过clearHasUpdateFlag 2020-08-27 16:06:46 +02:00
haiyangcui
033bcb3df7 修复下载功能 2020-08-27 15:52:56 +02:00
haiyangcui
df22efa980 导入收藏时不清空 2020-08-27 15:26:47 +02:00
haiyangcui
5428891297 删除多余信息 2020-08-27 15:14:03 +02:00
haiyangcui
bb3502774b 同步时更新收藏信息 2020-08-27 15:05:57 +02:00
haiyangcui
fa67ad03d2 恢复播放页面的收藏逻辑 2020-08-27 15:03:28 +02:00
haiyangcui
8a196ae52a 解决收藏项无法直接播放的bug 2020-08-27 14:48:11 +02:00
haiyangcui
ebfb681205 导出时先更新数据 2020-08-27 14:32:29 +02:00
haiyangcui
ba9f3246d2 Fix typo bug 2020-08-27 14:25:22 +02:00
haiyangcui
51cb181acd 改进播放页面的收藏功能 2020-08-27 13:58:05 +02:00
haiyangcui
33537638b0 更新version到2.4.3 2020-08-27 13:39:50 +02:00
haiyangcui
fa9f85a177 使用star.key 2020-08-27 13:33:21 +02:00
haiyangcui
3e1ecaac74 Fix bug in checkStar 2020-08-27 13:24:55 +02:00
haiyangcui
5cc9849e8a 导入收藏时升级数据格式 2020-08-27 13:13:45 +02:00
haiyangcui
e353b629c5 添加"更新收藏" 2020-08-27 13:08:41 +02:00
haiyangcui
4d20d5bc68 No need to record site info in star 2020-08-27 13:08:22 +02:00
haiyangcui
a921ce7adf 添加“清空所有收藏” 2020-08-27 12:39:54 +02:00
haiyangcui
1dd8d0dd24 在视图和列表里添加备注 2020-08-26 18:15:02 +02:00
haiyangcui
b90c359670 Reverse the list return by zy.list, to get video list from new to old 2020-08-26 16:24:57 +02:00
haiyangcui
27eb8c06ff 添加“最新”到class列表 2020-08-26 11:42:15 +02:00
haiyangcui
add2bedb61 v2.4.2 2020-08-25 16:59:59 +02:00
haiyangcui
3dc970e198 更新已存在的收藏 2020-08-25 15:54:07 +02:00
haiyangcui
3f2def4455 添加第三方播放器路径设置 2020-08-25 14:38:46 +02:00
haiyangcui
5b8d883af4 Format JSON string 2020-08-25 13:48:33 +02:00
haiyangcui
7113567475 可以使用PotPlayer打开视频 2020-08-25 00:31:34 +02:00
haiyangcui
e30da35e72 Import sites from file 2020-08-24 13:10:30 +02:00
haiyangcui
55b7396a2e Export sites to file 2020-08-24 12:54:31 +02:00
haiyangcui
83568fa499 No need to copy to clipboard 2020-08-24 12:32:51 +02:00
haiyangcui
838d3a64cd v2.4.1 2020-08-23 17:48:10 +02:00
haiyangcui
506be03e3e 从文件中导入收藏 2020-08-23 17:45:19 +02:00
haiyangcui
cfdb561473 加入取消操作识别 2020-08-23 15:03:47 +02:00
haiyangcui
ab2f45189f 导出收藏到文件 2020-08-23 14:33:59 +02:00
haiyangcui
f4b9a73b18 Simple favorites export import 2020-08-22 17:55:10 +02:00
haiyangcui
6f99d789f4 2.4.0 2020-08-22 16:08:38 +02:00
haiyangcui
e71090dad2 Wrap the items in Settings theme-box 2020-08-22 15:54:39 +02:00
haiyangcui
afe3351837 Add left margin to name 2020-08-22 15:35:28 +02:00
haiyangcui
5dc0613aeb 列表自适应 2020-08-22 15:06:10 +02:00
haiyangcui
1c6385ae6c 使用v-show显示隐藏class element,这样可以保持其占位 2020-08-22 10:58:47 +02:00
haiyangcui
88a95a8bfb 保存搜索选项设置 2020-08-22 00:20:18 +02:00
haiyangcui
951e6ffa37 更好的修复bug#183 2020-08-21 23:49:00 +02:00
haiyangcui
b83aed0a97 解决bug #183 2020-08-21 23:36:17 +02:00
haiyangcui
67ce537039 Add search style 2020-08-21 23:00:21 +02:00
haiyangcui
975562a66b Fix a bug in Detail.vue 2020-08-19 23:31:20 +02:00
haiyangcui
8e7015c9d6 调整"搜索所有资源"位置 2020-08-19 23:09:42 +02:00
haiyangcui
b841552dc7 转移"搜索所有资源"到设置页面 2020-08-19 18:07:37 +02:00
haiyangcui
0a9b939dc3 v2.3.8 2020-08-19 11:36:08 +02:00
haiyangcui
14ff252cce 定义--highlight-color 2020-08-19 08:30:18 +02:00
haiyangcui
afd016be93 取消“搜索所有资源”的边框 2020-08-18 23:00:05 +02:00
haiyangcui
9cd7f7d267 高亮有更新的收藏项 2020-08-18 22:51:03 +02:00
haiyangcui
8a76ec4e87 Null check on site 2020-08-18 17:39:39 +02:00
18 changed files with 553 additions and 209 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "zy",
"version": "2.3.7",
"version": "2.4.5",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
@@ -18,6 +18,8 @@
"main": "background.js",
"dependencies": {
"axios": "^0.19.2",
"cheerio": "^1.0.0-rc.3",
"child_process": "^1.0.2",
"core-js": "^3.6.5",
"cors": "^2.8.5",
"dexie": "^3.0.1",

View File

@@ -83,13 +83,15 @@
display: flex;
width: 200px;
height: 30px;
border-radius: 3px;
vertical-align: middle;
align-items: center;
.search-all-check-input{
cursor: pointer;
}
}
.zy-highlighted{
color: var(--highlight-color);
}
// table
.zy-table{
display: flex;
@@ -129,34 +131,36 @@
cursor: pointer;
span{
display: flex;
width: 180px;
font-size: 13px;
height: 50px;
line-height: 50px;
overflow: hidden;
margin-right: 5px;
&.name{
flex: 1;
padding-left: 15px;
overflow: hidden;
text-overflow: ellipsis;
min-width: 100px;
white-space: nowrap;
}
&.note{
width: 180px;
margin-left: 10px;
}
&.type{
width: 120px;
}
&.last{
width: 160px;
width: 10%;
}
&.time{
width: 60px;
width: 10%;
}
&.from{
width: 120px;
&.last{
width: 10%;
}
&.site{
width: 10%;
}
&.note{
width: 10%;
}
&.operate{
width: 170px;
.btn{
width: 40px;
}
}
}
}

View File

@@ -1,4 +1,6 @@
:root{
// general
--highlight-color: #38dd77;
// light
--l-c-0: #823aa0;
--l-c-1: #823aa011;

View File

@@ -34,12 +34,7 @@
}
.zy-checkbox{
color: var(--d-fc-1);
background-color: var(--d-bgc-1);
box-shadow: var(--d-bsc);
transition: all 0.3s cubic-bezier(.25,.8,.25,1);
&:hover{
box-shadow: var(--d-bsc-hover);
}
}
.zy-table{
color: var(--d-fc-2);
@@ -295,7 +290,7 @@
}
}
}
.view, .shortcut, .site{
.view, .search, .shortcut, .site{
.title{
color: var(--d-fc-1);
}

View File

@@ -34,12 +34,6 @@
}
.zy-checkbox{
color: var(--g-fc-1);
background-color: var(--g-bgc-1);
box-shadow: var(--g-bsc);
transition: all 0.3s cubic-bezier(.25,.8,.25,1);
&:hover{
box-shadow: var(--g-bsc-hover);
}
}
.zy-table{
color: var(--g-fc-2);
@@ -295,7 +289,7 @@
}
}
}
.view, .shortcut, .site{
.view, .search, .shortcut, .site{
.title{
color: var(--g-fc-1);
}

View File

@@ -34,12 +34,6 @@
}
.zy-checkbox{
color: var(--l-fc-1);
background-color: var(--l-bgc-1);
box-shadow: var(--l-bsc);
transition: all 0.3s cubic-bezier(.25,.8,.25,1);
&:hover{
box-shadow: var(--l-bsc-hover);
}
}
.zy-table{
color: var(--l-fc-2);
@@ -295,7 +289,7 @@
}
}
}
.view, .shortcut, .site{
.view, .search, .shortcut, .site{
.title{
color: var(--l-fc-1);
}

View File

@@ -34,12 +34,6 @@
}
.zy-checkbox{
color: var(--p-fc-1);
background-color: var(--p-bgc-1);
box-shadow: var(--p-bsc);
transition: all 0.3s cubic-bezier(.25,.8,.25,1);
&:hover{
box-shadow: var(--p-bsc-hover);
}
}
.zy-table{
color: var(--p-fc-2);
@@ -295,7 +289,7 @@
}
}
}
.view, .shortcut, .site{
.view, .search, .shortcut, .site{
.title{
color: var(--p-fc-1);
}

View File

@@ -54,12 +54,24 @@ export default {
set (val) {
this.SET_VIEW(val)
}
},
detail: {
get () {
return this.$store.getters.getDetail
},
set (val) {
this.SET_DETAIL(val)
}
}
},
methods: {
...mapMutations(['SET_VIEW']),
...mapMutations(['SET_VIEW', 'SET_DETAIL']),
changeView (e) {
this.view = e
// ChangeView 的时候关闭Detail页面
this.detail = {
show: false
}
}
}
}

View File

@@ -25,6 +25,7 @@
<div class="year" v-show="info.year">上映: {{info.year}}</div>
<div class="last" v-show="info.last">更新: {{info.last}}</div>
<div class="note" v-show="info.note">备注: {{info.note}}</div>
<div class="rate" v-show="info.rate">豆瓣评分: {{info.rate}}</div>
</div>
</div>
<div class="operate">
@@ -32,6 +33,7 @@
<span @click="starEvent">收藏</span>
<span @click="downloadEvent">下载</span>
<span @click="shareEvent">分享</span>
<span @click="doubanLinkEvent">豆瓣</span>
</div>
<div class="desc" v-show="info.des">{{info.des}}</div>
<div class="m3u8">
@@ -131,20 +133,21 @@ export default {
this.detail.show = false
},
starEvent () {
star.find({ key: this.detail.site.key, ids: this.info.id }).then(res => {
star.find({ key: this.detail.key, ids: this.info.id }).then(res => {
const docs = {
key: this.detail.key,
ids: this.info.id,
name: this.info.name,
type: this.info.type,
year: this.info.year,
last: this.info.last,
note: this.info.note
}
if (res) {
this.$message.info('已存在')
star.update(res.id, docs).then(res => {
this.$message.success('已存在,更新成功')
})
} else {
const docs = {
key: this.detail.site.key,
site: this.detail.site,
ids: this.info.id,
name: this.info.name,
type: this.info.type,
year: this.info.year,
last: this.info.last,
note: this.info.note
}
star.add(docs).then(res => {
this.$message.success('收藏成功')
})
@@ -155,7 +158,7 @@ export default {
},
downloadEvent () {
zy.download(this.detail.key, this.info.id).then(res => {
if (res) {
if (res && res.dl && res.dl.dd) {
const text = res.dl.dd._t
if (text) {
const list = text.split('#')
@@ -188,12 +191,72 @@ export default {
info: this.detail.info
}
},
doubanLinkEvent () {
const open = require('open')
const axios = require('axios')
const cheerio = require('cheerio')
const name = this.detail.info.name.trim()
// 豆瓣搜索链接
var doubanSearchLink = 'https://www.douban.com/search?q=' + name
var link = doubanSearchLink
axios.get(doubanSearchLink).then(res => {
const $ = cheerio.load(res.data)
// 比较第一和第二豆瓣搜索结果, 如果名字相符, 就打开该链接,否则打开搜索页面
var nameInDouban = $($('div.result')[0]).find('div>div>h3>a').first()
if (name.replace(/\s/g, '') === nameInDouban.text().replace(/\s/g, '')) {
link = nameInDouban.attr('href')
} else {
nameInDouban = $($('div.result')[1]).find('div>div>h3>a').first()
if (name.replace(/\s/g, '') === nameInDouban.text().replace(/\s/g, '')) {
link = nameInDouban.attr('href')
}
}
open(link)
})
},
getDoubanRate () {
const axios = require('axios')
const cheerio = require('cheerio')
const name = this.detail.info.name.trim()
// 豆瓣搜索链接
var doubanSearchLink = 'https://www.douban.com/search?q=' + name
axios.get(doubanSearchLink).then(res => {
const $ = cheerio.load(res.data)
// 比较第一和第二给豆瓣搜索结果, 看名字是否相符
var link = ''
var nameInDouban = $($('div.result')[0]).find('div>div>h3>a').first()
if (name.replace(/\s/g, '') === nameInDouban.text().replace(/\s/g, '')) {
link = nameInDouban.attr('href')
} else {
nameInDouban = $($('div.result')[1]).find('div>div>h3>a').first()
if (name.replace(/\s/g, '') === nameInDouban.text().replace(/\s/g, '')) {
link = nameInDouban.attr('href')
}
}
// 如果找到链接,就打开该链接获取评分
if (link) {
axios.get(link).then(response => {
const parsedHtml = cheerio.load(response.data)
var rating = parsedHtml('body').find('#interest_sectl').first().find('strong').first()
if (rating.text()) {
this.info.rate = rating.text()
} else {
this.info.rate = '暂无评分'
}
})
} else {
this.info.rate = '暂无评分'
}
})
},
getDetailInfo () {
const id = this.detail.info.ids || this.detail.info.id
zy.detail(this.detail.key, id).then(res => {
if (res) {
this.info = res
this.$set(this.info, 'rate', '')
this.m3u8Parse(res)
this.getDoubanRate()
this.loading = false
}
})
@@ -207,9 +270,10 @@ export default {
<style lang="scss" scoped>
.detail{
position: absolute;
left: 0;
left: 80px;
right: 20px;
bottom: 0;
width: 100%;
width: calc(100% - 100px);
height: calc(100% - 40px);
z-index: 888;
.detail-content{
@@ -264,6 +328,11 @@ export default {
font-size: 14px;
line-height: 26px;
}
.rate{
font-size: 16px;
line-height: 26px;
font-weight: bolder;
}
}
}
.operate{

View File

@@ -9,7 +9,7 @@
</ul>
</div>
</div>
<div class="zy-select" @mouseleave="show.classList = false" v-if="show.class">
<div class="zy-select" @mouseleave="show.classList = false" v-show="show.class">
<div class="vs-placeholder" @click="show.classList = true">{{type.name}}</div>
<div class="vs-options" v-show="show.classList">
<ul class="zy-scroll" style="max-height: 600px;">
@@ -26,9 +26,6 @@
</ul>
</div>
</div>
<div class="zy-checkbox">
<input type="checkbox" v-model="searchAllSites" class="search-all-check-input" > 搜索所有资源
</div>
</div>
<div class="body zy-scroll" infinite-wrapper>
<div class="body-box" v-show="!show.find">
@@ -52,6 +49,7 @@
<div class="name" @click="detailEvent(site, props.data)">{{props.data.name}}</div>
<div class="info">
<span>{{props.data.year}}</span>
<span>{{props.data.note}}</span>
<span>{{props.data.type}}</span>
</div>
</div>
@@ -67,6 +65,7 @@
<span class="name">{{i.name}}</span>
<span class="type">{{i.type}}</span>
<span class="time">{{i.year}}</span>
<span class="time">{{i.note}}</span>
<span class="last">{{i.last}}</span>
<span class="operate">
<span class="btn" @click.stop="playEvent(site, i)">播放</span>
@@ -84,12 +83,11 @@
<div class="body-box" v-show="show.find">
<div class="show-table">
<div class="zy-table">
<div class="tBody">
<div class="tBody zy-scroll">
<ul>
<li v-for="(i, j) in searchContents" :key="j" @click="detailEvent(i.site, i)">
<span class="name">{{i.name}}</span>
<span class="type">{{i.type}}</span>
<span class="time">{{i.year}}</span>
<span class="last">{{i.last}}</span>
<span class="site">{{i.site.name}}</span>
<span class="note">{{i.note}}</span>
@@ -138,8 +136,7 @@ export default {
infiniteId: +new Date(),
searchList: [],
searchTxt: '',
searchContents: [],
searchAllSites: false
searchContents: []
}
},
components: {
@@ -205,7 +202,7 @@ export default {
this.show.site = false
this.show.class = false
if (this.searchTxt.length > 0) {
this.searchEvent()
this.searchSingleSiteEvent(this.site, this.searchTxt)
} else {
this.classList = []
this.type = {}
@@ -231,10 +228,11 @@ export default {
return new Promise((resolve, reject) => {
const key = this.site.key
zy.class(key).then(res => {
this.classList = res.class
var allClass = [{ name: '最新', tid: 0 }].concat(res.class)
this.classList = allClass
this.show.class = true
this.pagecount = res.pagecount
this.type = { name: '最新', tid: 0 }
this.type = this.classList[0]
resolve(true)
}).catch(err => {
reject(err)
@@ -270,7 +268,8 @@ export default {
$state.complete()
}
if (type === '[object Array]') {
this.list.push(...res)
// zy.list 返回的是按时间从旧到新排列, 我门需要翻转为从新到旧
this.list.push(...res.reverse())
}
if (type === '[object Object]') {
this.list.push(res)
@@ -306,7 +305,6 @@ export default {
} else {
const docs = {
key: site.key,
site: site,
ids: e.id,
name: e.name,
type: e.type,
@@ -331,7 +329,7 @@ export default {
},
downloadEvent (site, e) {
zy.download(site.key, e.id).then(res => {
if (res.length > 0) {
if (res && res.length > 0 && res.dl && res.dl.dd) {
const text = res.dl.dd._t
if (text) {
const list = text.split('#')
@@ -426,12 +424,15 @@ export default {
}
},
searchEvent (wd) {
var sites = []
if (this.searchAllSites) {
sites.push(...this.sites)
if (this.setting.searchAllSites) {
this.searchAllSitesEvent(this.sites, wd)
} else {
sites.push(this.site)
this.searchSingleSiteEvent(this.site, wd)
}
},
searchSingleSiteEvent (site, wd) {
var sites = []
sites.push(this.site)
this.searchAllSitesEvent(sites, wd)
},
clearSearch () {

View File

@@ -9,11 +9,12 @@
<ul>
<li v-show="this.history.length === 0">无数据</li>
<li v-for="(i, j) in history" :key="j" @click="historyItemEvent(i)">
<span class="name" @click.stop="playEvent(i)">{{i.name}}</span>
<span class="name" @click.stop="detailEvent(i)">{{i.name}}</span>
<span class="site">{{getSiteName(i.site)}}</span>
<span class="index">{{i.index+1}}</span>
<span class="operate" style="width: 220px">
<span class="note">{{i.index+1}}</span>
<span class="operate">
<span class="btn" @click.stop="playEvent(i)">播放</span>
<span class="btn" @click.stop="shareEvent(i)">分享</span>
<span class="btn" @click.stop="downloadEvent(i)">下载</span>
<span class="btn" @click.stop="removeHistoryItem(i)">删除</span>
</span>
@@ -99,9 +100,16 @@ export default {
})
this.view = 'Play'
},
shareEvent (e) {
this.share = {
show: true,
key: e.site,
info: e
}
},
downloadEvent (e) {
zy.download(e.site, e.ids).then(res => {
if (res) {
if (res && res.dl && res.dl.dd) {
const text = res.dl.dd._t
if (text) {
const list = text.split('#')
@@ -116,14 +124,28 @@ export default {
this.$message.warning('没有查询到下载链接.')
}
} else {
const list = [...this.m3u8List]
let downloadUrl = ''
for (const i of list) {
const url = encodeURI(i.split('$')[1])
downloadUrl += (url + '\n')
}
clipboard.writeText(downloadUrl)
this.$message.success('『M3U8』格式的链接已复制, 快去下载吧!')
var m3u8List = {}
zy.detail(e.site, e.ids).then(res => {
const dd = res.dl.dd
const type = Object.prototype.toString.call(dd)
if (type === '[object Array]') {
for (const i of dd) {
if (i._flag.indexOf('m3u8') >= 0) {
m3u8List = i._t.split('#')
}
}
} else {
m3u8List = dd._t.split('#')
}
const list = [...m3u8List]
let downloadUrl = ''
for (const i of list) {
const url = encodeURI(i.split('$')[1])
downloadUrl += (url + '\n')
}
clipboard.writeText(downloadUrl)
this.$message.success('『M3U8』格式的链接已复制, 快去下载吧!')
})
}
})
},
@@ -144,7 +166,9 @@ export default {
},
getSiteName (key) {
var site = this.sites.find(e => e.key === key)
return site.name
if (site) {
return site.name
}
},
historyItemEvent (e) {
this.video = {

View File

@@ -3,6 +3,12 @@
<div class="box">
<div class="title">
<span v-if="this.right.list.length > 1"> {{(video.info.index + 1)}} </span>{{name}}
<span v-if="video.key" class="right" @click="playWithExternalPalyerEvent" title="使用第三方播放器">
<svg role="img" xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
<polygon points="20 8 20 20 4 20 4 8"></polygon>
<polyline stroke-linejoin="round" points="8 4 12 7.917 16 4"></polyline>
</svg>
</span>
<span v-if="video.key" class="right" @click="issueEvent" title="复制调试信息">
<svg t="1596338860607" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="3127" width="24" height="24">
<path d="M503.803829 63.578014c-247.050676 0-447.328072 200.277396-447.328072 447.327048 0 247.054769 200.277396 447.333188 447.328072 447.333188 247.054769 0 447.332165-200.278419 447.332165-447.333188C951.13497 263.85541 750.858598 63.578014 503.803829 63.578014L503.803829 63.578014zM503.803829 894.313336c-211.749682 0-383.408273-171.659615-383.408273-383.408273 0-211.749682 171.659615-383.40725 383.408273-383.40725 211.753775 0 383.412366 171.658591 383.412366 383.40725C887.216195 722.653721 715.557604 894.313336 503.803829 894.313336L503.803829 894.313336zM447.745069 255.897158l127.914298 0L575.659367 383.576095 447.745069 383.576095 447.745069 255.897158 447.745069 255.897158zM447.745069 425.470251l127.914298 0 0 342.058516L447.745069 767.528767 447.745069 425.470251 447.745069 425.470251zM447.745069 425.470251" p-id="3128"></path>
@@ -465,9 +471,8 @@ export default {
if (res) {
this.$message.info('已存在')
} else {
const docs = {
const doc = {
key: this.video.key,
site: this.video.site,
ids: info.id,
name: info.name,
type: info.type,
@@ -475,7 +480,7 @@ export default {
last: info.last,
note: info.note
}
star.add(docs).then(res => {
star.add(doc).then(starRes => {
this.$message.success('收藏成功')
this.isStar = true
})
@@ -535,8 +540,47 @@ export default {
clipboard.writeText(JSON.stringify(info, null, 4))
this.$message.success('视频信息复制成功')
},
playWithExternalPalyerEvent () {
this.fetchM3u8List().then(m3u8Arr => {
const fs = require('fs')
var externalPlayer = this.setting.externalPlayer
if (!fs.existsSync(externalPlayer)) {
this.$message.error('请设置第三方播放器路径')
// 在线播放该视频
var link = 'https://www.m3u8play.com/?play=' + m3u8Arr[this.video.info.index]
const open = require('open')
open(link)
} else {
var exec = require('child_process').execFile
var dplFile = this.generateDplFile(this.video.info.name, m3u8Arr, this.video.info.index)
exec(externalPlayer, [dplFile])
}
})
},
generateDplFile (fileName, m3u8Arr, index) {
const path = require('path')
const os = require('os')
const fs = require('fs')
var filePath = path.join(os.tmpdir(), fileName + '.dpl')
if (fs.existsSync(filePath)) {
fs.unlinkSync(filePath)
}
var str = 'DAUMPLAYLIST' + os.EOL
str += 'playname=' + m3u8Arr[index] + os.EOL
str += 'topindex=' + 0 + os.EOL
str += 'saveplaypos=' + index + os.EOL
var ind = 1
m3u8Arr.forEach(element => {
str += ind + '*title*第' + ind + '集' + os.EOL
str += ind + '*file*' + element + os.EOL
ind += 1
})
fs.writeFileSync(filePath, str)
return filePath
},
checkStar () {
star.find({ site: this.video.key, ids: this.video.info.id }).then(res => {
star.find({ key: this.video.key, ids: this.video.info.id }).then(res => {
if (res) {
this.isStar = true
} else {

View File

@@ -44,9 +44,49 @@
</div>
</div>
</div>
<div class='site'>
<div class="title">收藏管理</div>
<div class="site-box">
<div class="zy-select">
<div class="vs-placeholder vs-noAfter" @click="exportFavorites">导出</div>
</div>
<div class="zy-select">
<div class="vs-placeholder vs-noAfter" @click="importFavorites">导入</div>
</div>
<div class="zy-select">
<div class="vs-placeholder vs-noAfter" @click="clearFavorites">清空收藏</div>
</div>
</div>
</div>
<div class='search'>
<div class="title">搜索</div>
<div class="zy-checkbox">
<input type="checkbox" v-model="setting.searchAllSites" @change="updateSearchOption($event)"> 搜索所有资源
</div>
</div>
<div class='site'>
<div class="title">第三方播放</div>
<div class="site-box">
<div class="zy-select">
<div class="vs-placeholder vs-noAfter" @click="selectLocalPlayer">选择本地播放器</div>
</div>
<div class="zy-select">
<div class="vs-placeholder vs-noAfter" @click="resetLocalPlayer">重置</div>
</div>
</div>
</div>
<div class="site">
<div class="title">源管理</div>
<div class="site-box">
<div class="zy-select">
<div class="vs-placeholder vs-noAfter" @click="exportSites">导出</div>
</div>
<div class="zy-select">
<div class="vs-placeholder vs-noAfter" @click="importSites">导入</div>
</div>
<div class="zy-select">
<div class="vs-placeholder vs-noAfter" @click="resetSites">重置源</div>
</div>
<div class="zy-select" @mouseleave="show.site = false">
<div class="vs-placeholder" @click="show.site = true">默认源</div>
<div class="vs-options" v-show="show.site">
@@ -55,12 +95,6 @@
</ul>
</div>
</div>
<div class="zy-select">
<div class="vs-placeholder vs-noAfter" @click="expSites">导出</div>
</div>
<div class="zy-select">
<div class="vs-placeholder vs-noAfter" @click="impSites">导入</div>
</div>
<div class="zy-select">
<div class="vs-placeholder vs-noAfter" @click="openDoc('sites')">说明文档</div>
</div>
@@ -115,9 +149,11 @@
<script>
import { mapMutations } from 'vuex'
import pkg from '../../package.json'
import { setting, sites, shortcut } from '../lib/dexie'
import { setting, sites, shortcut, star } from '../lib/dexie'
import { shell, clipboard, remote } from 'electron'
import db from '../lib/dexie/dexie'
import { sites as defaultSites } from '../lib/dexie/initData'
import fs from 'fs'
export default {
name: 'setting',
data () {
@@ -125,6 +161,7 @@ export default {
pkg: pkg,
sitesList: [],
shortcutList: [],
favoritesList: [],
show: {
site: false,
shortcut: false,
@@ -135,7 +172,9 @@ export default {
site: '',
theme: '',
shortcut: true,
view: 'picture'
searchAllSites: true,
view: 'picture',
externalPlayer: ''
}
}
},
@@ -161,7 +200,9 @@ export default {
site: res.site,
theme: res.theme,
shortcut: res.shortcut,
view: res.view
view: res.view,
searchAllSites: res.searchAllSites,
externalPlayer: res.externalPlayer
}
this.setting = this.d
})
@@ -176,6 +217,11 @@ export default {
this.shortcutList = res
})
},
getFavorites () {
star.all().then(res => {
this.favoritesList = res
})
},
changeView (e) {
this.d.view = e
setting.update(this.d).then(res => {
@@ -192,24 +238,169 @@ export default {
this.show.site = false
})
},
expSites () {
const arr = [...this.sitesList]
const str = JSON.stringify(arr)
clipboard.writeText(str)
this.$message.success('已复制到剪贴板')
updateSearchOption (e) {
this.d.searchAllSites = this.setting.searchAllSites
setting.update(this.d).then(res => {
this.setting = this.d
})
},
impSites () {
const str = clipboard.readText()
const json = JSON.parse(str)
sites.clear().then(res => {
this.$message.info('已清空原数据')
sites.add(json).then(e => {
this.$message.success('已添加成功')
this.getSites()
this.d.site = json[0].key
exportFavorites () {
this.getFavorites()
const arr = [...this.favoritesList]
const str = JSON.stringify(arr, null, 4)
const options = {
filters: [
{ name: 'JSON file', extensions: ['json'] },
{ name: 'Normal text file', extensions: ['txt'] },
{ name: 'All types', extensions: ['*'] }
]
}
remote.dialog.showSaveDialog(options).then(result => {
if (!result.canceled) {
fs.writeFileSync(result.filePath, str)
this.$message.success('已保存成功')
}
}).catch(err => {
this.$message.error(err)
})
},
importFavorites () {
const options = {
filters: [
{ name: 'JSON file', extensions: ['json'] },
{ name: 'Normal text file', extensions: ['txt'] },
{ name: 'All types', extensions: ['*'] }
],
properties: ['openFile', 'multiSelections']
}
remote.dialog.showOpenDialog(options).then(result => {
if (!result.canceled) {
result.filePaths.forEach(file => {
var str = fs.readFileSync(file)
const json = JSON.parse(str)
star.bulkAdd(json).then(e => {
this.getFavorites()
})
this.upgradeFavorites()
})
this.$message.success('导入收藏成功')
}
}).catch(err => {
this.$message.error(err)
})
},
clearFavorites () {
star.clear().then(e => {
this.getFavorites()
this.$message.success('清空所有收藏成功')
})
},
upgradeFavorites () {
star.all().then(res => {
res.forEach(element => {
const docs = {
key: element.key,
ids: element.ids,
name: element.name,
type: element.type,
year: element.year,
last: element.last,
note: element.note
}
star.find({ key: element.key, ids: element.ids }).then(res => {
if (!res) {
star.add(docs)
}
})
})
this.getFavorites()
})
},
selectLocalPlayer () {
const options = {
filters: [
{ name: 'Executable file', extensions: ['exe'] },
{ name: 'All types', extensions: ['*'] }
],
properties: ['openFile']
}
remote.dialog.showOpenDialog(options).then(result => {
if (!result.canceled) {
var playerPath = result.filePaths[0].replace(/\\/g, '/')
this.$message.success('设定第三方播放器路径为:' + result.filePaths[0])
this.d.externalPlayer = playerPath
setting.update(this.d).then(res => {
this.setting = this.d
})
}
}).catch(err => {
this.$message.error(err)
})
},
resetLocalPlayer () {
this.d.externalPlayer = ''
setting.update(this.d).then(res => {
this.setting = this.d
this.$message.success('重置第三方播放器成功')
})
},
exportSites () {
this.getSites()
const arr = [...this.sitesList]
const str = JSON.stringify(arr, null, 4)
const options = {
filters: [
{ name: 'JSON file', extensions: ['json'] },
{ name: 'Normal text file', extensions: ['txt'] },
{ name: 'All types', extensions: ['*'] }
]
}
remote.dialog.showSaveDialog(options).then(result => {
if (!result.canceled) {
fs.writeFileSync(result.filePath, str)
this.$message.success('已保存成功')
}
}).catch(err => {
this.$message.error(err)
})
},
importSites () {
const options = {
filters: [
{ name: 'JSON file', extensions: ['json'] },
{ name: 'Normal text file', extensions: ['txt'] },
{ name: 'All types', extensions: ['*'] }
],
properties: ['openFile']
}
remote.dialog.showOpenDialog(options).then(result => {
if (!result.canceled) {
sites.clear()
result.filePaths.forEach(file => {
var str = fs.readFileSync(file)
const json = JSON.parse(str)
sites.add(json).then(e => {
this.getSites()
this.d.site = json[0].key
setting.update(this.d).then(res => {
this.setting = this.d
})
})
this.$message.success('导入成功')
}).catch(err => {
this.$message.error(err)
})
}
})
},
resetSites () {
sites.clear()
sites.add(defaultSites).then(e => {
this.getSites()
this.d.site = defaultSites[0].key
setting.update(this.d).then(res => {
this.setting = this.d
this.$message.success('重置源成功')
})
})
},
@@ -229,7 +420,7 @@ export default {
},
expShortcut () {
const arr = [...this.shortcutList]
const str = JSON.stringify(arr)
const str = JSON.stringify(arr, null, 4)
clipboard.writeText(str)
this.$message.success('已复制到剪贴板')
},
@@ -266,6 +457,7 @@ export default {
this.getSetting()
this.getSites()
this.getShortcut()
this.getFavorites()
}
}
</script>
@@ -313,6 +505,11 @@ export default {
}
}
}
.search{
width: 100%;
padding: 20px;
margin-top: 20px;
}
.site{
width: 100%;
padding: 20px;
@@ -341,6 +538,7 @@ export default {
margin-top: 20px;
.theme-box{
display: flex;
flex-wrap: wrap;
justify-content: flex-start;
margin-top: 10px;
.theme-item{

View File

@@ -70,16 +70,22 @@ export default {
zy.detail(this.share.key, id).then(res => {
if (res) {
this.pic = res.pic
const text = res.dl.dd
for (const i of text) {
if (i._flag.indexOf('m3u8') >= 0) {
const arr = i._t.split('#')
const url = arr[0].split('$')[1]
this.link = 'http://zyplayer.fun/player/player.html?url=' + url + '&title=' + this.share.info.name
var m3u8List = {}
const dd = res.dl.dd
const type = Object.prototype.toString.call(dd)
if (type === '[object Array]') {
for (const i of dd) {
if (i._flag.indexOf('m3u8') >= 0) {
m3u8List = i._t.split('#')
}
}
} else {
m3u8List = dd._t.split('#')
}
this.loading = false
const url = m3u8List[1]
this.link = 'http://zyplayer.fun/player/player.html?url=' + url + '&title=' + this.share.info.name
}
this.loading = false
})
},
picLoadEvent () {

View File

@@ -7,18 +7,18 @@
</div>
<div class="tBody zy-scroll">
<ul>
<li v-for="(i, j) in list" :key="j" @click="detailEvent(i)">
<li v-for="(i, j) in list" :key="j" @click="detailEvent(i)" :class="[i.hasUpdate ? 'zy-highlighted': '']">
<span class="name">{{i.name}}</span>
<span class="type">{{i.type}}</span>
<span class="time">{{i.year}}</span>
<span class="from">{{i.site.name}}</span>
<span class="site">{{getSiteName(i.key)}}</span>
<span class="note">{{i.note}}</span>
<span class="operate" style="width: 220px">
<span class="operate">
<span class="btn" @click.stop="playEvent(i)">播放</span>
<span class="btn" @click.stop="deleteEvent(i)">删除</span>
<span class="btn" @click.stop="shareEvent(i)">分享</span>
<span class="btn" @click.stop="updateEvent(i)">同步</span>
<span class="btn" @click.stop="downloadEvent(i)">下载</span>
<span class="btn" @click.stop="deleteEvent(i)">删除</span>
</span>
</li>
</ul>
@@ -29,14 +29,15 @@
</template>
<script>
import { mapMutations } from 'vuex'
import { star, history } from '../lib/dexie'
import { star, history, sites } from '../lib/dexie'
import zy from '../lib/site/tools'
const { clipboard } = require('electron')
export default {
name: 'star',
data () {
return {
list: []
list: [],
sites: []
}
},
computed: {
@@ -76,6 +77,7 @@ export default {
watch: {
view () {
this.getStarList()
this.getAllsites()
}
},
methods: {
@@ -83,21 +85,27 @@ export default {
detailEvent (e) {
this.detail = {
show: true,
key: e.site.key,
key: e.key,
info: {
id: e.ids,
name: e.name
}
}
if (e.hasUpdate) {
this.clearHasUpdateFlag(e)
}
},
playEvent (e) {
history.find({ site: e.site.key, ids: e.ids }).then(res => {
history.find({ site: e.key, ids: e.ids }).then(res => {
if (res) {
this.video = { key: res.site, info: { id: res.ids, name: res.name, index: res.index, site: e.site } }
this.video = { key: e.key, info: { id: res.ids, name: res.name, index: res.index } }
} else {
this.video = { key: e.site.key, info: { id: e.ids, name: e.name, index: 0, site: e.site } }
this.video = { key: e.key, info: { id: e.ids, name: e.name, index: 0 } }
}
})
if (e.hasUpdate) {
this.clearHasUpdateFlag(e)
}
this.view = 'Play'
},
deleteEvent (e) {
@@ -113,32 +121,43 @@ export default {
shareEvent (e) {
this.share = {
show: true,
key: e.site.key,
key: e.key,
info: e
}
},
clearHasUpdateFlag (e) {
star.find({ id: e.id }).then(res => {
res.hasUpdate = false
star.update(e.id, res)
this.getStarList()
})
},
updateEvent (e) {
zy.detail(e.site.key, e.ids).then(res => {
zy.detail(e.key, e.ids).then(res => {
var doc = {
key: e.key,
id: e.id,
ids: res.id,
last: res.last,
name: res.name,
type: res.type,
year: res.year,
note: res.note
}
if (e.last === res.last) {
var msg = `同步"${e.name}"成功, 未查询到更新。`
this.$message.info(msg)
doc.hasUpdate = false
star.update(e.id, doc).then(res => {
var msg = `同步"${e.name}"成功, 未查询到更新。`
this.$message.info(msg)
})
} else {
const doc = {
id: e.id,
ids: res.id,
last: res.last,
name: res.name,
site: e.site,
type: res.type,
year: res.year,
note: res.note
}
doc.hasUpdate = true
star.update(e.id, doc).then(res => {
var msg = `同步"${e.name}"成功, 检查到更新。`
this.$message.success(msg)
})
this.getStarList()
}
this.getStarList()
}).catch(err => {
var msg = `同步"${e.name}"失败, 请重试。`
this.$message.warning(msg, err)
@@ -150,8 +169,8 @@ export default {
})
},
downloadEvent (e) {
zy.download(e.site.key, e.ids).then(res => {
if (res) {
zy.download(e.key, e.ids).then(res => {
if (res && res.dl && res.dl.dd) {
const text = res.dl.dd._t
if (text) {
const list = text.split('#')
@@ -166,21 +185,46 @@ export default {
this.$message.warning('没有查询到下载链接.')
}
} else {
const list = [...this.m3u8List]
let downloadUrl = ''
for (const i of list) {
const url = encodeURI(i.split('$')[1])
downloadUrl += (url + '\n')
}
clipboard.writeText(downloadUrl)
this.$message.success('『M3U8』格式的链接已复制, 快去下载吧!')
var m3u8List = {}
zy.detail(e.key, e.ids).then(res => {
const dd = res.dl.dd
const type = Object.prototype.toString.call(dd)
if (type === '[object Array]') {
for (const i of dd) {
if (i._flag.indexOf('m3u8') >= 0) {
m3u8List = i._t.split('#')
}
}
} else {
m3u8List = dd._t.split('#')
}
const list = [...m3u8List]
let downloadUrl = ''
for (const i of list) {
const url = encodeURI(i.split('$')[1])
downloadUrl += (url + '\n')
}
clipboard.writeText(downloadUrl)
this.$message.success('『M3U8』格式的链接已复制, 快去下载吧!')
})
}
})
},
getSiteName (key) {
var site = this.sites.find(e => e.key === key)
if (site) {
return site.name
}
},
getStarList () {
star.all().then(res => {
this.list = res.reverse()
})
},
getAllsites () {
sites.all().then(res => {
this.sites = res
})
}
},
created () {

View File

@@ -9,5 +9,8 @@ export default {
},
async add (doc) {
return await sites.bulkAdd(doc)
},
async find (doc) {
return await sites.get(doc)
}
}

View File

@@ -4,6 +4,9 @@ export default {
async add (doc) {
return await star.add(doc)
},
async bulkAdd (doc) {
return await star.bulkAdd(doc)
},
async find (doc) {
return await star.get(doc)
},
@@ -15,5 +18,8 @@ export default {
},
async remove (id) {
return await star.delete(id)
},
async clear () {
return await star.clear()
}
}

View File

@@ -125,54 +125,6 @@ export default {
}
})
})
// zy.detail(res.site, res.ids).then(e => {
// this.name = e.name
// this.detail = e
// const dd = e.dl.dd
// const type = Object.prototype.toString.call(dd)
// let m3u8Txt = []
// if (type === '[object Array]') {
// for (const i of dd) {
// if (i._t.indexOf('m3u8') >= 0) {
// m3u8Txt = i._t.split('#')
// }
// }
// } else {
// m3u8Txt = dd._t.split('#')
// }
// const m3u8Arr = []
// for (const i of m3u8Txt) {
// const j = i.split('$')
// if (j.length > 1) {
// for (let m = 0; m < j.length; m++) {
// if (j[m].indexOf('m3u8') >= 0) {
// m3u8Arr.push(j[m])
// }
// }
// } else {
// m3u8Arr.push(j[0])
// }
// }
// this.m3u8Arr = m3u8Arr
// this.xg.src = m3u8Arr[res.index]
// if (res.time !== 0 || res.time !== '') {
// this.xg.play()
// this.xg.once('playing', () => {
// this.xg.currentTime = res.time
// })
// } else {
// this.xg.play()
// }
// this.videoPlaying()
// this.xg.once('ended', () => {
// if (m3u8Arr.length > 1 && (m3u8Arr.length - 1 > res.index)) {
// this.video.time = 0
// this.video.index++
// this.xg.src = m3u8Arr[this.video.index]
// this.xg.play()
// }
// })
// })
})
},
fetchM3u8List (info) {