internal/structs.go

119 lines · 3087 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	FillerEpisodes []int
 19	IsAiring       bool
 20}
 21
 22type Skip struct {
 23	Start int `json:"start"`
 24	End   int `json:"end"`
 25}
 26
 27type SkipTimes struct {
 28	Op Skip `json:"op"`
 29	Ed Skip `json:"ed"`
 30}
 31
 32type Episode struct {
 33	Title          AnimeTitle   `json:"title"`
 34	Number         int          `json:"number"`
 35	SkipTimes      SkipTimes    `json:"skip_times"`
 36	Player         playingVideo `json:"player"`
 37	Resume         bool         `json:"resume"`
 38	Started        bool         `json:"started"`
 39	Duration       int          `json:"duration"`
 40	Links          []string     `json:"links"`
 41	NextEpisode    NextEpisode  `json:"next_episode"`
 42	IsFiller       bool         `json:"filler"`
 43	IsRecap        bool         `json:"recap"`
 44	Aired          string       `json:"aired"`
 45	Synopsis       string       `json:"synopsis"`
 46	ContinueLast   bool
 47	LastWasSkipped bool // used in filler check
 48	IsCompleted    bool
 49}
 50
 51type NextEpisode struct {
 52	Number int
 53	Links  []string
 54}
 55
 56type playingVideo struct {
 57	Url          string
 58	Speed        float64 `json:"speed"`
 59	PlaybackTime int     `json:"playback_time"`
 60	SocketPath   string
 61}
 62
 63type User struct {
 64	Token     string
 65	Username  string
 66	Id        int
 67	AnimeList AnimeList
 68}
 69
 70// AniListAnime is the struct for the API response
 71type AniListAnime struct {
 72	ID    int `json:"id"`
 73	Title struct {
 74		Romaji  string `json:"romaji"`
 75		English string `json:"english"`
 76		Native  string `json:"native"`
 77	} `json:"title"`
 78	CoverImage struct {
 79		Large string `json:"large"`
 80	} `json:"coverImage"`
 81}
 82
 83// Page represents the page in AniList response
 84type Page struct {
 85	Media []AniListAnime `json:"media"`
 86}
 87
 88// ResponseData represents the full response structure
 89type ResponseData struct {
 90	Page Page `json:"Page"`
 91}
 92
 93type Media struct {
 94	Duration int        `json:"duration"`
 95	Episodes int        `json:"episodes"`
 96	ID       int        `json:"id"`
 97	Title    AnimeTitle `json:"title"`
 98}
 99
100type Entry struct {
101	Media      Media   `json:"media"`
102	Progress   int     `json:"progress"`
103	Score      float64 `json:"score"`
104	Status     string  `json:"status"`
105	CoverImage string  `json:"coverImage"`
106}
107
108type AnimeList struct {
109	Watching  []Entry `json:"watching"`
110	Completed []Entry `json:"completed"`
111	Paused    []Entry `json:"paused"`
112	Dropped   []Entry `json:"dropped"`
113	Planning  []Entry `json:"planning"`
114}
115
116type RofiSelectPreview struct {
117	Title      string `json:"title"`
118	CoverImage string `json:"coverImage"`
119}