anilist

package
v0.0.0-...-2971d17 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 10, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const ListMediaTableName = "anilist_list_media"
View Source
const ListTableName = "anilist_list"
View Source
const MediaGenreTableName = "anilist_media_genre"
View Source
const MediaTableName = "anilist_media"

Variables

View Source
var ListColumn = ListColumnStruct{
	Id:        "id",
	UpdatedAt: "uat",
}
View Source
var ListColumns = []string{
	ListColumn.Id,
	ListColumn.UpdatedAt,
}
View Source
var ListMediaColumn = ListMediaColumnStruct{
	MediaId: "media_id",
	ListId:  "list_id",
	Score:   "score",
}
View Source
var ListMediaColumns = []string{
	ListMediaColumn.ListId,
	ListMediaColumn.MediaId,
	ListMediaColumn.Score,
}
View Source
var MediaColumn = MediaColumnStruct{
	Id:          "id",
	Type:        "type",
	Title:       "title",
	Description: "description",
	Banner:      "banner",
	Cover:       "cover",
	Duration:    "duration",
	IsAdult:     "is_adult",
	StartYear:   "start_year",
	UpdatedAt:   "uat",
}
View Source
var MediaColumns = []string{
	MediaColumn.Id,
	MediaColumn.Type,
	MediaColumn.Title,
	MediaColumn.Description,
	MediaColumn.Banner,
	MediaColumn.Cover,
	MediaColumn.Duration,
	MediaColumn.IsAdult,
	MediaColumn.StartYear,
	MediaColumn.UpdatedAt,
}
View Source
var MediaGenreColumn = MediaGenreColumnStruct{
	MediaId: "media_id",
	Genre:   "genre",
}

Functions

func EnsureIdMap

func EnsureIdMap(medias []AniListMedia, listId string) error

func IsValidSearchList

func IsValidSearchList(name string) bool

func ScheduleIdMapSync

func ScheduleIdMapSync(medias []AniListMedia)

func UpsertList

func UpsertList(list *AniListList) (err error)

Types

type AniListList

type AniListList struct {
	Id        string       `json:"id"`
	UpdatedAt db.Timestamp `json:"uat"`

	Medias []AniListMedia `json:"-"`
}

func GetListById

func GetListById(id string) (*AniListList, error)

func (*AniListList) Fetch

func (l *AniListList) Fetch() error

func (*AniListList) GetDisplayName

func (l *AniListList) GetDisplayName() string

func (*AniListList) GetName

func (l *AniListList) GetName() string

func (*AniListList) GetURL

func (l *AniListList) GetURL() string

func (*AniListList) GetUserName

func (l *AniListList) GetUserName() string

func (*AniListList) IsStale

func (l *AniListList) IsStale() bool

type AniListListMedia

type AniListListMedia struct {
	ListId  string `json:"list_id"`
	MediaId int    `json:"media_id"`
	Score   int    `json:"score"`
}

type AniListMedia

type AniListMedia struct {
	Id          int          `json:"id"`
	Type        MediaFormat  `json:"type"`
	Title       string       `json:"title"`
	Description string       `json:"description"`
	Banner      string       `json:"banner"`
	Cover       string       `json:"cover"`
	Duration    int          `json:"duration"`
	IsAdult     bool         `json:"is_adult"`
	StartYear   int          `json:"start_year"`
	UpdatedAt   db.Timestamp `json:"uat"`

	Genres genreList         `json:"-"`
	Score  int               `json:"-"`
	IdMap  *anime.AnimeIdMap `json:"-"`
}

func (*AniListMedia) IsStale

func (m *AniListMedia) IsStale() bool

type AniListMediaGenre

type AniListMediaGenre struct {
	MediaId int    `json:"media_id"`
	Genre   string `json:"genre"`
}

type Genre

