This commit is contained in:
Zsolt Alföldi
2026-05-07 00:14:02 +02:00
commit 469e5b0678
18 changed files with 1898 additions and 0 deletions

101
internal/model/model.go Normal file
View File

@@ -0,0 +1,101 @@
package model
import "time"
type Torrent struct {
ID int64 `json:"id"`
Name string `json:"name"`
URL string `json:"url"`
Start string `json:"start"`
Updated string `json:"updated"`
Status string `json:"status"`
Uploaded string `json:"uploaded"`
Downloaded string `json:"downloaded"`
Remaining string `json:"remaining"`
Ratio string `json:"ratio"`
HnRMarked bool `json:"hnr_marked"`
QBit *QBitTorrent `json:"qbit,omitempty"`
}
type HitRunPage struct {
Alert string `json:"alert,omitempty"`
Stats map[string]string `json:"stats"`
Torrents []Torrent `json:"torrents"`
}
type QBitTorrent struct {
Hash string `json:"hash"`
Name string `json:"name"`
State string `json:"state"`
Progress float64 `json:"progress"`
Ratio float64 `json:"ratio"`
Uploaded int64 `json:"uploaded"`
Downloaded int64 `json:"downloaded"`
LastActivity int64 `json:"last_activity"`
}
type ActionResult struct {
Torrent Torrent `json:"torrent"`
Matched bool `json:"matched"`
ForceStarted bool `json:"force_started"`
Reannounced bool `json:"reannounced"`
ManualNeeded bool `json:"manual_needed"`
Message string `json:"message,omitempty"`
QBit *QBitTorrent `json:"qbit,omitempty"`
FirstSeenAt time.Time `json:"first_seen_at"`
LastSeenAt time.Time `json:"last_seen_at"`
}
type RunSummary struct {
StartedAt time.Time `json:"started_at"`
DryRun bool `json:"dry_run"`
TotalRisk int `json:"total_risk"`
Matched int `json:"matched"`
Unmatched int `json:"unmatched"`
ForceStarted int `json:"force_started"`
Reannounced int `json:"reannounced"`
ManualNeeded int `json:"manual_needed"`
Results []ActionResult `json:"results"`
}
type StatusCount struct {
Status string `json:"status"`
Count int `json:"count"`
}
type RunRecord struct {
StartedAt string `json:"started_at"`
DryRun bool `json:"dry_run"`
TotalRisk int `json:"total_risk"`
Matched int `json:"matched"`
Unmatched int `json:"unmatched"`
ForceStarted int `json:"force_started"`
Reannounced int `json:"reannounced"`
ManualNeeded int `json:"manual_needed"`
}
type TorrentStatus struct {
ID int64 `json:"id"`
Name string `json:"name"`
Status string `json:"status"`
FirstSeenAt string `json:"first_seen_at"`
LastSeenAt string `json:"last_seen_at"`
LastResolvedAt string `json:"last_resolved_at,omitempty"`
HnRMarked bool `json:"hnr_marked"`
QBitName string `json:"qbit_name,omitempty"`
QBitState string `json:"qbit_state,omitempty"`
QBitProgress float64 `json:"qbit_progress,omitempty"`
QBitRatio float64 `json:"qbit_ratio,omitempty"`
LastActionAt string `json:"last_action_at,omitempty"`
ManualNeededAt string `json:"manual_needed_at,omitempty"`
}
type StatsSnapshot struct {
Counts []StatusCount `json:"counts"`
LastRun *RunRecord `json:"last_run,omitempty"`
ManualNeeded []TorrentStatus `json:"manual_needed"`
}
type StatusSnapshot struct {
Torrents []TorrentStatus `json:"torrents"`
}