emby_settings.go 1.4 KB

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