mirror of
https://github.com/simon-ding/polaris.git
synced 2026-02-06 23:21:00 +08:00
fix: judge episode downloading
This commit is contained in:
8
db/db.go
8
db/db.go
@@ -534,12 +534,12 @@ func (c *client) SetEpisodeStatus(id int, status episode.Status) error {
|
||||
|
||||
func (c *client) IsEpisodeDownloadingOrDownloaded(id int) bool {
|
||||
ep, _ := c.GetEpisodeByID(id)
|
||||
his := c.ent.History.Query().Where(history.EpisodeNumsNotNil(), history.StatusNEQ(history.StatusRemoved)).AllX(context.Background())
|
||||
his := c.ent.History.Query().Where(history.MediaID(ep.MediaID),history.SeasonNum(ep.SeasonNumber), history.StatusEQ(history.StatusRemoved), history.StatusNEQ(history.StatusFail)).AllX(context.Background())
|
||||
for _, h := range his {
|
||||
if !slices.Contains(h.EpisodeNums, ep.EpisodeNumber) {
|
||||
continue
|
||||
if len(h.EpisodeNums) == 0 { //season pack download
|
||||
return true
|
||||
}
|
||||
if h.Status != history.StatusFail {
|
||||
if slices.Contains(h.EpisodeNums, ep.EpisodeNumber) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user