mirror of
https://github.com/whoeevee/EeveeSpotifyReborn.git
synced 2026-01-09 00:23:20 +01:00
improvements
This commit is contained in:
@@ -106,7 +106,7 @@ func getCurrentTrackLyricsData() throws -> Data {
|
||||
|
||||
if source != .genius && UserDefaults.geniusFallback {
|
||||
|
||||
NSLog("[EeveeSpotify] Unable to load lyrics from \(source), trying Genius as fallback")
|
||||
NSLog("[EeveeSpotify] Unable to load lyrics from \(source): \(error), trying Genius as fallback")
|
||||
source = .genius
|
||||
|
||||
plainLyrics = try LyricsRepository.getLyrics(
|
||||
|
||||
@@ -50,8 +50,7 @@ class LyricsHelper {
|
||||
let matchRange = match.range(withName: name)
|
||||
|
||||
if let substringRange = Range(matchRange, in: line) {
|
||||
let capture = String(line[substringRange])
|
||||
captures[name] = capture
|
||||
captures[name] = String(line[substringRange])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@ struct LyricsRepository {
|
||||
source: LyricsSource
|
||||
) throws -> PlainLyrics {
|
||||
|
||||
let query = "\(title.strippedTrackTitle) \(artist)"
|
||||
let strippedTitle = title.strippedTrackTitle
|
||||
let query = "\(strippedTitle) \(artist)"
|
||||
|
||||
switch source {
|
||||
|
||||
@@ -23,7 +24,7 @@ struct LyricsRepository {
|
||||
|
||||
guard let song = (
|
||||
hits.first(
|
||||
where: { $0.result.title.containsInsensitive(title) }
|
||||
where: { $0.result.title.containsInsensitive(strippedTitle) }
|
||||
) ?? hits.first
|
||||
)?.result else {
|
||||
throw LyricsError.NoSuchSong
|
||||
@@ -38,14 +39,14 @@ struct LyricsRepository {
|
||||
|
||||
guard let song = (
|
||||
hits.first(
|
||||
where: { $0.name.containsInsensitive(title) }
|
||||
where: { $0.name.containsInsensitive(strippedTitle) }
|
||||
) ?? hits.first
|
||||
) else {
|
||||
throw LyricsError.NoSuchSong
|
||||
}
|
||||
|
||||
return PlainLyrics(
|
||||
content: song.syncedLyrics ?? song.plainLyrics,
|
||||
content: song.syncedLyrics ?? song.plainLyrics ?? "",
|
||||
timeSynced: song.syncedLyrics != nil
|
||||
)
|
||||
|
||||
|
||||
@@ -2,6 +2,6 @@ import Foundation
|
||||
|
||||
struct LrclibSong: Decodable {
|
||||
var name: String
|
||||
var plainLyrics: String
|
||||
var plainLyrics: String?
|
||||
var syncedLyrics: String?
|
||||
}
|
||||
@@ -55,7 +55,7 @@ extension Color {
|
||||
|
||||
var normalized: Color {
|
||||
brightness < 0.5
|
||||
? self.lighter(by: 0.35)
|
||||
? self.lighter(by: 0.5 - brightness)
|
||||
: self.darker(by: brightness - 0.5)
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ extension String {
|
||||
.removeMatches("\\(.*\\)")
|
||||
.removeMatches("- .*")
|
||||
.prefix(30)
|
||||
//.trimmingCharacters(in: .whitespaces)
|
||||
.trimmingCharacters(in: .whitespaces)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class OfflineObserver: NSObject, NSFilePresenter {
|
||||
|
||||
let productState = HookedInstances.productState!
|
||||
|
||||
if productState.stringForKey("player-license") == "premium" {
|
||||
if productState.stringForKey("type") == "premium" {
|
||||
|
||||
do {
|
||||
try OfflineHelper.backupToEeveeBnk()
|
||||
|
||||
@@ -10,12 +10,12 @@ struct EeveeSettingsView: View {
|
||||
|
||||
let alert = UIAlertController(
|
||||
title: "Enter User Token",
|
||||
message: "In order to use Musixmatch, you need to retrieve your user token from the official app. Download Musixmatch from the App Store, sign up, and extract the token using MITM.",
|
||||
message: "In order to use Musixmatch, you need to retrieve your user token from the official app. Download Musixmatch from the App Store, sign up, then go to Settings > Get help > Copy debug info, and paste it here. You can also extract the token using MITM.",
|
||||
preferredStyle: .alert
|
||||
)
|
||||
|
||||
alert.addTextField() { textField in
|
||||
textField.placeholder = Data.musixmatchTokenPlaceholder
|
||||
textField.placeholder = "---- Debug Info ---- [Device]: iPhone"
|
||||
}
|
||||
|
||||
alert.addAction(UIAlertAction(title: "Cancel", style: .cancel) { _ in
|
||||
@@ -23,9 +23,17 @@ struct EeveeSettingsView: View {
|
||||
})
|
||||
|
||||
alert.addAction(UIAlertAction(title: "OK", style: .default) { _ in
|
||||
let token = alert.textFields!.first!.text!
|
||||
let text = alert.textFields!.first!.text!
|
||||
let token: String
|
||||
|
||||
if !(token ~= "^[a-f0-9]+$") {
|
||||
if let match = text.firstMatch("\\[UserToken\\]: ([a-f0-9]+)"),
|
||||
let tokenRange = Range(match.range(at: 1), in: text) {
|
||||
token = String(text[tokenRange])
|
||||
}
|
||||
else if text ~= "^[a-f0-9]+$" {
|
||||
token = text
|
||||
}
|
||||
else {
|
||||
lyricsSource = oldSource
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user