Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.
C
fix: the lyrics source menu goes back to Automatic when the picked source has nothing
My-Name-Is-Jeff38175fe00090
diff --git a/tweak/Sources/Shared/LyricsSources/LyricsPick.m b/tweak/Sources/Shared/LyricsSources/LyricsPick.mindex aa4c4660..e572a1e6 100644--- a/tweak/Sources/Shared/LyricsSources/LyricsPick.m+++ b/tweak/Sources/Shared/LyricsSources/LyricsPick.m@@ -154,6 +154,13 @@ void SGLyricsNoteOrderChoice(NSString *trackID, SGLyricsResult *lyrics) {automatic.lines = lyrics.karaokeLines;}+void SGLyricsDropChoice(NSString *trackID, NSString *key) {+ if (!trackID || ![sg_chosen[trackID] isEqualToString:key]) return;+ SGLog(@"lyrics: %@ gave %@ nothing or is off, back to Automatic", key, trackID);+ [sg_chosen removeObjectForKey:trackID];+ [sg_automatic removeObjectForKey:trackID];+}+void SGLyricsChooseAutomatic(NSString *trackID) {if (!trackID || !sg_chosen[trackID]) return;SGLyricsAutomatic *automatic = sg_automatic[trackID];diff --git a/tweak/Sources/Shared/LyricsSources/LyricsSources.h b/tweak/Sources/Shared/LyricsSources/LyricsSources.hindex fb1e4034..4d0ac36d 100644--- a/tweak/Sources/Shared/LyricsSources/LyricsSources.h+++ b/tweak/Sources/Shared/LyricsSources/LyricsSources.h@@ -245,6 +245,9 @@ void SGLyricsChooseSource(NSString *trackID, NSString *key);void SGLyricsChooseAutomatic(NSString *trackID);// A walk under way at the track's first pick has ended with `lyrics`: that is what Automatic puts back.void SGLyricsNoteOrderChoice(NSString *trackID, SGLyricsResult *lyrics);+// A walk found the track's pick `key` answering no lines, or switched off: the pick goes, so the menu shows+// Automatic over the order's answer the walk goes on to. Nothing when the track's pick is another by now.+void SGLyricsDropChoice(NSString *trackID, NSString *key);extern NSNotificationName const SGLyricsSourceChosenNotification;// LyricsSources.m, for LyricsPick.m: the query a walk would start with, and a picked answer kept as the walk's.SGLyricsQuery *SGLyricsQueryFor(NSString *trackID);diff --git a/tweak/Sources/Shared/LyricsSources/LyricsSources.m b/tweak/Sources/Shared/LyricsSources/LyricsSources.mindex da5961a8..816dc764 100644--- a/tweak/Sources/Shared/LyricsSources/LyricsSources.m+++ b/tweak/Sources/Shared/LyricsSources/LyricsSources.m@@ -483,9 +483,14 @@ static void step(SGLyricsWalk *walk) {step(walk);return;}+ NSUInteger failures = atomic_load(&sg_failures);provider.ask(query, ^(SGLyricsResult *fresh) {learnFrom(query, fresh);noteCredit(fresh);+ // Instrumental counts as no lines here; a failed request does not, as the server may only be busy.+ if ([provider.key isEqualToString:walk.picked] && !fresh.karaokeLines.count && atomic_load(&sg_failures) == failures) {+ SGLyricsDropChoice(query.trackID, walk.picked);+ }if (fresh.instrumental) {SGLog(@"lyrics: %@ is instrumental, by %@", query.trackID, provider.key);merged.instrumental = YES;@@ -525,6 +530,9 @@ static void startWalk(NSString *trackID, SGLyricsQuery *query) {if (chosen && [order containsObject:chosen]) {[order removeObject:chosen];[order insertObject:chosen atIndex:0];+ } else if (chosen) {+ SGLyricsDropChoice(trackID, chosen);+ chosen = nil;}SGLog(@"lyrics: asking %@ for %@ as \"%@\" by \"%@\", album \"%@\", %lds",[order componentsJoinedByString:@", "], trackID, query.title, query.artist, query.album, (long)query.seconds);