Skip to content

Commit

Permalink
feat: api to add torrent hash to blacklist
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-ding committed Oct 9, 2024
1 parent 7e4d907 commit 5daeca0
Show file tree
Hide file tree
Showing 28 changed files with 1,122 additions and 1,137 deletions.
9 changes: 6 additions & 3 deletions db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
})
}
}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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())
}
77 changes: 47 additions & 30 deletions ent/blocklist.go → ent/blacklist.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 20 additions & 11 deletions ent/blocklist/blocklist.go → ent/blacklist/blacklist.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5daeca0

Please sign in to comment.