Skip to content

Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.

C

fix: Genius is not asked for a track Spotify has its own lyrics for

My-Name-Is-Jeffa424c40f2988
diff --git a/tweak/Sources/Shared/LyricsSources/LyricsSources.h b/tweak/Sources/Shared/LyricsSources/LyricsSources.h
index 33104252..94f6f901 100644
--- a/tweak/Sources/Shared/LyricsSources/LyricsSources.h
+++ b/tweak/Sources/Shared/LyricsSources/LyricsSources.h
@@ -71,7 +71,8 @@ typedef void (^SGLyricsAsk)(SGLyricsQuery *query, void (^done)(SGLyricsResult *r
// Searches by title and artist, so it has nothing to ask with until someone has named the track.
// Musixmatch matches by Spotify's id and can go without.
@property (nonatomic) BOOL needsName;
-// Has only untimed lines, which never replace lines already found, so it is asked only while there are none.
+// Has only untimed lines, which never replace lines already found, so it is asked only while there are none
+// and Spotify has none of its own.
@property (nonatomic) BOOL untimed;
@property (nonatomic, copy) SGLyricsAsk ask;
@end
@@ -93,8 +94,8 @@ BOOL SGLyricsMayHave(NSString *trackID);
// comes; a walk already run or running is left alone. Safe from any thread.
void SGLyricsPrefetch(NSString *trackID);
// What Spotify's own metadata says of a track: 1 has lyrics, 0 has none, -1 not seen yet. The
-// player-track hook notes it; the request hook reads it to send a track Spotify has none for to
-// the donor. Safe from any thread.
+// player-track hook notes it, and the walk when it names a track; the request hook reads it to send a
+// track Spotify has none for to the donor, and the walk to pass Genius over. Safe from any thread.
NSInteger SGLyricsSpotifyHas(NSString *trackID);
void SGLyricsNoteSpotifyHas(NSString *trackID, BOOL has);
// The remote-config values the lyrics feature forces while a source is on, nil for any other flag:
diff --git a/tweak/Sources/Shared/LyricsSources/LyricsSources.m b/tweak/Sources/Shared/LyricsSources/LyricsSources.m
index 887d3bb1..ab7878c6 100644
--- a/tweak/Sources/Shared/LyricsSources/LyricsSources.m
+++ b/tweak/Sources/Shared/LyricsSources/LyricsSources.m
@@ -258,6 +258,10 @@ static SGLyricsQuery *queryFor(NSString *trackID) {
query.title = track.trackTitle;
query.artist = track.artistName;
NSDictionary<NSString *, NSString *> *metadata = track.metadata;
+ // With "every track" on, the metadata hook has just noted Spotify's own verdict and forced has_lyrics on;
+ // off, nothing notes it and has_lyrics is Spotify's own.
+ id has = metadata[@"has_lyrics"];
+ if (has && SGLyricsSpotifyHas(trackID) < 0) SGLyricsNoteSpotifyHas(trackID, [@"true" isEqual:has]);
id album = metadata[@"album_title"];
id length = metadata[@"duration"];
if ([album isKindOfClass:NSString.class]) query.album = album;
@@ -445,7 +449,8 @@ static void step(SGLyricsWalk *walk) {
return;
}
SGLyricsProvider *provider = SGLyricsProviderFor(walk.order[walk.index++]);
- if (provider.untimed && (merged.karaokeLines.count || merged.texts.count)) {
+ // Not yet known asks: wrongly passing Genius over would keep "no lyrics" for a track Spotify has none for.
+ if (provider.untimed && (merged.karaokeLines.count || merged.texts.count || SGLyricsSpotifyHas(query.trackID) == 1)) {
step(walk);
return;
}