Merge branch 'main' of https://github.com/Apple-Music-Electron/Cider
This commit is contained in:
commit
3bf6db203d
3 changed files with 28 additions and 17 deletions
|
@ -129,6 +129,12 @@ const app = new Vue({
|
||||||
// Set profile name
|
// Set profile name
|
||||||
this.chrome.userinfo = await this.mkapi("personalSocialProfile", false, "")
|
this.chrome.userinfo = await this.mkapi("personalSocialProfile", false, "")
|
||||||
|
|
||||||
|
// load cached library
|
||||||
|
if(localStorage.getItem("librarySongs") != null) {
|
||||||
|
this.library.songs.listing = JSON.parse(localStorage.getItem("librarySongs"))
|
||||||
|
this.library.songs.displayListing = this.library.songs.listing
|
||||||
|
}
|
||||||
|
|
||||||
MusicKit.getInstance().videoContainerElement = document.getElementById("apple-music-video-player")
|
MusicKit.getInstance().videoContainerElement = document.getElementById("apple-music-video-player")
|
||||||
|
|
||||||
this.mk.addEventListener(MusicKit.Events.playbackTimeDidChange, (a) => {
|
this.mk.addEventListener(MusicKit.Events.playbackTimeDidChange, (a) => {
|
||||||
|
@ -792,6 +798,7 @@ const app = new Vue({
|
||||||
playMediaItemById(id, kind, isLibrary, raurl = "") {
|
playMediaItemById(id, kind, isLibrary, raurl = "") {
|
||||||
var truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
var truekind = (!kind.endsWith("s")) ? (kind + "s") : kind;
|
||||||
console.log(id, truekind, isLibrary)
|
console.log(id, truekind, isLibrary)
|
||||||
|
try {
|
||||||
if (truekind == "radioStations") {
|
if (truekind == "radioStations") {
|
||||||
this.mk.setStationQueue({url: raurl}).then(function (queue) {
|
this.mk.setStationQueue({url: raurl}).then(function (queue) {
|
||||||
MusicKit.getInstance().play()
|
MusicKit.getInstance().play()
|
||||||
|
@ -801,6 +808,10 @@ const app = new Vue({
|
||||||
MusicKit.getInstance().play()
|
MusicKit.getInstance().play()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}catch(err){
|
||||||
|
console.log(err)
|
||||||
|
this.playMediaItemById(id, kind, isLibrary, raurl)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
friendlyTypes(type) {
|
friendlyTypes(type) {
|
||||||
// use switch statement to return friendly name for media types "songs,artists,albums,playlists,music-videos,stations,apple-curators,curators"
|
// use switch statement to return friendly name for media types "songs,artists,albums,playlists,music-videos,stations,apple-curators,curators"
|
||||||
|
@ -872,17 +883,12 @@ const app = new Vue({
|
||||||
self.search.results = results
|
self.search.results = results
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
isInLibrary() {
|
isInLibrary(id) {
|
||||||
|
let self = this
|
||||||
// ugly code to check if current playback item is in library
|
// ugly code to check if current playback item is in library
|
||||||
var found = this.library.songs.listing.filter((item)=>{
|
var found = this.library.songs.listing.filter((item)=>{
|
||||||
var playingNow = "";
|
|
||||||
if(this.mk.nowPlayingItem["attributes"]){
|
|
||||||
if(this.mk.nowPlayingItem["attributes"]["playParams"] && this.mk.nowPlayingItem["attributes"]["playParams"]["catalogId"]){
|
|
||||||
playingNow = this.mk.nowPlayingItem["attributes"]["playParams"]["catalogId"];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(item["attributes"]){
|
if(item["attributes"]){
|
||||||
if(item["attributes"]["playParams"] && item["attributes"]["playParams"]["catalogId"] == playingNow){
|
if(item["attributes"]["playParams"] && (item["attributes"]["playParams"]["catalogId"] == id)){
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,6 +120,7 @@ body[loading] {
|
||||||
opacity: 0.70;
|
opacity: 0.70;
|
||||||
transition: opacity .25s var(--appleEase);
|
transition: opacity .25s var(--appleEase);
|
||||||
pointer-events: none;
|
pointer-events: none;
|
||||||
|
transform: translateZ(0px);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,11 @@
|
||||||
:max="mk.currentPlaybackDuration" :value="playerLCD.playbackDuration">
|
:max="mk.currentPlaybackDuration" :value="playerLCD.playbackDuration">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="actions">❤️</div>
|
<template v-if="mk.nowPlayingItem['attributes']['playParams']['id']">
|
||||||
|
<div class="actions" v-if="isInLibrary(mk.nowPlayingItem['attributes']['playParams']['id'])">❤️</div>
|
||||||
|
<div class="actions" v-else>🖤</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue