🎍 新增清理视频缓存功能

This commit is contained in:
Hunlongyu
2020-10-19 11:00:11 +08:00
parent 5f48f46cbc
commit c69eadbe3e
2 changed files with 17 additions and 1 deletions

View File

@@ -35,7 +35,7 @@
<ul>
<draggable v-model="iptvList" @change="listUpdatedEvent">
<transition-group>
<li v-for="i in iptvList" :key="i.name" @click.stop="playEvent(i)" v-show="containsearchTxt(i)">
<li v-for="(i, j) in iptvList" :key="j + i.name" @click.stop="playEvent(i)" v-show="containsearchTxt(i)">
<span class="name">{{i.name}}</span>
<span class="operate">
<span class="btn" @click.stop="moveToTopEvent(i)">置顶</span>

View File

@@ -42,6 +42,14 @@
</div>
</div>
</div>
<div class="shortcut">
<div class="title">缓存</div>
<div class="shortcut-box">
<div class="zy-select">
<div class="vs-placeholder vs-noAfter" @click="clearCache">清理视频缓存</div>
</div>
</div>
</div>
<div class="site">
<div class="title">定位时间设置</div>
<div class="zy-input">
@@ -228,6 +236,14 @@ export default {
this.updateSettingEvent()
this.show.view = false
},
async clearCache () {
const win = remote.getCurrentWindow()
const ses = win.webContents.session
const size = await ses.getCacheSize() / 1024 / 1024
const mb = size.toFixed(2)
await ses.clearCache()
this.$message.success(`清除缓存成功, 共清理 ${mb} MB`)
},
updateSettingEvent () {
this.editPlayerPath = false
this.setting = this.d