internal/structs.go
111 lines · 2927 bytes
1package internal
2
3type AnimeTitle struct {
4 Romaji string `json:"title_romanji"`
5 English string `json:"title"`
6 Japanese string `json:"title_japanese"`
7}
8
9type Anime struct {
10 Title AnimeTitle `json:"title"`
11 Ep Episode `json:"ep"`
12 CoverImage string `json:"url"` // Assuming this field corresponds to the cover image URL
13 TotalEpisodes int `json:"total_episodes"` // If provided by the API
14 MalId int `json:"mal_id"`
15 AnilistId int `json:"anilist_id"` // Assuming you have an Anilist ID in your struct
16 Rewatching bool
17 AllanimeId string // Can be populated as necessary
18}
19
20type Skip struct {
21 Start int `json:"start"`
22 End int `json:"end"`
23}
24
25type SkipTimes struct {
26 Op Skip `json:"op"`
27 Ed Skip `json:"ed"`
28}
29
30type Episode struct {
31 Title AnimeTitle `json:"title"`
32 Number int `json:"number"`
33 SkipTimes SkipTimes `json:"skip_times"`
34 Player playingVideo `json:"player"`
35 Resume bool `json:"resume"`
36 Started bool `json:"started"`
37 Duration int `json:"duration"`
38 Links []string `json:"links"`
39 IsFiller bool `json:"filler"`
40 IsRecap bool `json:"recap"`
41 Aired string `json:"aired"`
42 Synopsis string `json:"synopsis"`
43 ContinueLast bool
44 LastWasSkipped bool // used in filler check
45 IsCompleted bool
46}
47
48type playingVideo struct {
49 Url string
50 Speed float64 `json:"speed"`
51 PlaybackTime int `json:"playback_time"`
52 SocketPath string
53}
54
55type User struct {
56 Token string
57 Username string
58 Id int
59 AnimeList AnimeList
60}
61
62// AniListAnime is the struct for the API response
63type AniListAnime struct {
64 ID int `json:"id"`
65 Title struct {
66 Romaji string `json:"romaji"`
67 English string `json:"english"`
68 Native string `json:"native"`
69 } `json:"title"`
70 CoverImage struct {
71 Large string `json:"large"`
72 } `json:"coverImage"`
73}
74
75// Page represents the page in AniList response
76type Page struct {
77 Media []AniListAnime `json:"media"`
78}
79
80// ResponseData represents the full response structure
81type ResponseData struct {
82 Page Page `json:"Page"`
83}
84
85type Media struct {
86 Duration int `json:"duration"`
87 Episodes int `json:"episodes"`
88 ID int `json:"id"`
89 Title AnimeTitle `json:"title"`
90}
91
92type Entry struct {
93 Media Media `json:"media"`
94 Progress int `json:"progress"`
95 Score float64 `json:"score"`
96 Status string `json:"status"`
97 CoverImage string `json:"coverImage"`
98}
99
100type AnimeList struct {
101 Watching []Entry `json:"watching"`
102 Completed []Entry `json:"completed"`
103 Paused []Entry `json:"paused"`
104 Dropped []Entry `json:"dropped"`
105 Planning []Entry `json:"planning"`
106}
107
108type RofiSelectPreview struct {
109 Title string `json:"title"`
110 CoverImage string `json:"coverImage"`
111}