mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-06 10:07:45 +08:00
feat: api to add torrent hash to blacklist
This commit is contained in:
9
db/db.go
9
db/db.go
@@ -69,9 +69,9 @@ func (c *Client) init() {
|
||||
if tr := c.GetAllDonloadClients(); len(tr) == 0 {
|
||||
log.Warnf("no download client, set default download client")
|
||||
c.SaveDownloader(&ent.DownloadClients{
|
||||
Name: "transmission",
|
||||
Name: "transmission",
|
||||
Implementation: downloadclients.ImplementationTransmission,
|
||||
URL: "http://transmission:9091",
|
||||
URL: "http://transmission:9091",
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -339,7 +339,6 @@ func (c *Client) SaveDownloader(downloader *ent.DownloadClients) error {
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
func (c *Client) GetAllDonloadClients() []*ent.DownloadClients {
|
||||
cc, err := c.ent.DownloadClients.Query().Order(ent.Asc(downloadclients.FieldPriority1)).All(context.TODO())
|
||||
if err != nil {
|
||||
@@ -657,3 +656,7 @@ func (c *Client) CleanAllDanglingEpisodes() error {
|
||||
_, err := c.ent.Episode.Delete().Where(episode.Not(episode.HasMedia())).Exec(context.Background())
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *Client) AddBlacklistItem(item *ent.Blacklist) error {
|
||||
return c.ent.Blacklist.Create().SetType(item.Type).SetValue(item.Value).SetNotes(item.Notes).Exec(context.Background())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user