mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
prefer dn over name with empty title
This commit is contained in:
@@ -71,7 +71,7 @@ func addTorrent(req torrReqJS, c *gin.Context) {
|
|||||||
req.Link = strings.ReplaceAll(req.Link, "&", "&")
|
req.Link = strings.ReplaceAll(req.Link, "&", "&")
|
||||||
torrSpec, err := utils.ParseLink(req.Link)
|
torrSpec, err := utils.ParseLink(req.Link)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.TLogln("error add torrent:", err)
|
log.TLogln("error parse link:", err)
|
||||||
c.AbortWithError(http.StatusBadRequest, err)
|
c.AbortWithError(http.StatusBadRequest, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -85,13 +85,16 @@ func addTorrent(req torrReqJS, c *gin.Context) {
|
|||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
if !tor.GotInfo() {
|
if !tor.GotInfo() {
|
||||||
log.TLogln("error add torrent:", "timeout connection torrent")
|
log.TLogln("error add torrent:", "timeout connection get torrent info")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if tor.Title == "" {
|
||||||
|
tor.Title = torrSpec.DisplayName // prefer dn over name
|
||||||
if tor.Title == "" {
|
if tor.Title == "" {
|
||||||
tor.Title = tor.Name()
|
tor.Title = tor.Name()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if req.SaveToDB {
|
if req.SaveToDB {
|
||||||
torr.SaveTorrentToDB(tor)
|
torr.SaveTorrentToDB(tor)
|
||||||
|
|||||||
Reference in New Issue
Block a user