mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-03 16:37:48 +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 {
|
func (c *client) IsEpisodeDownloadingOrDownloaded(id int) bool {
|
||||||
ep, _ := c.GetEpisodeByID(id)
|
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 {
|
for _, h := range his {
|
||||||
if !slices.Contains(h.EpisodeNums, ep.EpisodeNumber) {
|
if len(h.EpisodeNums) == 0 { //season pack download
|
||||||
continue
|
return true
|
||||||
}
|
}
|
||||||
if h.Status != history.StatusFail {
|
if slices.Contains(h.EpisodeNums, ep.EpisodeNumber) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user