add data to torrent

This commit is contained in:
YouROK
2021-01-19 16:12:39 +03:00
parent 8644e040a3
commit d15e0fd375
7 changed files with 20 additions and 4 deletions

View File

@@ -20,7 +20,7 @@ func InitApiHelper(bt *BTServer) {
bts = bt
}
func AddTorrent(spec *torrent.TorrentSpec, title, poster string) (*Torrent, error) {
func AddTorrent(spec *torrent.TorrentSpec, title, poster string, data string) (*Torrent, error) {
torr, err := NewTorrent(spec, bts)
if err != nil {
log.TLogln("error add torrent:", err)
@@ -41,6 +41,12 @@ func AddTorrent(spec *torrent.TorrentSpec, title, poster string) (*Torrent, erro
torr.Poster = torDB.Poster
}
}
if torr.Data == "" {
torr.Data = data
if torr.Data == "" && torDB != nil {
torr.Data = torDB.Data
}
}
return torr, nil
}