copy songs from playlist

This commit is contained in:
Jason Chen 2022-06-17 11:25:39 -07:00
parent ae7d74e239
commit d6b51d4673

View file

@ -294,6 +294,11 @@
this.isInLibrary()
})
},
beforeMount() {
if( window.location.hash.includes("playlist") ) {
window.addEventListener('keydown', this.getCopiedPlayListSongs);
}
},
watch: {
data: {
handler: function () {
@ -780,6 +785,20 @@
if (data && typeof data.views != "undefined") return "";
return "d-none";
},
async getCopiedPlayListSongs(event) {
if( event.ctrlKey && event.keyCode === 67 ) {
let urls = [];
app.selectedMediaItems.forEach(item => {
this.app.mk.api.v3.music(`/v1/me/library/songs/${item.id}`).then((response) => {
this.app.mk.api.v3.music(`/v1/catalog/${app.mk.storefrontId}/songs/${response.data.data[0].attributes.playParams.catalogId}`).then((response1) => {
urls.push(response1.data.data[0].attributes.url)
navigator.clipboard.writeText(urls)
})
})
})
notyf.success(app.getLz('term.share.success'))
}
},
search() {
let filtered = [];