video.go 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. package model
  2. import (
  3. "time"
  4. )
  5. //video status & attr.
  6. const (
  7. VideoStatusOpen = int16(0)
  8. VideoStatusOrange = int16(10000)
  9. VideoStatusRecycle = int16(-2)
  10. VideoStatusLock = int16(-4)
  11. VideoStatusDelete = -100
  12. ArcStateDelete = -100
  13. RLStateDelete = -100
  14. CopyrightOriginal = int8(1)
  15. VideoXcodeSDFinish = int8(2)
  16. VideoXcodeHDFinish = int8(4)
  17. AttrBitNoRank = uint(0) // NOTE: double write for archive_forbid
  18. // AttrBitNoDynamic 动态禁止
  19. AttrBitNoDynamic = uint(1) // NOTE: double write for archive_forbid
  20. // AttrBitNoWeb 禁止网页输出
  21. AttrBitNoWeb = uint(2)
  22. // AttrBitNoMobile 禁止客户端列表
  23. AttrBitNoMobile = uint(3)
  24. // AttrBitNoSearch 搜索禁止
  25. AttrBitNoSearch = uint(4)
  26. // AttrBitOverseaLock 海外禁止
  27. AttrBitOverseaLock = uint(5)
  28. // AttrBitNoRecommend 禁止推荐
  29. AttrBitNoRecommend = uint(6) // NOTE: double write for archive_forbid
  30. // AttrBitNoReprint 禁止转载
  31. AttrBitNoReprint = uint(7)
  32. // AttrBitHasHD5 是否高清
  33. AttrBitHasHD5 = uint(8)
  34. // AttrBitIsPGC 是否PGC稿件
  35. AttrBitIsPGC = uint(9)
  36. // AttrBitAllowBp 允许承包
  37. AttrBitAllowBp = uint(10)
  38. // AttrBitIsBangumi 是否番剧
  39. AttrBitIsBangumi = uint(11)
  40. // AttrBitIsPorder 是否私单
  41. AttrBitIsPorder = uint(12)
  42. // AttrBitLimitArea 是否限制地区
  43. AttrBitLimitArea = uint(13)
  44. // AttrBitAllowTag 允许其他人添加tag
  45. AttrBitAllowTag = uint(14)
  46. // AttrBitJumpURL 跳转
  47. AttrBitJumpURL = uint(16)
  48. // AttrBitIsMovie 是否影视
  49. AttrBitIsMovie = uint(17)
  50. // AttrBitBadgepay 付费
  51. AttrBitBadgepay = uint(18)
  52. AttrBitPushBlog = uint(20)
  53. )
  54. //qa audit status & attr.
  55. var (
  56. QAAuditStatus = map[int16]string{
  57. VideoStatusOpen: "开放浏览",
  58. VideoStatusOrange: "会员可见",
  59. VideoStatusRecycle: "打回",
  60. VideoStatusLock: "锁定",
  61. }
  62. VideoAttribute = map[uint]string{
  63. AttrBitNoRank: "norank",
  64. AttrBitNoDynamic: "nodynamic",
  65. AttrBitNoWeb: "noweb",
  66. AttrBitNoMobile: "nomobile",
  67. AttrBitNoSearch: "nosearch",
  68. AttrBitOverseaLock: "oversea_block",
  69. AttrBitNoRecommend: "norecommend",
  70. AttrBitNoReprint: "no_reprint",
  71. AttrBitHasHD5: "hd",
  72. AttrBitIsPGC: "is_pgc",
  73. AttrBitAllowBp: "allow_bp",
  74. AttrBitIsBangumi: "bangumi",
  75. AttrBitIsPorder: "is_porder",
  76. AttrBitLimitArea: "limit_area",
  77. AttrBitAllowTag: "allow_tag",
  78. AttrBitJumpURL: "j",
  79. AttrBitIsMovie: "is_movie",
  80. AttrBitBadgepay: "badgepay",
  81. AttrBitPushBlog: "push_blog",
  82. }
  83. )
  84. //Video video info
  85. type Video struct {
  86. ID int64 `json:"id"`
  87. AID int64 `json:"aid"`
  88. CID int64 `json:"cid"`
  89. MID int64 `json:"mid"`
  90. Copyright int8 `json:"copyright"`
  91. TypeID int64 `json:"type_id"`
  92. Status int16 `json:"status"`
  93. Attribute int32 `json:"attribute"`
  94. XcodeState int8 `json:"xcode_state"`
  95. Title string `json:"title"`
  96. Description string `json:"description"`
  97. Filename string `json:"filename"`
  98. TagID int64 `json:"tag_id"`
  99. Reason string `json:"reason"`
  100. Note string `json:"note"`
  101. AttributeList map[string]int32 `json:"attribute_list"`
  102. Encoding int32 `json:"encoding"`
  103. }
  104. //AttributeList get attr as map
  105. func AttributeList(attr int32) (list map[string]int32) {
  106. list = map[string]int32{}
  107. for bit, name := range VideoAttribute {
  108. list[name] = int32(((attr >> bit) & 1))
  109. }
  110. return
  111. }
  112. // AttrSet video Attr set
  113. func (v *Video) AttrSet(attr int32, bit uint) {
  114. v.Attribute = v.Attribute&(^(1 << bit)) | (attr << bit)
  115. }
  116. // ArcVideo is archive_video model.
  117. type ArcVideo struct {
  118. ID int64 `json:"-"`
  119. Aid int64 `json:"aid"`
  120. Title string `json:"title"`
  121. Desc string `json:"desc"`
  122. Filename string `json:"filename"`
  123. SrcType string `json:"-"`
  124. Cid int64 `json:"cid"`
  125. Duration int64 `json:"-"`
  126. Filesize int64 `json:"-"`
  127. Resolutions string `json:"-"`
  128. Index int `json:"index"`
  129. Playurl string `json:"-"`
  130. Status int16 `json:"status"`
  131. StatusDesc string `json:"status_desc"`
  132. FailCode int8 `json:"fail_code"`
  133. FailDesc string `json:"fail_desc"`
  134. XcodeState int8 `json:"xcode"`
  135. Attribute int32 `json:"-"`
  136. RejectReason string `json:"reject_reason"`
  137. WebLink string `json:"weblink"`
  138. CTime time.Time `json:"ctime"`
  139. MTime time.Time `json:"-"`
  140. }