Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for time sync #10

Merged
merged 2 commits into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MMM-OnSpotify.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Module.register("MMM-OnSpotify", {
this.firstSongOnLoad = true;

///////////////////////
this.version = "2.1.0";
this.version = "2.2.0";
///////////////////////

this.displayUser =
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ Here you can select different update intervals based on module state. If your wi
| alwaysUseDefaultDeviceIcon | `false` | The device icon changes depending on the player type. If you don’t like this behaviour you can disable it |

# Lyrics
You can show lyrics in a realy stilysh way using [MMM-LiveLyrics](https://github.com/Fabrizz/MMM-LiveLyrics). See more in the repo.
You can show lyrics in a realy nice way using [MMM-LiveLyrics](https://github.com/Fabrizz/MMM-LiveLyrics). See more in the repo.

[<img alt="Livelyrics module" src=".github/content/banner-livelyrics.png" aling="left">](https://github.com/Fabrizz/MMM-LiveLyrics)

Expand Down
12 changes: 9 additions & 3 deletions utils/SpotifyDomBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,10 @@ class SpotifyDomBuilder {
progressbar.classList.add("progress");
const progress = document.createElement("div");
progress.id = "VSNO-TARGET-PROGRESS";
// As this has been changed to use a widht %, extracting
// attributtes and not parent width is better
progress.setAttribute("now", data.playerProgress);
progress.setAttribute("max", data.itemDuration);
progress.style.width = `${this.getPercentage(
data.playerProgress,
data.itemDuration,
Expand Down Expand Up @@ -390,12 +394,14 @@ class SpotifyDomBuilder {
)
this.setGlobalColors(this.selectImage(data.itemImages), data);

document.getElementById(
"VSNO-TARGET-PROGRESS",
).style.width = `${this.getPercentage(
const progress = document.getElementById("VSNO-TARGET-PROGRESS");
progress.style.width = `${this.getPercentage(
data.playerProgress,
data.itemDuration,
)}%`;
progress.setAttribute("now", data.playerProgress);
progress.setAttribute("max", data.itemDuration);

document.getElementById("VSNO-TARGET-TIME").innerText =
this.getSanitizedTime(data.playerProgress, data.itemDuration);

Expand Down