Update SpotifyControls.plugin.js

This commit is contained in:
Mirco Wittrien 2021-04-09 17:15:09 +02:00
parent f93fbcb9cf
commit 5fc7e677ed
1 changed files with 12 additions and 6 deletions

View File

@ -2,7 +2,7 @@
* @name SpotifyControls * @name SpotifyControls
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 1.1.2 * @version 1.1.3
* @description Adds a Control Panel while listening to Spotify on a connected Account * @description Adds a Control Panel while listening to Spotify on a connected Account
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@ -17,12 +17,12 @@ module.exports = (_ => {
"info": { "info": {
"name": "SpotifyControls", "name": "SpotifyControls",
"author": "DevilBro", "author": "DevilBro",
"version": "1.1.2", "version": "1.1.3",
"description": "Adds a Control Panel while listening to Spotify on a connected Account" "description": "Adds a Control Panel while listening to Spotify on a connected Account"
}, },
"changeLog": { "changeLog": {
"fixed": { "improved": {
"Works again": "" "No Cover": "Added a placeholder for song without a cover image"
} }
} }
}; };
@ -136,6 +136,7 @@ module.exports = (_ => {
if (!lastSong) return null; if (!lastSong) return null;
currentVolume = socketDevice.device.volume_percent; currentVolume = socketDevice.device.volume_percent;
let playerSize = this.props.maximized ? "big" : "small"; let playerSize = this.props.maximized ? "big" : "small";
let coverSrc = BDFDB.LibraryModules.AssetUtils.getAssetImage(lastSong.application_id, lastSong.assets.large_image);
return BDFDB.ReactUtils.createElement("div", { return BDFDB.ReactUtils.createElement("div", {
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN._spotifycontrolscontainer, this.props.maximized && BDFDB.disCN._spotifycontrolscontainermaximized, this.props.timeline && BDFDB.disCN._spotifycontrolscontainerwithtimeline), className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN._spotifycontrolscontainer, this.props.maximized && BDFDB.disCN._spotifycontrolscontainermaximized, this.props.timeline && BDFDB.disCN._spotifycontrolscontainerwithtimeline),
children: [ children: [
@ -154,9 +155,14 @@ module.exports = (_ => {
else BDFDB.ReactUtils.forceUpdate(this); else BDFDB.ReactUtils.forceUpdate(this);
}, },
children: [ children: [
BDFDB.ReactUtils.createElement("img", { coverSrc ? BDFDB.ReactUtils.createElement("img", {
className: BDFDB.disCN._spotifycontrolscover, className: BDFDB.disCN._spotifycontrolscover,
src: BDFDB.LibraryModules.AssetUtils.getAssetImage(lastSong.application_id, lastSong.assets.large_image) src: coverSrc
}) : BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCN._spotifycontrolscover,
width: "100%",
height: "100%",
name: BDFDB.LibraryComponents.SvgIcon.Names.QUESTIONMARK_ACTIVITY
}), }),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCN._spotifycontrolscovermaximizer, className: BDFDB.disCN._spotifycontrolscovermaximizer,