Final work to add torrents categories

This commit is contained in:
LIAUD Corentin
2024-03-24 16:10:49 +01:00
parent 28e24de557
commit a7417a221a
11 changed files with 73 additions and 60 deletions

View File

@@ -114,7 +114,7 @@ func GetTorrent(hashHex string) *Torrent {
return tor
}
func SetTorrent(hashHex, title, poster, data string) *Torrent {
func SetTorrent(hashHex, title, poster, category string, data string) *Torrent {
hash := metainfo.NewHashFromHex(hashHex)
torr := bts.GetTorrent(hash)
torrDb := GetTorrentDB(hash)
@@ -133,12 +133,14 @@ func SetTorrent(hashHex, title, poster, data string) *Torrent {
}
torr.Title = title
torr.Poster = poster
torr.Category = category
torr.Data = data
}
if torrDb != nil {
torrDb.Title = title
torrDb.Poster = poster
torrDb.Category = category
torrDb.Data = data
AddTorrentDB(torrDb)
}

View File

@@ -75,6 +75,7 @@ func ListTorrentsDB() map[metainfo.Hash]*Torrent {
torr.Poster = db.Poster
torr.Timestamp = db.Timestamp
torr.Size = db.Size
torr.Category = db.Category
torr.Data = db.Data
torr.Stat = state.TorrentInDB
ret[torr.TorrentSpec.InfoHash] = torr