Mergy Mergy (#1399)

* Added scripts to produce separated macOS builds for different architectures

* yeet cache

* bye cache

* remove local playback ( it's a mess)

* ok

* some raop fix

* local store

* Update pt_BR.json

* chore: Updated Lockfile

* fix versioning for main

* Revert "fix versioning for main"

This reverts commit 905514225c.

* chore: Prettified Code
 [ci skip]

* temp

* verbose tmp

* chore: Prettified Code
 [ci skip]

* ci trigger

* Fixed remove primary artist stuff for lastfm

* chore: Prettified Code
 [ci skip]

* Update zh_CN.json (#1394)

* Increased timeout for lastfm to 40 seconds

* Added token link without callback to settings

* Fix for #1390

* Automatic locale setting

* chore: Prettified Code
 [ci skip]

* window control hidden when native title bar on

* Change Album Search and Pagination Layout (#1397)

* Updated Dutch translations

Updated Dutch translations

* Update nl_NL.json

* chore: Prettified Code
 [ci skip]

* Update en_OWO.json

* chore: Prettified Code
 [ci skip]

Co-authored-by: Sherlock Luk <sherlockluk@outlook.com>
Co-authored-by: vapormusic <vietanhfat@gmail.com>
Co-authored-by: Core <core@coredev.uk>
Co-authored-by: Arth Attack <86346283+ArthAttack@users.noreply.github.com>
Co-authored-by: vapormusic <vapormusic@users.noreply.github.com>
Co-authored-by: yazninja <yazlesean@gmail.com>
Co-authored-by: Core <64542347+coredev-uk@users.noreply.github.com>
Co-authored-by: coredev-uk <coredev-uk@users.noreply.github.com>
Co-authored-by: 椎名アヤネ <53814845+sakura0224@users.noreply.github.com>
Co-authored-by: Monochromish <79590499+Monochromish@users.noreply.github.com>
Co-authored-by: Sjoerd69 <74538108+Sjoerd-69@users.noreply.github.com>
Co-authored-by: GamingLiamStudios <58615717+GamingLiamStudios@users.noreply.github.com>
Co-authored-by: GamingLiamStudios <GamingLiamStudios@users.noreply.github.com>
This commit is contained in:
cryptofyre 2022-08-29 23:49:33 -05:00 committed by GitHub
parent b4db2d1826
commit 88f7b9004d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 410 additions and 960 deletions

View file

@ -22,7 +22,7 @@ const MusicKitInterop = {
ipcRenderer.send("wsapi-updatePlaybackState", attributes);
// lastfm call
if (app.mk.currentPlaybackProgress === app.cfg.connectivity.lastfm.scrobble_after / 100) {
attributes.primaryArtist = app.cfg.connectivity.lastfm.enabled && app.cfg.connectivity.lastfm.remove_featured ? await this.fetchPrimaryArtist(attributes.artistName) : attributes.artistName;
attributes.primaryArtist = app.cfg.connectivity.lastfm.remove_featured ? await this.fetchPrimaryArtist() : attributes.artistName;
ipcRenderer.send("lastfm:scrobbleTrack", attributes);
}
});
@ -36,7 +36,7 @@ const MusicKitInterop = {
MusicKit.getInstance().addEventListener(MusicKit.Events.nowPlayingItemDidChange, async () => {
console.debug("[cider:preload] nowPlayingItemDidChange");
const attributes = MusicKitInterop.getAttributes();
attributes.primaryArtist = app.cfg.connectivity.lastfm.enabled && app.cfg.connectivity.lastfm.remove_featured ? await this.fetchPrimaryArtist(attributes.artistName) : attributes.artistName;
attributes.primaryArtist = app.cfg.connectivity.lastfm.remove_featured ? await this.fetchPrimaryArtist() : attributes.artistName;
if (MusicKitInterop.filterTrack(attributes, false, true)) {
global.ipcRenderer.send("nowPlayingItemDidChange", attributes);
@ -81,13 +81,31 @@ const MusicKitInterop = {
});
},
async fetchPrimaryArtist(artist) {
if (app.mk.nowPlayingItem?.relationships?.artists) {
const artist = await app.mk.api.artist(app.mk.nowPlayingItem.relationships.artists.data[0].id);
return artist.attributes.name;
} else {
return artist;
async fetchPrimaryArtist() {
const songID = app.mk.nowPlayingItem.attributes.playParams.catalogId || app.mk.nowPlayingItem.attributes.playParams.id;
const res = await MusicKit.getInstance().api.v3.music("/v1/catalog/" + MusicKit.getInstance().storefrontId + `/songs/${songID}`, {
include: {
songs: ["artists"],
},
});
if (!res || !res.data) {
console.warn("[cider:preload] fetchPrimaryArtist: no response");
return app.mk.nowPlayingItem.attributes.artistName;
}
if (!res.data.data.length) {
console.error(`[cider:preload] fetchPrimaryArtist: Unable to locate song with id of ${songID}`);
return app.mk.nowPlayingItem.attributes.artistName;
}
const songData = res.data.data[0];
const artistData = songData.relationships.artists.data;
if (artistData.length < 1) {
console.error(`[cider:preload] fetchPrimaryArtist: Unable to find artists related to the song with id of ${songID}`);
return app.mk.nowPlayingItem.attributes.artistName;
}
const primaryArtist = artistData[0];
return primaryArtist.attributes.name;
},
getAttributes: function () {