type Genre = string
const (
	GenreAction        Genre = "Action"
	GenreAdventure     Genre = "Adventure"
	GenreComedy        Genre = "Comedy"
	GenreDrama         Genre = "Drama"
	GenreEcchi         Genre = "Ecchi"
	GenreFantasy       Genre = "Fantasy"
	GenreHentai        Genre = "Hentai"
	GenreHorror        Genre = "Horror"
	GenreMahouShoujo   Genre = "Mahou Shoujo"
	GenreMecha         Genre = "Mecha"
	GenreMusic         Genre = "Music"
	GenreMystery       Genre = "Mystery"
	GenrePsychological Genre = "Psychological"
	GenreRomance       Genre = "Romance"
	GenreSciFi         Genre = "Sci-Fi"
	GenreSliceOfLife   Genre = "Slice of Life"
	GenreSports        Genre = "Sports"
	GenreSupernatural  Genre = "Supernatural"
)

type List

type List struct {
	UserName       string
	Name           string
	IsCustom       bool
	MediaIds       []int
	ScoreByMediaId map[int]int
}

func FetchSearchList

func FetchSearchList(name string) (*List, error)

func FetchUserList

func FetchUserList(userName, name string) (*List, error)

func (List) GetId

func (l List) GetId() string

type ListColumnStruct

type ListColumnStruct struct {
	Id        string
	UpdatedAt string
}

type ListMedia

type ListMedia struct {
	Id    int
	Score int
}

type ListMediaColumnStruct

type ListMediaColumnStruct struct {
	ListId  string
	MediaId string
	Score   string
}

type Media

type Media struct {
	Id          int
	IdMal       int
	Format      MediaFormat
	Title       string
	Description string
	BannerImage string
	CoverImage  string
	Duration    int
	IsAdult     bool
	Genres      []string
	StartYear   int
}

func FetchMedias

func FetchMedias(mediaIds []int) ([]Media, error)

type MediaColumnStruct

type MediaColumnStruct struct {
	Id          string
	Type        string
	Title       string
	Description string
	Banner      string
	Cover       string
	Duration    string
	IsAdult     string
	StartYear   string
	UpdatedAt   string
}

type MediaFormat

type MediaFormat string
const (
	MediaFormatTV      MediaFormat = "TV"
	MediaFormatTVShort MediaFormat = "TV_SHORT"
	MediaFormatMovie   MediaFormat = "MOVIE"
	MediaFormatSpecial MediaFormat = "SPECIAL"
	MediaFormatOVA     MediaFormat = "OVA"
	MediaFormatONA     MediaFormat = "ONA"
	MediaFormatMusic   MediaFormat = "MUSIC"
	MediaFormatManga   MediaFormat = "MANGA"
	MediaFormatNovel   MediaFormat = "NOVEL"
	MediaFormatOneShot MediaFormat = "ONE_SHOT"
)

func (MediaFormat) ToSimple

func (mf MediaFormat) ToSimple() string

type MediaFormatInfo

type MediaFormatInfo struct {
	Id     int
	IdMal  int
	Format MediaFormat
}

func FetchAnimeMediaFormatInfo

func FetchAnimeMediaFormatInfo(mediaIds []int) ([]MediaFormatInfo, error)

type MediaGenreColumnStruct

type MediaGenreColumnStruct struct {
	MediaId string
	Genre   string
}

type MediaSeason

type MediaSeason string
const (
	MediaSeasonWinter MediaSeason = "WINTER"
	MediaSeasonSpring MediaSeason = "SPRING"
	MediaSeasonSummer MediaSeason = "SUMMER"
	MediaSeasonFall   MediaSeason = "FALL"
)

type MediaSort

type MediaSort string
const (
	MediaSortTrendingDesc   MediaSort = "TRENDING_DESC"
	MediaSortPopularityDesc MediaSort = "POPULARITY_DESC"
	MediaSortScoreDesc      MediaSort = "SCORE_DESC"
)

type SearchAnimeListData

type SearchAnimeListData struct {
	Page struct {
		Media []struct {
			Id int `json:"id"`
		} `json:"media"`
	} `json:"Page"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL