-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathanime_file.go
62 lines (57 loc) · 1.79 KB
/
anime_file.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
package anitogo
import "reflect"
// AnimeFile describes a file that we are being asked te parse the name of
type AnimeFile struct {
AnimeSeason []uint
AnimeSeasonPrefix string // S
AnimeTitle string
AnimeType []string // S
AnimeYear uint
AudioTerm []string // S
DeviceCompatibility []string // S
EpisodeNumber []uint
EpisodeNumberAlt uint
EpisodePrefix string // S
EpisodeTitle string
FileChecksum string //S
FileExtension string
FileName string
Language []string // S
Other []string // S
ReleaseGroup string // S
ReleaseInformation []string // S
ReleaseVersion uint // S
Source []string // S
Subtitles string // S
VideoResolution string //S
VideoTerm []string // S
VolumeNumber uint
VolumePrefix string //S
Unknown string
checkAltNumber bool
}
// fieldSearchable returns whether a given field is considered searchable or not
func (AnimeFile) fieldSearchable(field interface{}) bool {
searchableFields := map[string]bool{
"AnimeSeasonPrefix": true,
"AnimeType": true,
"AudioTerm": true,
"DeviceCompatibility": true,
"EpisodePrefix": true,
"FileChecksum": true,
"Language": true,
"Other": true,
"ReleaseGroup": true,
"ReleaseInformation": true,
"ReleaseVersion": true,
"Source": true,
"Subtitles": true,
"VideoResolution": true,
"VideoTerm": true,
"VolumePrefix": true,
}
indirect := reflect.Indirect(reflect.ValueOf(field))
fieldName := indirect.Type().Name()
searchable, found := searchableFields[fieldName]
return searchable && found
}