Skip to content

Commit 8973fe9

Browse files
committed
chore: fix prowlarr
1 parent 9d3b206 commit 8973fe9

File tree

3 files changed

+22
-23
lines changed

3 files changed

+22
-23
lines changed

db/db.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,9 @@ func (c *client) SaveIndexer(in *ent.Indexers) error {
268268

269269
count := c.ent.Indexers.Query().Where(indexers.Name(in.Name)).CountX(context.TODO())
270270

271-
if count > 0 || in.ID != 0 {
271+
if count > 0 {
272272
//update setting
273-
return c.ent.Indexers.Update().Where(indexers.ID(in.ID)).SetName(in.Name).SetImplementation(in.Implementation).
273+
return c.ent.Indexers.Update().Where(indexers.Name(in.Name)).SetName(in.Name).SetImplementation(in.Implementation).
274274
SetPriority(in.Priority).SetSeedRatio(in.SeedRatio).SetDisabled(in.Disabled).
275275
SetTvSearch(in.TvSearch).SetMovieSearch(in.MovieSearch).SetSettings("").SetSynced(in.Synced).
276276
SetAPIKey(in.APIKey).SetURL(in.URL).

engine/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func (c *Engine) GetTask(id int) (*Task, bool) {
5757
}
5858

5959
func (c *Engine) reloadUsingBuildinDownloader(h *ent.History) error {
60-
cl, err := buildin.NewDownloader(c.db.GetDownloadDir())
60+
cl, err := c.buildInDownloader()
6161
if err != nil {
6262
log.Warnf("buildin downloader error: %v", err)
6363
}

pkg/buildin/torrent.go

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"net/http"
77
"os"
88
"path/filepath"
9-
"polaris/log"
109
"polaris/pkg"
1110
"strings"
1211

@@ -92,25 +91,25 @@ func (d *Downloader) Download(link, hash, dir string) (pkg.Torrent, error) {
9291
}, nil
9392
}
9493

95-
func NewTorrentFromHash(hash string, downloadDir string) (*Torrent, error) {
96-
cl, err := NewDownloader(downloadDir)
97-
if err != nil {
98-
return nil, errors.Wrap(err, "create downloader")
99-
}
100-
ttt := cl.cl.Torrents()
101-
log.Infof("all torrents: %+v", ttt)
102-
t, _ := cl.cl.AddTorrentInfoHash(metainfo.NewHashFromHex(hash))
103-
// if new {
104-
// return nil, fmt.Errorf("torrent not found")
105-
// }
106-
<-t.GotInfo()
107-
return &Torrent{
108-
t: t,
109-
cl: cl.cl,
110-
hash: hash,
111-
dir: downloadDir,
112-
}, nil
113-
}
94+
// func NewTorrentFromHash(hash string, downloadDir string) (*Torrent, error) {
95+
// cl, err := NewDownloader(downloadDir)
96+
// if err != nil {
97+
// return nil, errors.Wrap(err, "create downloader")
98+
// }
99+
// ttt := cl.cl.Torrents()
100+
// log.Infof("all torrents: %+v", ttt)
101+
// t, _ := cl.cl.AddTorrentInfoHash(metainfo.NewHashFromHex(hash))
102+
// // if new {
103+
// // return nil, fmt.Errorf("torrent not found")
104+
// // }
105+
// <-t.GotInfo()
106+
// return &Torrent{
107+
// t: t,
108+
// cl: cl.cl,
109+
// hash: hash,
110+
// dir: downloadDir,
111+
// }, nil
112+
// }
114113

115114
type Torrent struct {
116115
t *torrent.Torrent

0 commit comments

Comments
 (0)