From 0dec967e71965a37b3eda662512465d7bd974347 Mon Sep 17 00:00:00 2001 From: Rick van Lieshout Date: Sun, 19 Dec 2021 13:18:39 +0100 Subject: [PATCH] Add album image to media module and discord (#86) Co-authored-by: Diogo Oliveira Co-authored-by: Marie --- src/preload.js | 2 +- src/scripts/discord.js | 1 + src/scripts/mediaInfo.js | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/preload.js b/src/preload.js index ee70a05..0087255 100644 --- a/src/preload.js +++ b/src/preload.js @@ -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"); } } diff --git a/src/scripts/discord.js b/src/scripts/discord.js index 668a010..7560c09 100644 --- a/src/scripts/discord.js +++ b/src/scripts/discord.js @@ -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 }], }, }); diff --git a/src/scripts/mediaInfo.js b/src/scripts/mediaInfo.js index 0964aa5..ecc37ee 100644 --- a/src/scripts/mediaInfo.js +++ b/src/scripts/mediaInfo.js @@ -7,7 +7,8 @@ const mediaInfo = { status: statuses.paused, url: "", current: "", - duration: "" + duration: "", + image: "tidal-hifi-icon" }; const mediaInfoModule = { mediaInfo, @@ -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); }; /**