Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 55 additions & 3 deletions Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"value" : ""
}
}
}
},
"shouldTranslate" : false
},
" " : {
"localizations" : {
Expand All @@ -43,7 +44,8 @@
"value" : " "
}
}
}
},
"shouldTranslate" : false
},
"..." : {
"localizations" : {
Expand Down Expand Up @@ -91,7 +93,7 @@
}
},
"[Lyric Fever GitHub](https://github.com/aviwad/LyricFever)\nVersion 3.2" : {

"shouldTranslate" : false
},
"%@s" : {
"localizations" : {
Expand Down Expand Up @@ -336,6 +338,7 @@
}
},
"Arist Name" : {
"extractionState" : "stale",
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
Expand Down Expand Up @@ -1215,6 +1218,9 @@
}
}
},
"LRCLIB" : {
"shouldTranslate" : false
},
"Lyric Fever: Fullscreen" : {
"localizations" : {
"zh-Hans" : {
Expand Down Expand Up @@ -1442,6 +1448,7 @@
}
},
"More options" : {
"extractionState" : "stale",
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
Expand All @@ -1464,6 +1471,7 @@
}
},
"More options, AirPlay delay enabled" : {
"extractionState" : "stale",
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
Expand All @@ -1485,6 +1493,28 @@
}
}
},
"NetEase" : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "网易"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "網易"
}
},
"zh-Hant-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "網易"
}
}
}
},
"Next" : {
"localizations" : {
"zh-Hans" : {
Expand Down Expand Up @@ -2045,6 +2075,28 @@
}
}
},
"Primary Lyric Source" : {
"localizations" : {
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "优先歌词源"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "優先歌詞源"
}
},
"zh-Hant-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "優先歌詞源"
}
}
}
},
"Quit" : {
"localizations" : {
"zh-Hans" : {
Expand Down
1 change: 1 addition & 0 deletions LyricFever/Support Files/UserDefaultStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class UserDefaultStorage {
var romanize: Bool = false
var romanizeMetadata: Bool = true
var chinesePreference: Int = 0
var lyricSourcePreference: String = "LRCLIB"
#if os(macOS)
var spotifyConnectDelayCount: Int = 400
var hasMigrated: Bool = false
Expand Down
63 changes: 50 additions & 13 deletions LyricFever/ViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@ import MediaRemoteAdapter
// print("Apple Music Artwork Workaround: Ignoring artwork for existing song")
// return
// } else {
// self.appleMusicUniqueIdentifier = data.payload.uniqueIdentifier
// self.appleMuszxicUniqueIdentifier = data.payload.uniqueIdentifier
// }
guard let artwork = data.payload.artwork else {
guard let artwork = data?.payload.artwork else {
if self.currentlyPlaying == nil {
self.artworkImage = nil
}
Expand Down Expand Up @@ -140,12 +140,17 @@ import MediaRemoteAdapter

var displayKaraoke: Bool {
get {
showLyrics && isPlaying && userDefaultStorage.karaoke && !karaokeModeHovering && (currentlyPlayingLyricsIndex != nil)
showLyrics && isPlaying && userDefaultStorage.karaoke && !karaokeModeHovering && (currentlyPlayingLyricsIndex != nil) && currentLyricIsNotBlank
}
set {

}
}

private var currentLyricIsNotBlank: Bool {
guard let index = currentlyPlayingLyricsIndex, index < currentlyPlayingLyrics.count else { return false }
return !currentlyPlayingLyrics[index].words.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty
}
var displayFullscreen: Bool {
get {
fullscreen
Expand Down Expand Up @@ -279,10 +284,32 @@ import MediaRemoteAdapter
#if os(macOS)
var localFileUploadProvider = LocalFileUploadProvider()
#endif
@ObservationIgnored lazy var allNetworkLyricProviders: [LyricProvider] = [spotifyLyricProvider, lRCLyricProvider, netEaseLyricProvider]
@ObservationIgnored var allNetworkLyricProviders: [LyricProvider] {
switch userDefaultStorage.lyricSourcePreference {
case "Spotify":
return [spotifyLyricProvider, lRCLyricProvider, netEaseLyricProvider]
case "NetEase":
return [netEaseLyricProvider, lRCLyricProvider, spotifyLyricProvider]
case "LRCLIB":
return [lRCLyricProvider, spotifyLyricProvider, netEaseLyricProvider]
default:
return [lRCLyricProvider, spotifyLyricProvider, netEaseLyricProvider]
}
}

// custom order because LRCLIB is tweaking for the time being
@ObservationIgnored lazy var allNetworkLyricProvidersForSearch: [LyricProvider] = [spotifyLyricProvider, netEaseLyricProvider, lRCLyricProvider]
@ObservationIgnored var allNetworkLyricProvidersForSearch: [LyricProvider] {
switch userDefaultStorage.lyricSourcePreference {
case "Spotify":
return [spotifyLyricProvider, netEaseLyricProvider, lRCLyricProvider]
case "NetEase":
return [netEaseLyricProvider, spotifyLyricProvider, lRCLyricProvider]
case "LRCLIB":
return [lRCLyricProvider, spotifyLyricProvider, netEaseLyricProvider]
default:
return [lRCLyricProvider, spotifyLyricProvider, netEaseLyricProvider]
}
}

var isFirstFetch = true

Expand Down Expand Up @@ -785,7 +812,7 @@ import MediaRemoteAdapter

func startLyricUpdater() {
currentLyricsUpdaterTask?.cancel()
if !isPlaying || currentlyPlayingLyrics.isEmpty || mustUpdateUrgent {
if !isPlaying || currentlyPlayingLyrics.isEmpty {
return
}
// If an index exists, we're unpausing: meaning we must instantly find the current lyric
Expand Down Expand Up @@ -1141,14 +1168,24 @@ extension ViewModel {
// Task cancelled means we're working with old song data, so dont update Spotify ID with old song's ID

// search for equivalent spotify song
if let spotifyResult = try await musicToSpotifyHelper() {
self.currentlyPlayingName = spotifyResult.SpotifyName
self.currentlyPlayingArtist = spotifyResult.SpotifyArtist
self.currentAlbumName = spotifyResult.SpotifyAlbum
self.currentlyPlaying = spotifyResult.SpotifyID
} else {
do {
if let spotifyResult = try await musicToSpotifyHelper() {
self.currentlyPlayingName = spotifyResult.SpotifyName
self.currentlyPlayingArtist = spotifyResult.SpotifyArtist
self.currentAlbumName = spotifyResult.SpotifyAlbum
self.currentlyPlaying = spotifyResult.SpotifyID
} else {
if let alternativeID = appleMusicPlayer.alternativeID, alternativeID != "" {
try Task.checkCancellation()
self.currentlyPlaying = alternativeID
} else {
lyricsIsEmptyPostLoad = true
}
}
} catch {
print("Spotify lookup failed with error \(error). Falling back to Apple Music ID.")
if let alternativeID = appleMusicPlayer.alternativeID, alternativeID != "" {
try Task.checkCancellation()
try? Task.checkCancellation()
self.currentlyPlaying = alternativeID
} else {
lyricsIsEmptyPostLoad = true
Expand Down
2 changes: 1 addition & 1 deletion LyricFever/Views/KaraokeView/FloatingPanel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class FloatingPanel<Content: View>: NSPanel {
standardWindowButton(.miniaturizeButton)?.isHidden = true
standardWindowButton(.zoomButton)?.isHidden = true
contentView = NSHostingView(rootView: view()
.preferredColorScheme(.dark)
// .preferredColorScheme(.dark)
.environment(\.floatingPanel, self))
hasShadow = false
}
Expand Down
Loading