subtitle_subject.go 538 B

123456789101112131415161718192021222324
  1. package model
  2. // Subtitle state
  3. const (
  4. AttrSubtitleClose = uint(1) // 关闭稿件字幕
  5. )
  6. // SubtitleSubject .
  7. type SubtitleSubject struct {
  8. Aid int64 `json:"aid"`
  9. Allow bool `json:"allow"`
  10. Attr int32 `json:"attr"`
  11. Lan uint8 `json:"lan"`
  12. }
  13. // AttrVal return val of subtitle subject'attr
  14. func (s *SubtitleSubject) AttrVal(bit uint) int32 {
  15. return (s.Attr >> bit) & int32(1)
  16. }
  17. // AttrSet set val of subtitle subject'attr
  18. func (s *SubtitleSubject) AttrSet(v int32, bit uint) {
  19. s.Attr = s.Attr&(^(1 << bit)) | (v << bit)
  20. }