mirror of
https://github.com/ultrasn0w/huso.git
synced 2025-12-14 06:09:52 +01:00
Use own struct
This commit is contained in:
41
schaffer.go
41
schaffer.go
@@ -5,6 +5,47 @@ import (
|
||||
"errors"
|
||||
)
|
||||
|
||||
func JikanConvert(jik *SeasonAnimeJikan) AnimeDetail {
|
||||
res := AnimeDetail{
|
||||
Title: jik.Title,
|
||||
TitleEn: jik.TitleEnglish,
|
||||
TitleJp: jik.TitleJapanese,
|
||||
ImageMediumURL: jik.Images.Jpg.ImageURL,
|
||||
ImageLargeURL: jik.Images.Jpg.LargeImageURL,
|
||||
ImageThumbURL: jik.Images.Jpg.SmallImageURL,
|
||||
Type: jik.Type,
|
||||
Status: jik.Status,
|
||||
Episodes: jik.Episodes,
|
||||
Synopsis: jik.Synopsis,
|
||||
StartDate: jik.Aired.From,
|
||||
EndDate: jik.Aired.To,
|
||||
Year: jik.Year,
|
||||
Season: jik.Season,
|
||||
Score: jik.Score,
|
||||
ScoredBy: jik.ScoredBy,
|
||||
Rank: jik.Rank,
|
||||
Popularity: jik.Popularity,
|
||||
Members: jik.Members,
|
||||
Source: jik.Source,
|
||||
DayOfTheWeek: jik.Broadcast.Day,
|
||||
StartTime: jik.Broadcast.Time,
|
||||
TrailerURL: jik.Trailer.URL,
|
||||
}
|
||||
for _, g := range jik.Genres {
|
||||
res.Genres = append(res.Genres, AnimeGenre{
|
||||
ID: g.MalID,
|
||||
Name: g.Name,
|
||||
})
|
||||
}
|
||||
for _, s := range jik.Studios {
|
||||
res.Studios = append(res.Studios, AnimeStudio{
|
||||
ID: s.MalID,
|
||||
Name: s.Name,
|
||||
})
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func GetSeasonCache() (*SeasonJikan, error) {
|
||||
data, err := cache.Get(seasonApiJikan)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user