mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-30 13:19:44 +02:00
fix(library): preserve indexed tracks when a full scan is incomplete
This commit is contained in:
1 parent
4c2c356763
commit
e3bec31b36
6 files changed
+86
-11
No files matched your search
@@ -1907,19 +1907,20 @@ class MainActivity: FlutterFragmentActivity() {
|
||||
"scanLibraryFolderToNDJSONFile" -> {
|
||||
val folderPath = call.argument<String>("folder_path") ?: ""
|
||||
val outputPath = call.argument<String>("output_path") ?: ""
|
||||
val count = withContext(Dispatchers.IO) {
|
||||
val response = withContext(Dispatchers.IO) {
|
||||
safScanActive = false
|
||||
coreBackend.scanLibraryFolderToNdjsonFile(
|
||||
val count = coreBackend.scanLibraryFolderToNdjsonFile(
|
||||
folderPath,
|
||||
outputPath,
|
||||
)
|
||||
}
|
||||
result.success(
|
||||
mapOf(
|
||||
"path" to outputPath,
|
||||
"count" to count,
|
||||
"error_count" to JSONObject(coreBackend.getLibraryScanProgress())
|
||||
.getInt("error_count"),
|
||||
)
|
||||
)
|
||||
}
|
||||
result.success(response)
|
||||
}
|
||||
"scanLibraryFolderIncremental" -> {
|
||||
val folderPath = call.argument<String>("folder_path") ?: ""
|
||||
|
||||
@@ -734,7 +734,7 @@ internal fun MainActivity.scanSafTree(
|
||||
}
|
||||
File(ndjsonOutputPath).writeText("", Charsets.UTF_8)
|
||||
try { File(safScanCheckpointPath(ndjsonOutputPath)).delete() } catch (_: Exception) {}
|
||||
return mapOf("path" to ndjsonOutputPath, "count" to 0)
|
||||
return mapOf("path" to ndjsonOutputPath, "count" to 0, "error_count" to 0)
|
||||
}
|
||||
|
||||
fun cancelledResult(): Any {
|
||||
@@ -1152,7 +1152,7 @@ internal fun MainActivity.scanSafTree(
|
||||
if (ndjsonWriter != null) {
|
||||
ndjsonWriter.close()
|
||||
checkpointWriter?.close()
|
||||
return mapOf("path" to outputPath, "count" to resultCount)
|
||||
return mapOf("path" to outputPath, "count" to resultCount, "error_count" to errors)
|
||||
}
|
||||
spill!!.raw(if (resultCount == 0) "[]" else "]")
|
||||
return spill.result()
|
||||
|
||||
Reference in new issue
Block a user