fix playlist queueing

This commit is contained in:
vapormusic 2021-12-24 11:20:48 +07:00
parent b0084e386a
commit 579a479fce
3 changed files with 29 additions and 10 deletions

View file

@ -731,7 +731,7 @@ const app = new Vue({
console.log(kind, id, isLibrary) console.log(kind, id, isLibrary)
if (true) { if (true) {
if (kind == "playlist") { if (kind.includes("playlist") || kind.includes("album") || kind.toString().includes("apple-curator")) {
app.showingPlaylist = []; app.showingPlaylist = [];
} }
if (kind.toString().includes("apple-curator")) { if (kind.toString().includes("apple-curator")) {
@ -1732,7 +1732,14 @@ const app = new Vue({
} }
this.mk.clearQueue().then(function (_) { this.mk.clearQueue().then(function (_) {
app.mk.queue.append(query) app.mk.queue.append(query)
app.mk.changeToMediaAtIndex(childIndex) if (childIndex != -1) {
app.mk.changeToMediaAtIndex(childIndex)
} else if (item) {
app.mk.playNext({[item.attributes.playParams.kind ?? item.type]: item.attributes.playParams.id ?? item.id}).then(function(){
app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.id) ?? 1)
app.mk.play()
})
} else {app.mk.play()}
}) })
} else { } else {
try { try {
@ -1740,7 +1747,17 @@ const app = new Vue({
} catch (e) { } catch (e) {
} }
this.mk.setQueue({[truekind]: [id]}).then(function (queue) { this.mk.setQueue({[truekind]: [id]}).then(function (queue) {
app.mk.changeToMediaAtIndex(childIndex) if (item && ((queue._itemIDs[childIndex] != item.id))) {
childIndex = queue._itemIDs.indexOf(item.id)
}
if (childIndex != -1) {
app.mk.changeToMediaAtIndex(childIndex)
} else if (item) {
app.mk.playNext({[item.attributes.playParams.kind ?? item.type]: item.attributes.playParams.id ?? item.id}).then(function(){
app.mk.changeToMediaAtIndex(app.mk.queue._itemIDs.indexOf(item.id) ?? 1)
app.mk.play()
})
} else {app.mk.play()}
}) })
} }
} catch (err) { } catch (err) {

View file

@ -4,13 +4,13 @@
<div @click.self='app.routeView(item)' <div @click.self='app.routeView(item)'
class="cd-mediaitem-mvview"> class="cd-mediaitem-mvview">
<div class="title-browse-sp bold " @click='app.routeView(item)'> <div class="title-browse-sp bold " @click='app.routeView(item)'>
{{ badge ? badge.designBadge : ""}} {{ badge ? badge.designBadge : ' '}}
</div> </div>
<div class="title-browse-sp " > <div class="title-browse-sp " >
{{ (badge != null && badge.designTag != null) ? badge.designTag : (item.attributes.name ?? '') }} {{ (badge != null && badge.designTag != null) ? badge.designTag : (item.attributes.name ?? ' ') }}
</div> </div>
<div class="title-browse-sp semibold" v-if="!(badge != null && badge.designTag != null)" > <div class="title-browse-sp semibold" >
{{ (item.attributes.artistName ?? (item.attributes.curatorName ?? '')) }} {{ (item.attributes.artistName ?? (item.attributes.curatorName ?? ' ')) }}
</div> </div>
<div class="artwork"> <div class="artwork">
<mediaitem-artwork <mediaitem-artwork

View file

@ -98,11 +98,13 @@
} }
}, },
mounted: function () { mounted: function () {
this.isInLibrary() this.$nextTick(function () {
this.isInLibrary()
})
}, },
watch:{ watch:{
data : function() { data: function () {
this.isInLibrary() this.isInLibrary()
} }
}, },
methods: { methods: {