fix: prefer local file for cover/lyrics save and update build dependencies

- Cover art: extract from downloaded file first, fall back to URL download
- Lyrics: check embedded lyrics/sidecar LRC before fetching online
- Add audioFilePath param to FetchAndSaveLyrics (Go, Kotlin, Swift, Dart)
- Handle SAF content:// URIs for lyrics extraction in Kotlin bridge
- Update Go 1.25.7 -> 1.25.8, Gradle 9.3.1 -> 9.4.1, Kotlin 2.2.21 -> 2.3.20
- Update NDK r27d -> r28b, Flutter FVM 3.41.4 -> 3.41.5
- Upgrade all Flutter and Go module dependencies to latest
This commit is contained in:
zarzet
2026-03-31 16:59:27 +07:00
parent 93e77aeb84
commit 7dba938299
12 changed files with 206 additions and 139 deletions
@@ -2516,12 +2516,27 @@ class MainActivity: FlutterFragmentActivity() {
val spotifyId = call.argument<String>("spotify_id") ?: ""
val durationMs = call.argument<Number>("duration_ms")?.toLong() ?: 0L
val outputPath = call.argument<String>("output_path") ?: ""
val rawAudioFilePath = call.argument<String>("audio_file_path") ?: ""
val response = withContext(Dispatchers.IO) {
var safAudioTemp: String? = null
try {
Gobackend.fetchAndSaveLyrics(trackName, artistName, spotifyId, durationMs, outputPath)
// Resolve SAF content:// URI to a temp file the Go backend can read
val audioFilePath = if (rawAudioFilePath.startsWith("content://")) {
val uri = Uri.parse(rawAudioFilePath)
val tempPath = copyUriToTemp(uri)
safAudioTemp = tempPath
tempPath ?: ""
} else {
rawAudioFilePath
}
Gobackend.fetchAndSaveLyrics(trackName, artistName, spotifyId, durationMs, outputPath, audioFilePath)
"""{"success":true}"""
} catch (e: Exception) {
"""{"success":false,"error":"${e.message?.replace("\"", "'")}"}"""
} finally {
if (safAudioTemp != null) {
try { File(safAudioTemp).delete() } catch (_: Exception) {}
}
}
}
result.success(response)