-
Notifications
You must be signed in to change notification settings - Fork 62
/
subject.go
95 lines (84 loc) · 2.16 KB
/
subject.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// SPDX-License-Identifier: AGPL-3.0-only
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, version 3.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>
package model
const subjectLocked = 2
type Tag struct {
Name string
Count int
}
type Subject struct {
Image string
Summary string
Name string
Date string // first release date
NameCN string
Infobox string
CompatRawTags []byte // compat field for old tags
Tags []Tag
OnHold uint32
Dropped uint32
Series bool
Volumes uint32 // book volumes count from episode
Eps uint32 // episode count from episode
Wish uint32
Collect uint32
Doing uint32
ID SubjectID
PlatformID uint16
TypeID SubjectType
Ban uint8
Airtime uint8 // air weekday, start from
NSFW bool
Rating Rating
Redirect SubjectID
}
func (s Subject) GetID() SubjectID {
return s.ID
}
func (s Subject) Locked() bool {
return s.Ban == subjectLocked
}
type Count struct {
Field1 uint32
Field2 uint32
Field3 uint32
Field4 uint32
Field5 uint32
Field6 uint32
Field7 uint32
Field8 uint32
Field9 uint32
Field10 uint32
}
type Rating struct {
Rank uint32
Total uint32
Count Count
Score float64
}
type Platform struct {
Alias string `json:"alias"`
Type string `json:"type"`
TypeCN string `json:"type_cn"`
WikiTpl string `json:"wiki_tpl"`
SearchString string `json:"search_string"`
ID int `json:"id"`
EnableHeader bool `json:"enable_header"`
}
func (p Platform) String() string {
if p.TypeCN != "" {
return p.TypeCN
}
return p.Type
}