use am lyrics as def, fix airplay lyrics delay
This commit is contained in:
parent
c876369b88
commit
db285b8a8a
3 changed files with 15 additions and 14 deletions
|
@ -45,7 +45,7 @@
|
||||||
"@sentry/electron": "^4.0.2",
|
"@sentry/electron": "^4.0.2",
|
||||||
"@sentry/integrations": "^7.14.1",
|
"@sentry/integrations": "^7.14.1",
|
||||||
"adm-zip": "0.4.10",
|
"adm-zip": "0.4.10",
|
||||||
"airtunes2": "github:ciderapp/node_airtunes2",
|
"airtunes2": "git+https://github.com/ciderapp/node_airtunes2.git",
|
||||||
"castv2-client": "^1.2.0",
|
"castv2-client": "^1.2.0",
|
||||||
"chokidar": "^3.5.3",
|
"chokidar": "^3.5.3",
|
||||||
"discord-auto-rpc": "^1.0.17",
|
"discord-auto-rpc": "^1.0.17",
|
||||||
|
|
|
@ -3263,21 +3263,22 @@ const app = new Vue({
|
||||||
if (musicType === "musicVideo") {
|
if (musicType === "musicVideo") {
|
||||||
this.loadYTLyrics();
|
this.loadYTLyrics();
|
||||||
} else {
|
} else {
|
||||||
// if (app.cfg.lyrics.enable_mxm) {
|
// only load MXM lyrics if AM lyrics failed to load
|
||||||
this.loadMXM();
|
this.loadAMLyrics();
|
||||||
// } else {
|
|
||||||
// this.loadAMLyrics();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
loadAMLyrics() {
|
async loadAMLyrics() {
|
||||||
const songID = this.mk.nowPlayingItem != null ? this.mk.nowPlayingItem["_songId"] ?? this.mk.nowPlayingItem["songId"] ?? -1 : -1;
|
const songID = this.mk.nowPlayingItem != null ? this.mk.nowPlayingItem["_songId"] ?? this.mk.nowPlayingItem["songId"] ?? -1 : -1;
|
||||||
// this.getMXM( trackName, artistName, 'en', duration);
|
// this.getMXM( trackName, artistName, 'en', duration);
|
||||||
if (songID != -1) {
|
if (songID != -1) {
|
||||||
this.mk.api.v3.music(`v1/catalog/${this.mk.storefrontId}/songs/${songID}/lyrics`).then((response) => {
|
try{
|
||||||
|
let response = await this.mk.api.v3.music(`v1/catalog/${this.mk.storefrontId}/songs/${songID}/lyrics`)
|
||||||
this.lyricsMediaItem = response.data?.data[0]?.attributes["ttml"];
|
this.lyricsMediaItem = response.data?.data[0]?.attributes["ttml"];
|
||||||
this.parseTTML();
|
this.parseTTML();
|
||||||
});
|
} catch (_)
|
||||||
|
{this.loadMXM();};
|
||||||
|
} else {
|
||||||
|
this.loadMXM();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
addToLibrary(id) {
|
addToLibrary(id) {
|
||||||
|
|
|
@ -120,10 +120,10 @@
|
||||||
if (startTime != 9999999) this.app.seekTo(startTime, false);
|
if (startTime != 9999999) this.app.seekTo(startTime, false);
|
||||||
},
|
},
|
||||||
getActiveLyric() {
|
getActiveLyric() {
|
||||||
const delayfix = 0.1
|
const delayfix = app.activeCasts[0]?.hasOwnProperty('airplay2') ? -2.5 : 0.1
|
||||||
const prevLine = app.currentLyricsLine;
|
const prevLine = app.currentLyricsLine;
|
||||||
for (var i = 0; i < this.lyrics.length; i++) {
|
for (var i = 0; i < this.lyrics.length; i++) {
|
||||||
if (this.time + delayfix >= this.lyrics[i].startTime && this.time + delayfix <= app.lyrics[i].endTime) {
|
if ((this.time + delayfix >= this.lyrics[i].startTime) && (this.time + delayfix <= app.lyrics[i].endTime)) {
|
||||||
if (app.currentLyricsLine != i) {
|
if (app.currentLyricsLine != i) {
|
||||||
app.currentLyricsLine = i;
|
app.currentLyricsLine = i;
|
||||||
if (((app.lyricon && app.drawer.open) || app.appMode == 'fullscreen') && this.$refs.lyricsview.querySelector(`.lyric-line[line-index="${i}"]`)) {
|
if (((app.lyricon && app.drawer.open) || app.appMode == 'fullscreen') && this.$refs.lyricsview.querySelector(`.lyric-line[line-index="${i}"]`)) {
|
||||||
|
@ -172,7 +172,7 @@
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
}
|
}
|
||||||
for (child of this.$refs.lyricsview.querySelector(`.lyric-line[line-index="${app.currentLyricsLine}"]`).querySelectorAll(".verse")) {
|
for (child of this.$refs.lyricsview.querySelector(`.lyric-line[line-index="${app.currentLyricsLine}"]`).querySelectorAll(".verse")) {
|
||||||
if (this.time + 0.1 >= child.getAttribute("lyricstart") * 1 + child.getAttribute("versestart") * 1) {
|
if (this.time + delayfix >= child.getAttribute("lyricstart") * 1 + child.getAttribute("versestart") * 1) {
|
||||||
child.classList.add("verse-active");
|
child.classList.add("verse-active");
|
||||||
} else {
|
} else {
|
||||||
child.classList.remove("verse-active");
|
child.classList.remove("verse-active");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue