This commit is contained in:
Core 2022-07-31 12:38:19 +01:00
parent 4806db7b08
commit 41ff0e45ff

View file

@ -24,7 +24,24 @@ export default class playbackNotifications {
if (this._notification) {
this._notification.close();
}
fetch(a.artwork.url.replace('/{w}x{h}bb', '/512x512bb').replace('/2000x2000bb', '/35x35bb')).then(async blob => {
const artworkUrl = a.artwork.url.replace('/{w}x{h}bb', '/512x512bb').replace('/2000x2000bb', '/35x35bb')
console.log(artworkUrl)
const toastXML = `
<toast>
<visual>
<binding template="ToastGeneric">
<image placement="appLogoOverride" src="${artworkUrl}"/>
<text id="1">${a?.name.replace(/&/g, '&amp;')}</text>
<text id="2">${a?.artistName.replace(/&/g, '&amp;')} ${a?.albumName.replace(/&/g, '&amp;')}</text>
</binding>
</visual>
<actions>
<action content="Play/Pause" activationType="protocol" arguments="cider://playpause/"/>
<action content="Next" activationType="protocol" arguments="cider://nextitem/"/>
</actions>
</toast>`
console.log(toastXML)
fetch(artworkUrl).then(async blob => {
const artworkImage = nativeImage.createFromBuffer(Buffer.from(await blob.arrayBuffer()));
this._notification = new Notification({
title: a.name,
@ -42,19 +59,7 @@ export default class playbackNotifications {
'text': 'Next'
}
],
toastXml: `<toast>
<visual>
<binding template="ToastGeneric">
<text id="1">${a.name ?? ''}</text>
<text id="2">${a.artistName ?? ''} - ${a.albumName ?? ''
}</text>
</binding>
</visual>
<actions>
<action content="Play/Pause" activationType="protocol" arguments="cider://playpause/"/>
<action content="Next" activationType="protocol" arguments="cider://nextitem/"/>
</actions>
</toast>`
toastXml: toastXML
});
this._notification.on('click', (event: any) => {
this._utils.getWindow().show()