emby_settings.go 1.4 KB

12345678910111213141516171819202122232425262728293031
  1. package settings
  2. import (
  3. "github.com/allanpk716/ChineseSubFinder/internal/types/common"
  4. )
  5. type EmbySettings struct {
  6. Enable bool `json:"enable"` // 是否启用
  7. AddressUrl string `json:"address_url"` // 内网服务器的 url
  8. APIKey string `json:"api_key"` // API key
  9. MaxRequestVideoNumber int `json:"max_request_video_number"` // 最大请求获取视频的数量
  10. SkipWatched bool `json:"skip_watched"` // 是否跳过已经观看的
  11. MoviePathsMapping map[string]string `json:"movie_paths_mapping"` // 电影目录的映射,一旦 common setting 的目录修改,需要提示用户确认映射
  12. SeriesPathsMapping map[string]string `json:"series_paths_mapping"` // 连续剧目录的映射,一旦 common setting 的目录修改,需要提示用户确认映射
  13. }
  14. func NewEmbySettings() *EmbySettings {
  15. return &EmbySettings{
  16. MaxRequestVideoNumber: 500,
  17. MoviePathsMapping: make(map[string]string, 0),
  18. SeriesPathsMapping: make(map[string]string, 0),
  19. }
  20. }
  21. func (e EmbySettings) Check() {
  22. if e.MaxRequestVideoNumber < common.EmbyApiGetItemsLimitMin ||
  23. e.MaxRequestVideoNumber > common.EmbyApiGetItemsLimitMax {
  24. e.MaxRequestVideoNumber = common.EmbyApiGetItemsLimitMin
  25. }
  26. }