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(lyrics): switch to wg:// protocol #1587

Merged
merged 4 commits into from
Apr 18, 2022
Merged
Show file tree
Hide file tree
Changes from 2 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
8 changes: 4 additions & 4 deletions CustomApps/lyrics-plus/Providers.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Providers = {
copyright: null,
};

const baseURL = "hm://lyrics/v1/track/";
const baseURL = "wg://lyrics/v1/track/";
const id = info.uri.split(":")[2];
let body;
try {
Expand All @@ -20,7 +20,7 @@ const Providers = {

const lines = body.lines;
if (!lines || !lines.length) {
return { error: "No lyric", uri: info.uri };
return { error: "No lyrics", uri: info.uri };
}

if (typeof lines[0].time === "number") {
Expand Down Expand Up @@ -58,7 +58,7 @@ const Providers = {
throw "";
}
} catch {
result.error = "No lyric";
result.error = "No lyrics";
return result;
}

Expand Down Expand Up @@ -90,7 +90,7 @@ const Providers = {
try {
list = await ProviderNetease.findLyrics(info);
} catch {
result.error = "No lyric";
result.error = "No lyrics";
return result;
}

Expand Down
14 changes: 7 additions & 7 deletions Extensions/popupLyrics.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @ts-check
// @ts-nocheck
rxri marked this conversation as resolved.
Show resolved Hide resolved

afonsojramos marked this conversation as resolved.
Show resolved Hide resolved
// NAME: Popup Lyrics
// AUTHOR: khanhas
Expand Down Expand Up @@ -81,13 +81,13 @@ function PopupLyrics() {

class LyricProviders {
static async fetchSpotify(info) {
const baseURL = "hm://lyrics/v1/track/";
const baseURL = "wg://lyrics/v1/track/";
const id = info.uri.split(":")[2];
const body = await CosmosAsync.get(baseURL + id);

const lines = body.lines;
if (!lines || !lines.length || typeof lines[0].time !== "number") {
return { error: "No lyric" };
return { error: "No lyrics" };
}

const lyrics = lines.map((a) => ({
Expand Down Expand Up @@ -154,7 +154,7 @@ function PopupLyrics() {
}));
return { lyrics };
} else {
return { error: "No lyric" };
return { error: "No lyrics" };
}
} catch (err) {
return { error: err.message };
Expand Down Expand Up @@ -185,7 +185,7 @@ function PopupLyrics() {
let lyricStr = meta.lrc;

if (!lyricStr || !lyricStr.lyric) {
return { error: "No lyric" };
return { error: "No lyrics" };
}
lyricStr = lyricStr.lyric;

Expand Down Expand Up @@ -401,7 +401,7 @@ function PopupLyrics() {
}
}
if (error || !sharedData.lyrics) {
sharedData = { error: "No lyric" };
sharedData = { error: "No lyrics" };
}
}

Expand Down Expand Up @@ -719,7 +719,7 @@ function PopupLyrics() {
drawText(lyricCtx, error, "red");
}
} else if (!lyrics) {
drawText(lyricCtx, "No lyric");
drawText(lyricCtx, "No lyrics");
} else if (audio.duration && lyrics.length) {
renderLyrics(lyricCtx, lyrics, audio.currentTime);
} else if (!audio.duration || lyrics.length === 0) {
Expand Down