Fix regex

This commit is contained in:
Mukhtar Akere
2025-03-21 17:55:19 +01:00
parent 8d494fc277
commit f93d489956
3 changed files with 4 additions and 38 deletions
-34
View File
@@ -1,12 +1,9 @@
package arr
import (
"cmp"
"fmt"
"github.com/sirrobot01/debrid-blackhole/internal/request"
"net/http"
"strconv"
"strings"
)
func (a *Arr) Refresh() error {
@@ -26,34 +23,3 @@ func (a *Arr) Refresh() error {
return fmt.Errorf("failed to refresh: %v", err)
}
func (a *Arr) Blacklist(infoHash string) error {
downloadId := strings.ToUpper(infoHash)
history := a.GetHistory(downloadId, "grabbed")
if history == nil {
return nil
}
torrentId := 0
for _, record := range history.Records {
if strings.EqualFold(record.DownloadID, downloadId) {
torrentId = record.ID
break
}
}
if torrentId != 0 {
url, err := request.JoinURL(a.Host, "history/failed/", strconv.Itoa(torrentId))
if err != nil {
return err
}
req, err := http.NewRequest(http.MethodPost, url, nil)
if err != nil {
return err
}
client := &http.Client{}
_, err = client.Do(req)
if err == nil {
return fmt.Errorf("failed to mark %s as failed: %v", cmp.Or(a.Name, a.Host), err)
}
}
return nil
}