Skip to content

Commit

Permalink
LRCLIB: Save empty lyrics if song is instrumental. Prevents us wastin…
Browse files Browse the repository at this point in the history
…g network requests on songs that are clearly instrumental. Worst case (if LRCLIB's info is faulty, and song is non-instrumental) user can recheck for lyrics
  • Loading branch information
aviwad committed Nov 19, 2024
1 parent df08d64 commit 922c949
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions SpotifyLyricsInMenubar/lyricJsonStruct.swift
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,15 @@ struct LRCLyrics: Decodable {
self.albumName = try container.decode(String.self, forKey: .albumName)
self.duration = try container.decode(Int.self, forKey: .duration)
self.instrumental = try container.decode(Bool.self, forKey: .instrumental)
self.plainLyrics = try container.decode(String.self, forKey: .plainLyrics)
self.syncedLyrics = try container.decode(String.self, forKey: .syncedLyrics)
self.lyrics = LRCLyrics.decodeLyrics(input: syncedLyrics)
if instrumental {
self.plainLyrics = ""
self.syncedLyrics = ""
self.lyrics = []
} else {
self.plainLyrics = try container.decode(String.self, forKey: .plainLyrics)
self.syncedLyrics = try container.decode(String.self, forKey: .syncedLyrics)
self.lyrics = LRCLyrics.decodeLyrics(input: syncedLyrics)
}
// self.lyrics = try container.decode([LyricLine].self, forKey: .lyrics)
}
}
Expand Down

0 comments on commit 922c949

Please sign in to comment.