mirror of
https://github.com/simon-ding/polaris.git
synced 2026-04-20 10:47:30 +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"
|
||||
SettingAllowQiangban = "filter_qiangban"
|
||||
SettingEnableTmdbAdultContent = "tmdb_adult_content"
|
||||
SetttingSizeLimiter = "size_limiter"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -37,3 +38,14 @@ const (
|
||||
type ResolutionType string
|
||||
|
||||
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())
|
||||
}
|
||||
|
||||
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 {
|
||||
return c.ent.Episode.Update().Where(episode.MediaID(mediaID), episode.SeasonNumber(seasonNum)).SetStatus(status).Exec(context.TODO())
|
||||
}
|
||||
@@ -602,4 +612,19 @@ func (c *Client) AddImportlist(il *ent.ImportList) error {
|
||||
|
||||
func (c *Client) DeleteImportlist(id int) error {
|
||||
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
|
||||
} else {
|
||||
n := ppp[1]
|
||||
n1, err := strconv.Atoi(n)
|
||||
n1, err := strconv.Atoi(strings.TrimSpace(n))
|
||||
if err != nil {
|
||||
log.Errorf("convert year number %s to int error: %v", n, err)
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user