mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
add load torrent to bt client
This commit is contained in:
@@ -21,6 +21,23 @@ func InitApiHelper(bt *BTServer) {
|
|||||||
bts = bt
|
bts = bt
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func LoadTorrent(tor *Torrent) *Torrent {
|
||||||
|
if tor.TorrentSpec == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
tr, err := NewTorrent(tor.TorrentSpec, bts)
|
||||||
|
if err != nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if !tr.WaitInfo() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
tr.Title = tor.Title
|
||||||
|
tr.Poster = tor.Poster
|
||||||
|
tr.Data = tor.Data
|
||||||
|
return tr
|
||||||
|
}
|
||||||
|
|
||||||
func AddTorrent(spec *torrent.TorrentSpec, title, poster string, data string) (*Torrent, error) {
|
func AddTorrent(spec *torrent.TorrentSpec, title, poster string, data string) (*Torrent, error) {
|
||||||
torr, err := NewTorrent(spec, bts)
|
torr, err := NewTorrent(spec, bts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user