aboutsummaryrefslogtreecommitdiff
path: root/tasks/anisync.task.go
diff options
context:
space:
mode:
authorBobby <[email protected]>2026-02-05 15:56:01 +0530
committerBobby <[email protected]>2026-02-05 15:56:01 +0530
commit111ddd8b5fca2612256a7bd31781c149f10f83d8 (patch)
tree23256435338a22f31f3dc52331ae2f04705ec1f8 /tasks/anisync.task.go
parentb0f01eea9d61aa4d05b0fe253c8a32e35fa95e28 (diff)
downloadmetachan-111ddd8b5fca2612256a7bd31781c149f10f83d8.tar.xz
metachan-111ddd8b5fca2612256a7bd31781c149f10f83d8.zip
Refactor Jikan API types: remove unused structures and add HTTP client configuration
Diffstat (limited to 'tasks/anisync.task.go')
-rw-r--r--tasks/anisync.task.go11
1 files changed, 7 insertions, 4 deletions
diff --git a/tasks/anisync.task.go b/tasks/anisync.task.go
index aa94c6e..dc98d3e 100644
--- a/tasks/anisync.task.go
+++ b/tasks/anisync.task.go
@@ -83,18 +83,21 @@ func AniSync() error {
}
}
- // Calculate time remaining (after processing at least 10 items for accuracy)
- timeRemaining := ""
+ // Calculate progress and ETA
+ progress := float64(processed+1) / float64(itemsToSync) * 100
+ eta := ""
if processed >= 10 {
elapsed := time.Since(startTime)
avgTimePerItem := elapsed / time.Duration(processed)
remainingItems := itemsToSync - processed
remaining := time.Duration(remainingItems) * avgTimePerItem
- timeRemaining = fmt.Sprintf(" - ETA: %s", formatDuration(remaining))
+ eta = formatDuration(remaining)
+ } else {
+ eta = "calculating..."
}
// Fetch full anime details
- logger.Log(fmt.Sprintf("[%d/%d] Synchronising MAL ID %d...%s", processed+1, itemsToSync, mapping.MAL, timeRemaining), logger.LogOptions{
+ logger.Log(fmt.Sprintf("[%d/%d] Synchronising MAL ID %d - %.1f%% | ETA: %s", processed+1, itemsToSync, mapping.MAL, progress, eta), logger.LogOptions{
Level: logger.Info,
Prefix: "AniSync",
})