Commit 4af4e7ffd9
Unsigned
Layout: unified · split
cmd/curd/main.go +29 −20
| @@ -9,37 +9,46 @@ import ( | |||
| 9 | "github.com/wraient/curd/internal" | 9 | "github.com/wraient/curd/internal" |
| 10 | ) | 10 | ) |
| 11 | 11 | ||
| 12 | type Title struct { | 12 | type AnimeTitle struct { |
| 13 | Romanji_title string | 13 | Romaji string |
| 14 | English_title string | 14 | English string |
| 15 | Japanese_title string | 15 | Japanese string |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | type Anime struct { | 18 | type Anime struct { |
| 19 | Tit Title | 19 | Tit AnimeTitle |
| 20 | Ep Episode | 20 | Ep Episode |
| 21 | Total_episodes int | 21 | TotalEpisodes int |
| 22 | Mal_id int | 22 | MalId int |
| 23 | Allanime_id string | 23 | AnilistId int |
| 24 | AllanimeId string | ||
| 24 | } | 25 | } |
| 25 | 26 | ||
| 26 | type SkipTimes struct { | 27 | type SkipTimes struct { |
| 27 | Op int | 28 | Op int |
| 28 | Ed int | 29 | Ed int |
| 29 | } | 30 | } |
| 30 | 31 | ||
| 31 | type Episode struct { | 32 | type Episode struct { |
| 32 | Tit Title | 33 | Tit AnimeTitle |
| 33 | Number int | 34 | Number int |
| 34 | Skip_times SkipTimes | 35 | Skip_times SkipTimes |
| 35 | Mode string | 36 | Mode string |
| 36 | Links []string | 37 | Links []string |
| 37 | Is_filler bool | 38 | Is_filler bool |
| 38 | Is_recap bool | 39 | Is_recap bool |
| 39 | Aired string | 40 | Aired string |
| 40 | Synopsis string | 41 | Synopsis string |
| 41 | } | 42 | } |
| 42 | 43 | ||
| 44 | type User struct { | ||
| 45 | token string | ||
| 46 | username string | ||
| 47 | id int | ||
| 48 | animeList internal.AnimeList | ||
| 49 | } | ||
| 50 | |||
| 51 | |||
| 43 | func main(){ | 52 | func main(){ |
| 44 | internal.ClearScreen() | 53 | internal.ClearScreen() |
| 45 | defer internal.RestoreScreen() | 54 | defer internal.RestoreScreen() |
internal/anilist.go +8 −7
| @@ -10,12 +10,6 @@ import ( | |||
| 10 | "strings" | 10 | "strings" |
| 11 | ) | 11 | ) |
| 12 | 12 | ||
| 13 | // AnimeTitle represents the title in different languages | ||
| 14 | type AnimeTitle struct { | ||
| 15 | Romaji string | ||
| 16 | English string | ||
| 17 | Japanese string | ||
| 18 | } | ||
| 19 | 13 | ||
| 20 | // AniListAnime is the struct for the API response | 14 | // AniListAnime is the struct for the API response |
| 21 | type AniListAnime struct { | 15 | type AniListAnime struct { |
| @@ -37,6 +31,13 @@ type ResponseData struct { | |||
| 37 | Page Page `json:"Page"` | 31 | Page Page `json:"Page"` |
| 38 | } | 32 | } |
| 39 | 33 | ||
| 34 | // AnimeTitle represents the title in different languages | ||
| 35 | type AnimeTitle struct { | ||
| 36 | Romaji string | ||
| 37 | English string | ||
| 38 | Japanese string | ||
| 39 | } | ||
| 40 | |||
| 40 | 41 | ||
| 41 | type Media struct { | 42 | type Media struct { |
| 42 | Duration int `json:"duration"` | 43 | Duration int `json:"duration"` |
| @@ -46,7 +47,7 @@ type Media struct { | |||
| 46 | } | 47 | } |
| 47 | 48 | ||
| 48 | type Entry struct { | 49 | type Entry struct { |
| 49 | Media Media `json:"media"` | 50 | Media Media `json:"media"` |
| 50 | Progress int `json:"progress"` | 51 | Progress int `json:"progress"` |
| 51 | Score float64 `json:"score"` | 52 | Score float64 `json:"score"` |
| 52 | Status string `json:"status"` | 53 | Status string `json:"status"` |