Files
seanime-docker/seanime-2.9.10/internal/torrentstream/history.go
2025-09-20 14:08:38 +01:00

35 lines
855 B
Go

package torrentstream
import (
"seanime/internal/database/db_bridge"
hibiketorrent "seanime/internal/extension/hibike/torrent"
"seanime/internal/util"
)
type BatchHistoryResponse struct {
Torrent *hibiketorrent.AnimeTorrent `json:"torrent"`
}
func (r *Repository) GetBatchHistory(mId int) (ret *BatchHistoryResponse) {
defer util.HandlePanicInModuleThen("torrentstream/GetBatchHistory", func() {
ret = &BatchHistoryResponse{}
})
torrent, err := db_bridge.GetTorrentstreamHistory(r.db, mId)
if err != nil {
return &BatchHistoryResponse{}
}
return &BatchHistoryResponse{
torrent,
}
}
func (r *Repository) AddBatchHistory(mId int, torrent *hibiketorrent.AnimeTorrent) {
go func() {
defer util.HandlePanicInModuleThen("torrentstream/AddBatchHistory", func() {})
_ = db_bridge.InsertTorrentstreamHistory(r.db, mId, torrent)
}()
}