fix torrents not creating because they are duplicates

This commit is contained in:
2026-02-03 18:38:01 +03:00
parent 7d647a00b4
commit 82b0c567fe
4 changed files with 40 additions and 11 deletions

View File

@@ -4,6 +4,7 @@ import (
"crypto/sha1"
"fmt"
"net/http"
"strconv"
"strings"
"github.com/PuerkitoBio/goquery"
@@ -45,3 +46,11 @@ func toSha1(b []byte) string {
hash.Write(b)
return fmt.Sprintf("%x", hash.Sum(nil))
}
func toIntOr(s string, defaultValue int) int {
v, err := strconv.Atoi(s)
if err != nil {
return defaultValue
}
return v
}