feat: api to add torrent hash to blacklist

This commit is contained in:
Simon Ding
2024-10-10 00:49:32 +08:00
parent 7e4d907ef6
commit 5daeca0bd9
28 changed files with 1122 additions and 1137 deletions

View File

@@ -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())
}