Merge branch 'main' into enhancement/lastfm

This commit is contained in:
Core 2022-06-28 11:37:05 +01:00
commit 2c9bf5eb7e
No known key found for this signature in database
GPG key ID: FE9BF1B547F8F3C6
22 changed files with 3066 additions and 1057 deletions

View file

@ -168,6 +168,7 @@ const app = new Vue({
location: "",
info: {}
},
windowState: "normal",
desiredPageTransition: "wpfade_transform",
hideUserInfo: ipcRenderer.sendSync("is-dev") || false,
artworkReady: false,
@ -217,6 +218,7 @@ const app = new Vue({
castMenu: false,
moreInfo: false,
airplayPW: false,
settings: false
},
socialBadges: {
badgeMap: {},
@ -853,6 +855,10 @@ const app = new Vue({
this.library.localsongs = data;
})
ipcRenderer.on('window-state-changed', (event, data) => {
this.chrome.windowState = data
})
ipcRenderer.on('SoundCheckTag', (event, tag) => {
// let replaygain = self.parseSCTagToRG(tag)
try {
@ -926,10 +932,10 @@ const app = new Vue({
app.mk.nowPlayingItem.attributes.name = e.title
app.mk.nowPlayingItem.attributes.artistName = e.performer
app.mk.nowPlayingItem.attributes.albumName = e.album
if(e.links[1]) {
if (e.links[1]) {
app.currentArtUrl = e.links[1].url
app.currentArtUrlRaw = e.links[1].url
}else{
} else {
app.currentArtUrl = e.links[0].url
app.currentArtUrlRaw = e.links[0].url
}
@ -942,7 +948,7 @@ const app = new Vue({
self.$refs.queue.updateQueue();
}
this.currentSongInfo = a
if (this.currentSongInfo === null || this.currentSongInfo === undefined) {return;} // EVIL EMPTY OBJECTS BE GONE
if (this.currentSongInfo === null || this.currentSongInfo === undefined) { return; } // EVIL EMPTY OBJECTS BE GONE
console.debug("songinfo: " + JSON.stringify(a))
if (app.cfg.advanced.AudioContext) {
@ -957,7 +963,7 @@ const app = new Vue({
} catch (e) {
localStorage.setItem("playingBitrate", "256")
}
if (!app.cfg.audio.normalization) {CiderAudio.hierarchical_loading();}
if (!app.cfg.audio.normalization) { CiderAudio.hierarchical_loading(); }
}
@ -974,16 +980,16 @@ const app = new Vue({
previewURL = response.data.data[0].attributes.previews[0].url
if (previewURL)
console.debug("[Cider][MaikiwiSoundCheck] previewURL response.data.data[0].attributes.previews[0].url: " + previewURL)
ipcRenderer.send('getPreviewURL', previewURL)
ipcRenderer.send('getPreviewURL', previewURL)
})
} else {
if (previewURL)
console.debug("[Cider][MaikiwiSoundCheck] previewURL in app.mk.nowPlayingItem.previewURL: " + previewURL)
ipcRenderer.send('getPreviewURL', previewURL)
ipcRenderer.send('getPreviewURL', previewURL)
}
} catch (e) {
if (e instanceof TypeError === false) {console.debug("[Cider][MaikiwiSoundCheck] normalizer function err: " + e)}
if (e instanceof TypeError === false) { console.debug("[Cider][MaikiwiSoundCheck] normalizer function err: " + e) }
}
}
@ -1298,7 +1304,7 @@ const app = new Vue({
results.forEach(result => {
try {
if (result.relationships?.catalog?.data[0]?.attributes?.inFavorites) {
if(!favs.includes(result.relationships?.catalog?.data[0].id)) {
if (!favs.includes(result.relationships?.catalog?.data[0].id)) {
favs.push(result.relationships?.catalog?.data[0].id)
}
}
@ -1311,8 +1317,8 @@ const app = new Vue({
return favs
},
async setArtistFavorite(id, val = true) {
if(val) {
if(!app.cfg.home.followedArtists.includes(id)) {
if (val) {
if (!app.cfg.home.followedArtists.includes(id)) {
app.cfg.home.followedArtists.push(id)
}
await app.mk.api.v3.music(`/v1/me/favorites`, {
@ -1325,8 +1331,8 @@ const app = new Vue({
method: "POST"
}
})
}else{
if(app.cfg.home.followedArtists.includes(id)) {
} else {
if (app.cfg.home.followedArtists.includes(id)) {
app.cfg.home.followedArtists.splice(app.cfg.home.followedArtists.indexOf(id), 1)
}
await app.mk.api.v3.music(`/v1/me/favorites`, {
@ -1458,7 +1464,7 @@ const app = new Vue({
},
{
name: app.getLz("action.refresh"),
action: ()=>{
action: () => {
this.refreshPlaylists()
}
}
@ -2016,8 +2022,8 @@ const app = new Vue({
async getNowPlayingItemDetailed(target) {
let nowPlayingItem = JSON.parse(JSON.stringify(this.mk.nowPlayingItem))
if(nowPlayingItem.type === "radioStation" && app.mk.nowPlayingItem.id !== -1) {
nowPlayingItem.playParams = {kind: "songs"}
if (nowPlayingItem.type === "radioStation" && app.mk.nowPlayingItem.id !== -1) {
nowPlayingItem.playParams = { kind: "songs" }
nowPlayingItem.attributes.playParams.catalogId = app.mk.nowPlayingItem.id
nowPlayingItem.attributes.playParams.id = app.mk.nowPlayingItem.id
nowPlayingItem.id = app.mk.nowPlayingItem.id
@ -4329,7 +4335,7 @@ const app = new Vue({
"name": app.getLz('settings.option.audio.audioLab'),
"hidden": true,
"action": function () {
app.appRoute('audiolabs')
app.openSettingsPage('audiolabs')
}
},
]
@ -4355,7 +4361,7 @@ const app = new Vue({
try {
// if its a radio station, then change the attributes to match a song
const nowPlayingItem = JSON.parse(JSON.stringify(this.mk.nowPlayingItem))
if(nowPlayingItem.type == "radioStation" && app.mk.nowPlayingItem.id != -1) {
if (nowPlayingItem.type == "radioStation" && app.mk.nowPlayingItem.id != -1) {
nowPlayingItem.type = "song"
nowPlayingItem.attributes.playParams.catalogId = app.mk.nowPlayingItem.id
nowPlayingItem.attributes.playParams.id = app.mk.nowPlayingItem.id
@ -4388,6 +4394,32 @@ const app = new Vue({
}
},
openSettingsPage(page) {
switch (page) {
case "general":
this.$store.state.pageState.settings.currentTabIndex = 0
break;
case "audio":
this.$store.state.pageState.settings.currentTabIndex = 1
break;
case "audiolabs":
this.$store.state.pageState.settings.currentTabIndex = 2
break;
case "visual":
this.$store.state.pageState.settings.currentTabIndex = 3
break;
case "lyrics":
this.$store.state.pageState.settings.currentTabIndex = 4
break;
case "connectivity":
this.$store.state.pageState.settings.currentTabIndex = 5
break;
case "advanced":
this.$store.state.pageState.settings.currentTabIndex = 6
break;
}
app.modals.settings = true
},
fullscreen(flag) {
this.fullscreenState = flag;
if (flag) {
@ -4615,7 +4647,7 @@ const app = new Vue({
label: app.getLz('dialog.ok'),
},
cancel: {
label: app.getLz('dialog.cancel'),
label: app.getLz('dialog.cancel'),
},
},
callback: function (result) {