fix torrents not creating because they are duplicates
This commit is contained in:
9
utils.go
9
utils.go
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user