Skip to content

Commit

Permalink
Add album image to media module and discord (#86)
Browse files Browse the repository at this point in the history
Co-authored-by: Diogo Oliveira <[email protected]>
Co-authored-by: Marie <[email protected]>
  • Loading branch information
3 people authored Dec 19, 2021
1 parent c940d09 commit 0dec967
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const elements = {
if (figure) {
const mediaElement = figure.querySelector(this["image"]);
if (mediaElement) {
return mediaElement.src;
return mediaElement.src.replace("80x80", "640x640");
}
}

Expand Down
1 change: 1 addition & 0 deletions src/scripts/discord.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const observer = (event, arg) => {
: "unknown artist(s)",
startTimestamp: parseInt(now),
endTimestamp: parseInt(remaining),
largeImageKey: mediaInfoModule.mediaInfo.image,
buttons: [{ label: "Play on Tidal", url: mediaInfoModule.mediaInfo.url }],
},
});
Expand Down
4 changes: 3 additions & 1 deletion src/scripts/mediaInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const mediaInfo = {
status: statuses.paused,
url: "",
current: "",
duration: ""
duration: "",
image: "tidal-hifi-icon"
};
const mediaInfoModule = {
mediaInfo,
Expand All @@ -24,6 +25,7 @@ mediaInfoModule.update = function (arg) {
mediaInfo.status = propOrDefault(arg.status);
mediaInfo.current = propOrDefault(arg.current);
mediaInfo.duration = propOrDefault(arg.duration);
mediaInfo.image = propOrDefault(arg.image);
};

/**
Expand Down

0 comments on commit 0dec967

Please sign in to comment.