mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-09 11:39:46 +08:00
fix
This commit is contained in:
12
db/const.go
12
db/const.go
@@ -14,6 +14,7 @@ const (
|
|||||||
SettingNfoSupportEnabled = "nfo_support_enabled"
|
SettingNfoSupportEnabled = "nfo_support_enabled"
|
||||||
SettingAllowQiangban = "filter_qiangban"
|
SettingAllowQiangban = "filter_qiangban"
|
||||||
SettingEnableTmdbAdultContent = "tmdb_adult_content"
|
SettingEnableTmdbAdultContent = "tmdb_adult_content"
|
||||||
|
SetttingSizeLimiter = "size_limiter"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -37,3 +38,14 @@ const (
|
|||||||
type ResolutionType string
|
type ResolutionType string
|
||||||
|
|
||||||
const JwtSerectKey = "jwt_secrect_key"
|
const JwtSerectKey = "jwt_secrect_key"
|
||||||
|
|
||||||
|
type SizeLimiter struct {
|
||||||
|
R720p Limiter `json:"720p"`
|
||||||
|
R1080p Limiter `json:"1080p"`
|
||||||
|
R2160p Limiter `json:"2160p"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Limiter struct {
|
||||||
|
Max int `json:"max"`
|
||||||
|
Min int `json:"min"`
|
||||||
|
}
|
||||||
|
|||||||
25
db/db.go
25
db/db.go
@@ -530,6 +530,16 @@ func (c *Client) SetEpisodeStatus(id int, status episode.Status) error {
|
|||||||
return c.ent.Episode.Update().Where(episode.ID(id)).SetStatus(status).Exec(context.TODO())
|
return c.ent.Episode.Update().Where(episode.ID(id)).SetStatus(status).Exec(context.TODO())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Client) IsEpisodeDownloadingOrDownloaded(id int) bool {
|
||||||
|
his := c.ent.History.Query().Where(history.EpisodeID(id)).AllX(context.Background())
|
||||||
|
for _, h := range his {
|
||||||
|
if h.Status != history.StatusFail {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Client) SetSeasonAllEpisodeStatus(mediaID, seasonNum int, status episode.Status) error {
|
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())
|
return c.ent.Episode.Update().Where(episode.MediaID(mediaID), episode.SeasonNumber(seasonNum)).SetStatus(status).Exec(context.TODO())
|
||||||
}
|
}
|
||||||
@@ -603,3 +613,18 @@ func (c *Client) AddImportlist(il *ent.ImportList) error {
|
|||||||
func (c *Client) DeleteImportlist(id int) error {
|
func (c *Client) DeleteImportlist(id int) error {
|
||||||
return c.ent.ImportList.DeleteOneID(id).Exec(context.TODO())
|
return c.ent.ImportList.DeleteOneID(id).Exec(context.TODO())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Client) GetSizeLimiter() (*SizeLimiter, error) {
|
||||||
|
v := c.GetSetting(SetttingSizeLimiter)
|
||||||
|
var limiter SizeLimiter
|
||||||
|
err := json.Unmarshal([]byte(v), &limiter)
|
||||||
|
return &limiter, err
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) SetSizeLimiter(limiter *SizeLimiter) error {
|
||||||
|
data, err := json.Marshal(limiter)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return c.SetSetting(SetttingSizeLimiter, string(data))
|
||||||
|
}
|
||||||
@@ -55,7 +55,7 @@ func ParseDoulist(doulistUrl string) (*importlist.Response, error) {
|
|||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
n := ppp[1]
|
n := ppp[1]
|
||||||
n1, err := strconv.Atoi(n)
|
n1, err := strconv.Atoi(strings.TrimSpace(n))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("convert year number %s to int error: %v", n, err)
|
log.Errorf("convert year number %s to int error: %v", n, err)
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user