fix media workflows and download organization

This commit is contained in:
ShukeBta
2026-06-26 08:42:16 +08:00
parent 0da96f7e4e
commit 65adca04df
102 changed files with 4063 additions and 437 deletions
+14 -1
View File
@@ -43,6 +43,19 @@ func recentlyCompletedTorrent(torrent QBitTorrent, now time.Time) bool {
return now.Sub(completed) <= completedTorrentCatchupWindow
}
func qbitTorrentCompleted(torrent QBitTorrent) bool {
if torrent.Progress < 1 {
return false
}
state := strings.ToLower(strings.TrimSpace(torrent.State))
switch state {
case "completed", "uploading", "stalledup", "pausedup", "queuedup", "forcedup":
return true
default:
return false
}
}
func (d *DownloadService) completedTorrentCatchupRecorded(ctx context.Context, torrent QBitTorrent) bool {
if d == nil || d.repo == nil || d.repo.Setting == nil {
return false
@@ -148,7 +161,7 @@ func (d *DownloadService) syncDownloadTaskProgress(ctx context.Context, torrent
return
}
status := torrent.State
if torrent.Progress >= 1 {
if qbitTorrentCompleted(torrent) {
status = "completed"
}
if strings.TrimSpace(status) == "" {