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