mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-09-07 10:27:18 +02:00
Add download complete to logs
This commit is contained in:
@@ -375,6 +375,7 @@ class DownloadItemManager(
|
||||
throw IllegalStateException("Could not finalize internal staging file")
|
||||
}
|
||||
backup.delete()
|
||||
AbsLogger.info(tag, "Move completed for ${part.filename} to ${finalFile.absolutePath}")
|
||||
completePart(item, part)
|
||||
} catch (e: Exception) {
|
||||
part.isMoving = false
|
||||
@@ -423,6 +424,7 @@ class DownloadItemManager(
|
||||
throw IllegalStateException("SAF final size mismatch")
|
||||
if (!staging.delete()) AbsLogger.error(tag, "Could not remove staging file ${staging.name}")
|
||||
part.completedDestinationUri = destination.uri.toString()
|
||||
AbsLogger.info(tag, "Move completed for ${part.filename} to ${destination.uri}")
|
||||
completePart(item, part)
|
||||
} catch (e: Exception) {
|
||||
failFinalization(item, part, "SAF copy failed: ${e.message}")
|
||||
|
||||
@@ -66,6 +66,7 @@ class InternalDownloadManager(
|
||||
"Starting ${if (existingBytes > 0L) "resumed" else "new"} download for ${destinationFile.name} at byte $existingBytes")
|
||||
if (expectedSize > 0L && existingBytes == expectedSize) {
|
||||
progressCallback.onProgress(existingBytes, 100L)
|
||||
AbsLogger.info(tag, "Download completed for ${destinationFile.name} ($existingBytes bytes)")
|
||||
progressCallback.onComplete(false)
|
||||
return
|
||||
}
|
||||
@@ -103,6 +104,7 @@ class InternalDownloadManager(
|
||||
?.toLongOrNull()
|
||||
if (serverSize != null && serverSize > 0L && existingBytes == serverSize) {
|
||||
progressCallback.onProgress(existingBytes, 100L)
|
||||
AbsLogger.info(tag, "Download completed for ${destinationFile.name} ($existingBytes bytes)")
|
||||
progressCallback.onComplete(false)
|
||||
} else if (allowRestart && destinationFile.delete()) {
|
||||
AbsLogger.info(tag, "Restarting stale range from byte zero for ${destinationFile.name}")
|
||||
@@ -162,6 +164,10 @@ class InternalDownloadManager(
|
||||
)
|
||||
progressCallback.onComplete(true)
|
||||
} else {
|
||||
AbsLogger.info(
|
||||
tag,
|
||||
"Download completed for ${destinationFile.name} (${destinationFile.length()} bytes)"
|
||||
)
|
||||
progressCallback.onComplete(false)
|
||||
}
|
||||
} catch (e: IOException) {
|
||||
|
||||
@@ -78,6 +78,7 @@ public class AbsDownloader: CAPPlugin, CAPBridgedPlugin, URLSessionDownloadDeleg
|
||||
liveDownloadItemPart.progress = 100
|
||||
liveDownloadItemPart.completed = true
|
||||
}
|
||||
AbsLogger.info(message: "Download completed for \(liveDownloadItemPart.filename ?? partId)")
|
||||
|
||||
do {
|
||||
// Move the downloaded file into place
|
||||
@@ -89,6 +90,7 @@ public class AbsDownloader: CAPPlugin, CAPBridgedPlugin, URLSessionDownloadDeleg
|
||||
try realm.write {
|
||||
liveDownloadItemPart.moved = true
|
||||
}
|
||||
AbsLogger.info(message: "Move completed for \(liveDownloadItemPart.filename ?? partId) to \(destinationUrl.path)")
|
||||
} catch {
|
||||
try realm.write {
|
||||
liveDownloadItemPart.failed = true
|
||||
|
||||
Reference in New Issue
Block a user