feat: self calculate required torrent hash

This commit is contained in:
Simon Ding
2024-10-10 09:01:51 +08:00
parent 37ad1391db
commit 19f21ddd6e
5 changed files with 47 additions and 77 deletions

View File

@@ -9,6 +9,7 @@ import (
"net/url"
"polaris/db"
"polaris/log"
"polaris/pkg/utils"
"slices"
"strconv"
"time"
@@ -80,9 +81,14 @@ func (r *Response) ToResults(indexer *db.TorznabInfo) []Result {
if slices.Contains(item.Category, "3000") { //exclude audio files
continue
}
link, err := utils.Link2Magnet(item.Link)
if err != nil {
log.Warnf("converting link to magnet error, error: %v, link: %v", err, item.Link)
continue
}
r := Result{
Name: item.Title,
Link: item.Link,
Link: link,
Size: mustAtoI(item.Size),
Seeders: mustAtoI(item.GetAttr("seeders")),
Peers: mustAtoI(item.GetAttr("peers")),