mirror of
https://github.com/simon-ding/polaris.git
synced 2026-05-28 21:47:56 +08:00
fix: remove history
This commit is contained in:
3
db/db.go
3
db/db.go
@@ -534,7 +534,7 @@ 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.MediaID(ep.MediaID),history.SeasonNum(ep.SeasonNumber), history.StatusEQ(history.StatusRemoved), history.StatusNEQ(history.StatusFail)).AllX(context.Background())
|
his := c.ent.History.Query().Where(history.MediaID(ep.MediaID), history.SeasonNum(ep.SeasonNumber), history.StatusNEQ(history.StatusRemoved), history.StatusNEQ(history.StatusFail)).AllX(context.Background())
|
||||||
for _, h := range his {
|
for _, h := range his {
|
||||||
if len(h.EpisodeNums) == 0 { //season pack download
|
if len(h.EpisodeNums) == 0 { //season pack download
|
||||||
return true
|
return true
|
||||||
@@ -751,7 +751,6 @@ func (c *client) GetTmdbApiKey() string {
|
|||||||
return k
|
return k
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func (c *client) AddTorrent2Blacklist(hash, name string, mediaId int) error {
|
func (c *client) AddTorrent2Blacklist(hash, name string, mediaId int) error {
|
||||||
count := c.ent.Blacklist.Query().Where(blacklist.TorrentHash(hash), blacklist.MediaID(mediaId)).CountX(context.TODO())
|
count := c.ent.Blacklist.Query().Where(blacklist.TorrentHash(hash), blacklist.MediaID(mediaId)).CountX(context.TODO())
|
||||||
if count > 0 { //already exist
|
if count > 0 { //already exist
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ func (s *Server) RemoveActivity(c *gin.Context) (interface{}, error) {
|
|||||||
}
|
}
|
||||||
if !s.db.IsEpisodeDownloadingOrDownloaded(id) && ep.Status != episode.StatusDownloaded {
|
if !s.db.IsEpisodeDownloadingOrDownloaded(id) && ep.Status != episode.StatusDownloaded {
|
||||||
//没有正在下载中或者下载完成的任务,并且episode状态不是已经下载完成
|
//没有正在下载中或者下载完成的任务,并且episode状态不是已经下载完成
|
||||||
|
log.Debugf("set episode (%d) status to missing", id)
|
||||||
s.db.SetEpisodeStatus(id, episode.StatusMissing)
|
s.db.SetEpisodeStatus(id, episode.StatusMissing)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user