merge maser

This commit is contained in:
nikk gitanes
2021-08-20 08:10:17 +03:00
41 changed files with 353 additions and 135 deletions

View File

@@ -71,7 +71,7 @@ func addTorrent(req torrReqJS, c *gin.Context) {
req.Link = strings.ReplaceAll(req.Link, "&", "&")
torrSpec, err := utils.ParseLink(req.Link)
if err != nil {
log.TLogln("error add torrent:", err)
log.TLogln("error parse link:", err)
c.AbortWithError(http.StatusBadRequest, err)
return
}
@@ -85,12 +85,18 @@ func addTorrent(req torrReqJS, c *gin.Context) {
go func() {
if !tor.GotInfo() {
log.TLogln("error add torrent:", "timeout connection torrent")
log.TLogln("error add torrent:", "timeout connection get torrent info")
return
}
if tor.Title == "" {
tor.Title = tor.Name()
tor.Title = torrSpec.DisplayName // prefer dn over name
tor.Title = strings.ReplaceAll(tor.Title, "rutor.info", "")
tor.Title = strings.ReplaceAll(tor.Title, "_", " ")
tor.Title = strings.Trim(tor.Title, " ")
if tor.Title == "" {
tor.Title = tor.Name()
}
}
if req.SaveToDB {