mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
set torrent name if empty title
This commit is contained in:
@@ -107,21 +107,37 @@ func GetTorrent(hashHex string) *Torrent {
|
|||||||
|
|
||||||
func SetTorrent(hashHex, title, poster, data string) *Torrent {
|
func SetTorrent(hashHex, title, poster, data string) *Torrent {
|
||||||
hash := metainfo.NewHashFromHex(hashHex)
|
hash := metainfo.NewHashFromHex(hashHex)
|
||||||
tor := bts.GetTorrent(hash)
|
torr := bts.GetTorrent(hash)
|
||||||
if tor != nil {
|
torrDb := GetTorrentDB(hash)
|
||||||
tor.Title = title
|
|
||||||
tor.Poster = poster
|
if title == "" && torr == nil && torrDb != nil {
|
||||||
tor.Data = data
|
torr = GetTorrent(hashHex)
|
||||||
|
torr.GotInfo()
|
||||||
|
if torr.Torrent != nil && torr.Torrent.Info() != nil {
|
||||||
|
title = torr.Info().Name
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tor = GetTorrentDB(hash)
|
if torr != nil {
|
||||||
if tor != nil {
|
if title == "" && torr.Torrent != nil && torr.Torrent.Info() != nil {
|
||||||
tor.Title = title
|
title = torr.Info().Name
|
||||||
tor.Poster = poster
|
}
|
||||||
tor.Data = data
|
torr.Title = title
|
||||||
AddTorrentDB(tor)
|
torr.Poster = poster
|
||||||
|
torr.Data = data
|
||||||
|
}
|
||||||
|
|
||||||
|
if torrDb != nil {
|
||||||
|
torrDb.Title = title
|
||||||
|
torrDb.Poster = poster
|
||||||
|
torrDb.Data = data
|
||||||
|
AddTorrentDB(torrDb)
|
||||||
|
}
|
||||||
|
if torr != nil {
|
||||||
|
return torr
|
||||||
|
} else {
|
||||||
|
return torrDb
|
||||||
}
|
}
|
||||||
return tor
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func RemTorrent(hashHex string) {
|
func RemTorrent(hashHex string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user