Merge branch 'ciderapp-develop' into develop

update
This commit is contained in:
Mefsaal 2022-05-08 00:51:26 -03:00
commit 81ac65f6bc
2 changed files with 35 additions and 21 deletions

View file

@ -1134,28 +1134,31 @@ const app = new Vue({
}
})
},
async refreshPlaylists(localOnly = false) {
async refreshPlaylists(localOnly = false, useCachedPlaylists = true) {
let self = this
let trackMap = this.cfg.advanced.playlistTrackMapping
let newListing = []
let trackMapping = {}
const cachedPlaylist = await CiderCache.getCache("library-playlists")
const cachedTrackMapping = await CiderCache.getCache("library-playlists-tracks")
if (cachedPlaylist) {
console.debug("using cached playlists")
this.playlists.listing = cachedPlaylist
self.sortPlaylists()
} else {
console.debug("playlist has no cache")
}
if (useCachedPlaylists) {
const cachedPlaylist = await CiderCache.getCache("library-playlists")
const cachedTrackMapping = await CiderCache.getCache("library-playlists-tracks")
if (cachedTrackMapping) {
console.debug("using cached track mapping")
this.playlists.trackMapping = cachedTrackMapping
}
if (localOnly) {
return
if (cachedPlaylist) {
console.debug("using cached playlists")
this.playlists.listing = cachedPlaylist
self.sortPlaylists()
} else {
console.debug("playlist has no cache")
}
if (cachedTrackMapping) {
console.debug("using cached track mapping")
this.playlists.trackMapping = cachedTrackMapping
}
if (localOnly) {
return
}
}
this.library.backgroundNotification.message = "Building playlist cache..."
@ -1260,7 +1263,7 @@ const app = new Vue({
}
}
).then(res => {
self.refreshPlaylists()
self.refreshPlaylists(false, false)
})
},
async editPlaylist(id, name = app.getLz('term.newPlaylist')) {
@ -1275,7 +1278,7 @@ const app = new Vue({
}
}
).then(res => {
self.refreshPlaylists()
self.refreshPlaylists(false, false)
})
},
copyToClipboard(str) {
@ -1319,7 +1322,7 @@ const app = new Vue({
})
self.sortPlaylists()
setTimeout(() => {
app.refreshPlaylists()
app.refreshPlaylists(false, false)
}, 8000)
})
},
@ -1336,6 +1339,9 @@ const app = new Vue({
if (found) {
self.playlists.listing.splice(self.playlists.listing.indexOf(found), 1)
}
setTimeout(() => {
app.refreshPlaylists(false, false);
}, 8000);
})
}
},
@ -2581,7 +2587,7 @@ const app = new Vue({
})
self.sortPlaylists()
setTimeout(() => {
app.refreshPlaylists()
app.refreshPlaylists(false, false)
}, 13000)
})
},

View file

@ -1,6 +1,6 @@
<script type="text/x-template" id="lyrics-view">
<div ref="lyricsview" class="md-body lyric-body">
<template v-if="lyrics && lyrics != [] && lyrics.length > 0">
<template v-if="lyrics && lyrics != [] && lyrics.length > 0 && !qqInstrumental(lyrics)">
<template v-for="(lyric, index) in lyrics" v-if="lyric && lyric.line && lyric.line != 'lrcInstrumental'">
<h3 class="lyric-line" @click="seekTo(lyric.startTime)" :class="{unsynced : lyric.startTime == 9999999}"
v-bind:line-index="index.toString()">
@ -183,6 +183,14 @@
}
else return []
},
qqInstrumental(lyrics) {
for(lyric of lyrics){
if (lyric.line.includes("纯音乐") && lyric.line.includes("欣赏")){
return true
}
}
return false
},
checkIfScrollIsStatic : setInterval(() => {
try {
if (position === this.$refs.lyricsview.scrollTop) {