Skip to content

Commit 62fd7e2

Browse files
committed
fix: judge episode downloading
1 parent 2641a5f commit 62fd7e2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

db/db.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -534,12 +534,12 @@ func (c *client) SetEpisodeStatus(id int, status episode.Status) error {
534534

535535
func (c *client) IsEpisodeDownloadingOrDownloaded(id int) bool {
536536
ep, _ := c.GetEpisodeByID(id)
537-
his := c.ent.History.Query().Where(history.EpisodeNumsNotNil(), history.StatusNEQ(history.StatusRemoved)).AllX(context.Background())
537+
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())
538538
for _, h := range his {
539-
if !slices.Contains(h.EpisodeNums, ep.EpisodeNumber) {
540-
continue
539+
if len(h.EpisodeNums) == 0 { //season pack download
540+
return true
541541
}
542-
if h.Status != history.StatusFail {
542+
if slices.Contains(h.EpisodeNums, ep.EpisodeNumber) {
543543
return true
544544
}
545545
}

0 commit comments

Comments
 (0)