Skip to content

Commit

Permalink
fix: fullAppDisplay album info & background (#1543)
Browse files Browse the repository at this point in the history
* temporary solution for #1538

As the hermes protocol is broken `1.1.81` onwards, this can "fix" the issue. Now the lyrics-plus background will always match spotify lyrics background.

Maybe, in the future, there is a way to restore the old colorextractor.

* updated `fullAppDisplay` to source album info 1.1.81 onwards

Again, hermes protocol gone, fixed album info

* removed obsolete code from `fullAppDisplay` and `lyrics-plus`

Co-authored-by: Afonso Jorge Ramos <[email protected]>
  • Loading branch information
huhridge and afonsojramos authored Mar 25, 2022
1 parent 761ab44 commit 55c0eb0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions CustomApps/lyrics-plus/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,10 @@ class LyricsContainer extends react.Component {
async fetchColors(uri) {
let prominent = 0;
try {
const colors = await CosmosAsync.get(`hm://colorextractor/v1/extract-presets?uri=${uri}&format=json`);
prominent = colors.entries[0].color_swatches[4].color;
const colors = await CosmosAsync.get(
`https://spclient.wg.spotify.com/color-lyrics/v2/track/${uri.split(":")[2]}/?format=json&vocalRemoval=false&market=from_token`
);
prominent = colors.colors.background;
} catch {
prominent = 0;
}
Expand Down
5 changes: 3 additions & 2 deletions Extensions/fullAppDisplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,10 @@ body.video-full-screen.video-full-screen--hide-ui {

async getAlbumDate(uri) {
const id = uri.replace("spotify:album:", "");
const albumInfo = await Spicetify.CosmosAsync.get(`hm://album/v1/album-app/album/${id}/desktop`);

const albumDate = new Date(albumInfo.year, (albumInfo.month || 1) - 1, albumInfo.day || 0);
const albumInfo = await Spicetify.CosmosAsync.get(`https://api.spotify.com/v1/albums/${id}`);

const albumDate = new Date(albumInfo.release_date);
const recentDate = new Date();
recentDate.setMonth(recentDate.getMonth() - 6);
return albumDate.toLocaleString("default", albumDate > recentDate ? { year: "numeric", month: "short" } : { year: "numeric" });
Expand Down

0 comments on commit 55c0eb0

Please sign in to comment.