mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-07 18:48:00 +08:00
feat: add season package download ability
This commit is contained in:
21
db/db.go
21
db/db.go
@@ -175,14 +175,14 @@ func (c *Client) GetMediaDetails(id int) *MediaDetails {
|
||||
var md = &MediaDetails{
|
||||
Media: se,
|
||||
}
|
||||
if se.MediaType == media.MediaTypeTv {
|
||||
ep, err := se.QueryEpisodes().All(context.Background())
|
||||
if err != nil {
|
||||
log.Errorf("get episodes %d: %v", id, err)
|
||||
return nil
|
||||
}
|
||||
md.Episodes = ep
|
||||
|
||||
ep, err := se.QueryEpisodes().All(context.Background())
|
||||
if err != nil {
|
||||
log.Errorf("get episodes %d: %v", id, err)
|
||||
return nil
|
||||
}
|
||||
md.Episodes = ep
|
||||
|
||||
return md
|
||||
}
|
||||
|
||||
@@ -325,7 +325,6 @@ func (c *Client) AddStorage(st *StorageInfo) error {
|
||||
st.Settings["movie_path"] += "/"
|
||||
}
|
||||
|
||||
|
||||
data, err := json.Marshal(st.Settings)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "json marshal")
|
||||
@@ -477,6 +476,10 @@ func (c *Client) SetEpisodeStatus(id int, status episode.Status) error {
|
||||
return c.ent.Episode.Update().Where(episode.ID(id)).SetStatus(status).Exec(context.TODO())
|
||||
}
|
||||
|
||||
func (c *Client) SetSeasonAllEpisodeStatus(mediaID, seasonNum int, status episode.Status) error {
|
||||
return c.ent.Episode.Update().Where(episode.MediaID(mediaID), episode.SeasonNumber(seasonNum)).SetStatus(status).Exec(context.TODO())
|
||||
}
|
||||
|
||||
func (c *Client) TmdbIdInWatchlist(tmdb_id int) bool {
|
||||
return c.ent.Media.Query().Where(media.TmdbID(tmdb_id)).CountX(context.TODO()) > 0
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user