Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.
C
fix: an imported LRC file stays the song's lyrics with word timing preferred (#119)
My-Name-Is-Jeff4c653dc68033
diff --git a/docs/tweaks.md b/docs/tweaks.mdindex ff3ec1a7..da403cc2 100644--- a/docs/tweaks.md+++ b/docs/tweaks.md@@ -152,7 +152,8 @@ Shared:source won, Spotify's own included: matched by the line's folded text, as copies kept in place of thelines (KaraokeSource.x), which the view picks up. The walk stops at the first timed answer; withPrefer word-by-word timing (off by default, read by every walk) it asks on to the first source with- words timed and else keeps the finest it saw, the highest among equals (settled()). The redesigned+ words timed and else keeps the finest it saw, the highest among equals (settled()); a timed imported+ LRC above every source as finely timed ends it too (#111). The redesignedplayer's ⋯ has Lyrics Source (LyricsPick.m): every source asked at once for the song playing, a pickshown at once and kept in memory until Spotify quits, and Automatic putting back what the order choseLyricsTranslation/ a song's lines translated from the lyrics' corner menu, for the lines no source translated, threediff --git a/harness/lyrics-walk/README.md b/harness/lyrics-walk/README.mdindex 68314064..62bd2865 100644--- a/harness/lyrics-walk/README.md+++ b/harness/lyrics-walk/README.md@@ -12,6 +12,8 @@ redesigned player's ⋯ (`LyricsPick.m`, issue #67). Every source is answered bythe pick is dropped;- a pick made while a walk runs stands, and when that walk began on an earlier pick, Automatic puts backwhat the track showed before any pick and the next request walks the order again;+- with Prefer word-by-word timing, a timed imported LRC first in the order ends the walk (#111), and one below+ a source timed as finely does not;- Automatic for a track whose record is gone (40 picks later) asks for the track again as on a first play,and never drops the lines shown for none.diff --git a/harness/lyrics-walk/check.m b/harness/lyrics-walk/check.mindex 81aadc7f..3ef7dafa 100644--- a/harness/lyrics-walk/check.m+++ b/harness/lyrics-walk/check.m@@ -9,6 +9,7 @@#import "Settings/SGSourcesPage.h"#import "Settings/SGPageStyle.h"#import "Core/SGFlagForce.h"+#import "Core/SGPrefs.h"#import "Headers/SPTPlayer.h"#define CHECK(cond) do { if (!(cond)) { fprintf(stderr, "FAILED line %d: %s\n", __LINE__, #cond); exit(1); } } while (0)@@ -228,6 +229,24 @@ int main(int argc, char **argv) {CHECK(!SGLyricsChosenSource(@"t3") && [sg_askedAgain isEqualToArray:@[@"t3"]] && !sg_shown[@"t3"]);CHECK(!fetch(@"t3"));+ // Prefer word-by-word timing (#111): a timed imported file first in the order ends the walk, though it is+ // timed by the line. Below a source timed as finely, it does not: the first in the order among equals stays.+ sg_answers[@"importedLRC"] = lines(YES);+ sg_answers[@"musixmatch"] = lines(YES);+ sg_answers[@"lrclib"] = lines(YES);+ [NSUserDefaults.standardUserDefaults setVolatileDomain:@{SGKeyLyricsProviders: @[@"importedLRC", @"musixmatch", @"lrclib"],+ SGKeyLyricsPreferWordTiming: @YES} forName:NSArgumentDomain];+ SGPrefsChanged();+ [sg_asked removeAllObjects];+ got = fetch(@"t4");+ CHECK([sg_asked isEqualToArray:@[@"importedLRC:t4"]] && [got.provider isEqualToString:@"Imported LRC"]);+ [NSUserDefaults.standardUserDefaults setVolatileDomain:@{SGKeyLyricsProviders: @[@"musixmatch", @"importedLRC", @"lrclib"],+ SGKeyLyricsPreferWordTiming: @YES} forName:NSArgumentDomain];+ SGPrefsChanged();+ [sg_asked removeAllObjects];+ got = fetch(@"t5");+ CHECK([sg_asked isEqualToArray:(@[@"musixmatch:t5", @"importedLRC:t5", @"lrclib:t5"])] && [got.provider isEqualToString:@"Musixmatch"]);+printf("lyrics-walk: all checks passed\n");}return 0;diff --git a/tweak/Sources/Shared/LyricsSources/LyricsSources.m b/tweak/Sources/Shared/LyricsSources/LyricsSources.mindex 4b975dc0..47e4af8a 100644--- a/tweak/Sources/Shared/LyricsSources/LyricsSources.m+++ b/tweak/Sources/Shared/LyricsSources/LyricsSources.m@@ -443,7 +443,8 @@ static void finish(SGLyricsWalk *walk) {// Whether the walk has its answer. walk.merged is the best seen so far: betterLines keeps the finest timed// lines, the first in the order among equals, so a walk run to the end takes words over a line's start over// plain text. It stops at the first timed answer, or with Prefer word-by-word timing at the first with words-// timed. A source picked for the track is asked first, and its answer ends the walk in step.+// timed. A source picked for the track is asked first, and its answer ends the walk in step, as a timed+// imported LRC does.static BOOL settled(SGLyricsWalk *walk) {SGLyricsResult *merged = walk.merged;if (!(merged.synced && merged.texts.count && merged.karaokeLines.count)) return NO;@@ -502,11 +503,14 @@ static void step(SGLyricsWalk *walk) {}// The pick stands timed or not, so a timed source lower in the order cannot replace it. A pick made while// the walk runs is left to finish, which keeps the order's answer for Automatic.- if (fresh.karaokeLines.count && [provider.key isEqualToString:walk.picked]- && [walk.picked isEqualToString:SGLyricsChosenSource(query.trackID)]) {+ BOOL pick = [provider.key isEqualToString:walk.picked] && [walk.picked isEqualToString:SGLyricsChosenSource(query.trackID)];+ // The user's own timed file is the answer too: Prefer word-by-word timing looks past the sources' line timing,+ // not past lyrics the user imported for the song (#111). Below a source as finely timed, the order still wins.+ BOOL imported = fresh.synced && [provider.key isEqualToString:SGImportedLRCKey] && betterLines(merged, fresh);+ if (fresh.karaokeLines.count && (pick || imported)) {if (!fresh.provider) fresh.provider = provider.name;walk.merged = fresh;- walk.pickedAnswered = YES;+ walk.pickedAnswered = pick;finish(walk);return;}