Skip to content

Commit

Permalink
Prefer remote lyrics
Browse files Browse the repository at this point in the history
  • Loading branch information
mantou132 committed Aug 23, 2020
1 parent f8e4edc commit 099c258
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/page/share-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,24 +102,25 @@ export class SharedData {
this.list = list;
const remoteData = await getSong(this.query);
const reviewed = options['use-unreviewed-lyrics'] === 'on' || remoteData?.reviewed;
if (remoteData?.user === options.cid && remoteData.lyric) {
const isSelf = remoteData?.user === options.cid;
if (isSelf && remoteData?.lyric) {
this.lyrics = parseLyrics(remoteData.lyric, parseLyricsOptions);
sendEvent(options.cid, events.useRemoteLyrics);
} else if (isSelf && remoteData?.neteaseID) {
this.id = remoteData.neteaseID;
this.aId = this.id;
await this.updateLyrics();
} else if (reviewed && remoteData?.lyric) {
this.lyrics = parseLyrics(remoteData.lyric, parseLyricsOptions);
sendEvent(options.cid, events.useRemoteLyrics);
} else {
this.id =
(remoteData?.user === options.cid || reviewed
? remoteData?.neteaseID || id
: id || remoteData?.neteaseID) || 0;
this.id = (reviewed ? remoteData?.neteaseID || id : id || remoteData?.neteaseID) || 0;
this.aId = this.id;
await this.updateLyrics();
}
if (this.lyrics && this.id !== id) {
sendEvent(options.cid, events.useRemoteMatch);
}
// User-made lyrics need to be reviewed
if (!this.lyrics && remoteData?.lyric && reviewed) {
this.lyrics = parseLyrics(remoteData.lyric, parseLyricsOptions);
sendEvent(options.cid, events.useRemoteLyrics);
}
if (startTime) {
const ev = (performance.now() - startTime).toFixed();
sendEvent(options.cid, { ev, ...events.loadLyrics }, { cd1: this.cd1 });
Expand Down

0 comments on commit 099c258

Please sign in to comment.