refactor: split modules and harden scraping workflows

This commit is contained in:
ShukeBta
2026-06-24 11:59:18 +08:00
parent efca3cbe69
commit 192f35d9fa
470 changed files with 47957 additions and 33839 deletions
+11 -2
View File
@@ -8,16 +8,25 @@ package handler
import (
"net/http"
"time"
"github.com/gin-gonic/gin"
"github.com/ShukeBta/MediaStationGo/internal/service"
)
const tasksLiveTorrentSnapshotMaxAge = 30 * time.Second
func tasksHandler(svc *service.Container) gin.HandlerFunc {
return func(c *gin.Context) {
transcodes := svc.Transcoder.Active()
_, torrents, _ := svc.Downloads.List(c.Request.Context())
var transcodes []service.ActiveJob
if svc.Transcoder != nil {
transcodes = svc.Transcoder.Active()
}
var torrents []service.QBitTorrent
if svc.Downloads != nil {
torrents = svc.Downloads.LiveTorrentSnapshot(tasksLiveTorrentSnapshotMaxAge)
}
background := service.TaskSnapshot{}
if svc.Tasks != nil {
background = svc.Tasks.Snapshot()