Skip to content

Commit 7cdc07e

Browse files
committed
Override "toString" of DownloadChapter
1 parent a82b1bb commit 7cdc07e

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

server/src/main/kotlin/suwayomi/tachidesk/manga/impl/download/DownloadManager.kt

+5-5
Original file line numberDiff line numberDiff line change
@@ -269,21 +269,21 @@ object DownloadManager {
269269
downloadQueue.add(newDownloadChapter)
270270
saveDownloadQueue()
271271
downloadSubscriptionSource.publish(newDownloadChapter)
272-
logger.debug { "Added chapter ${chapter.id} to download queue (${manga.title} | ${chapter.name})" }
272+
logger.debug { "Added chapter ${chapter.id} to download queue ($newDownloadChapter)" }
273273
return newDownloadChapter
274274
}
275275

276276
val retryDownload = downloadChapter?.state == Error
277277
if (retryDownload) {
278-
logger.debug { "Chapter ${chapter.id} download failed, retry download (${manga.title} | ${chapter.name})" }
278+
logger.debug { "Chapter ${chapter.id} download failed, retry download ($downloadChapter)" }
279279

280280
downloadChapter?.state = Queued
281281
downloadChapter?.progress = 0f
282282

283283
return downloadChapter
284284
}
285285

286-
logger.debug { "Chapter ${chapter.id} already present in queue (${manga.title} | ${chapter.name})" }
286+
logger.debug { "Chapter ${chapter.id} already present in queue ($downloadChapter)" }
287287
return null
288288
}
289289

@@ -297,7 +297,7 @@ object DownloadManager {
297297
}
298298

299299
private fun dequeue(chapterDownloads: Set<DownloadChapter>) {
300-
logger.debug { "dequeue ${chapterDownloads.size} chapters [${chapterDownloads.joinToString(separator = ", ") { "${it.manga.title} (${it.mangaId}) - ${it.chapter.name} (${it.chapter.id})" }}]" }
300+
logger.debug { "dequeue ${chapterDownloads.size} chapters [${chapterDownloads.joinToString(separator = ", ") { "$it" }}]" }
301301

302302
downloadQueue.removeAll(chapterDownloads)
303303
saveDownloadQueue()
@@ -310,7 +310,7 @@ object DownloadManager {
310310
val download = downloadQueue.find { it.mangaId == mangaId && it.chapterIndex == chapterIndex }
311311
?: return
312312

313-
logger.debug { "reorder download ${download.manga.title} (${download.mangaId}) - ${download.chapter.name} (${download.chapter.id}) from ${downloadQueue.indexOf(download)} to $to" }
313+
logger.debug { "reorder download $download from ${downloadQueue.indexOf(download)} to $to" }
314314

315315
downloadQueue -= download
316316
downloadQueue.add(to, download)

server/src/main/kotlin/suwayomi/tachidesk/manga/impl/download/Downloader.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class Downloader(
8888
(it.state == Queued || (it.state == Error && it.tries < 3)) // 3 re-tries per download
8989
} ?: break
9090

91-
val logContext = "${logger.name} - downloadChapter(${download.manga.title} (${download.mangaId}) - ${download.chapter.name} (${download.chapter.id}))"
91+
val logContext = "${logger.name} - downloadChapter($download))"
9292
val downloadLogger = KotlinLogging.logger(logContext)
9393

9494
downloadLogger.debug { "start" }

server/src/main/kotlin/suwayomi/tachidesk/manga/impl/download/model/DownloadChapter.kt

+5-1
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,8 @@ class DownloadChapter(
1919
var state: DownloadState = Queued,
2020
var progress: Float = 0f,
2121
var tries: Int = 0
22-
)
22+
) {
23+
override fun toString(): String {
24+
return "${manga.title} ($mangaId) - ${chapter.name} (${chapter.id}) | state= $state, tries= $tries, progress= $progress"
25+
}
26+
}

0 commit comments

Comments
 (0)