add set torrent, for set title,poster,data

This commit is contained in:
YouROK
2021-03-11 14:47:23 +03:00
parent c8b01bec30
commit 542946b65a
2 changed files with 34 additions and 1 deletions

View File

@@ -83,6 +83,25 @@ func GetTorrent(hashHex string) *Torrent {
return tor
}
func SetTorrent(hashHex, title, poster, data string) *Torrent {
hash := metainfo.NewHashFromHex(hashHex)
tor := bts.GetTorrent(hash)
if tor != nil {
tor.Title = title
tor.Poster = poster
tor.Data = data
}
tor = GetTorrentDB(hash)
if tor != nil {
tor.Title = title
tor.Poster = poster
tor.Data = data
AddTorrentDB(tor)
}
return tor
}
func RemTorrent(hashHex string) {
hash := metainfo.NewHashFromHex(hashHex)
bts.RemoveTorrent(hash)