otame

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

README

Otame

This is a util package for working with some sources of otaku media. Currently has limited support for AniDB, VNDB, and AnimeOfflineDatabase.

Documentation

Index

Constants

View Source
const (
	AniDBEntryTypePrimary  = "primary"
	AniDBEntryTypeSynonym  = "synonym"
	AniDBEntryTypeShort    = "short"
	AniDBEntryTypeOfficial = "official"
)

Variables

View Source
var ErrFinished = io.EOF

Functions

func DownloadAODB

func DownloadAODB(ctx context.Context) (r io.ReadCloser, err error)

Returns a ReadCloser for the anime-offline-database-minified.json file. The caller is responsible for closing the ReadCloser.

func DownloadAniDB

func DownloadAniDB(ctx context.Context) (r io.ReadCloser, err error)

Returns a ReadCloser for the anidb-titles.dat file The caller is responsible for closing the ReadCloser.

func DownloadVNDB

func DownloadVNDB(ctx context.Context) (*fsCloser, error)

Returns an fs.FS that also implements io.Closer. The caller is responsible for closing the fsCloser. Same as: DownloadVNDBUsingTempDir(ctx, "")

func DownloadVNDBUsingTempDir

func DownloadVNDBUsingTempDir(ctx context.Context, temp string) (fsc *fsCloser, err error)

Returns an fs.FS that also implements io.Closer. The caller is responsible for closing the fsCloser, which will remove the temporary directory.

func NewVNDBImageDecoder

func NewVNDBImageDecoder(r io.Reader) *genericLineDecoder[VNDBImage]

func NewVNDBTitleDecoder

func NewVNDBTitleDecoder(r io.Reader) *genericLineDecoder[VNDBTitle]

func NewVNDBVisualNovelDecoder

func NewVNDBVisualNovelDecoder(r io.Reader) *genericLineDecoder[VNDBVisualNovel]

func VNDBCDNURLFromImageID

func VNDBCDNURLFromImageID(imgID string) string

Types

type AniDBEntry

type AniDBEntry struct {
	AID      string
	Type     string
	Language string
	Title    string
}

type AniDBEntryDecoder

type AniDBEntryDecoder struct {
	// contains filtered or unexported fields
}

func NewAniDBEntryDecoder

func NewAniDBEntryDecoder(r io.Reader) *AniDBEntryDecoder

func (*AniDBEntryDecoder) DecodeAll

func (a *AniDBEntryDecoder) DecodeAll() (entries []AniDBEntry, err error)

func (*AniDBEntryDecoder) Next

func (a *AniDBEntryDecoder) Next() (entry AniDBEntry, err error)

type AnimeOfflineDatabaseDecoder

type AnimeOfflineDatabaseDecoder struct {
	// contains filtered or unexported fields
}

func NewAnimeOfflineDatabaseDecoder

func NewAnimeOfflineDatabaseDecoder(r io.Reader) *AnimeOfflineDatabaseDecoder

func (*AnimeOfflineDatabaseDecoder) DecodeAll

func (a *AnimeOfflineDatabaseDecoder) DecodeAll() (entries []AnimeOfflineDatabaseEntry, err error)

func (*AnimeOfflineDatabaseDecoder) Next

type AnimeOfflineDatabaseEntry

type AnimeOfflineDatabaseEntry struct {
	Sources   []string                   `json:"sources"`
	Title     string                     `json:"title"`
	Type      string                     `json:"type"`
	Episodes  int                        `json:"episodes"`
	Status    string                     `json:"status"`
	Season    AnimeOfflineDatabaseSeason `json:"animeSeason"`
	Picture   string                     `json:"picture"`
	Thumbnail string                     `json:"thumbnail"`
	Synonyms  []string                   `json:"synonyms"`
	Relations []string                   `json:"relations"`
	Tags      []string                   `json:"tags"`
}

type AnimeOfflineDatabaseSeason

type AnimeOfflineDatabaseSeason struct {
	Season string `json:"season"`
	Year   *int   `json:"year"`
}

type Iterator

type Iterator[T any] interface {
	Next() (T, error)
}

type VNDBImage

type VNDBImage struct {
	ID          string
	Width       int
	Height      int
	SexualAvg   int
	SexualDev   int
	ViolenceAvg int
	ViolenceDev int
}

func (VNDBImage) NSFW

func (e VNDBImage) NSFW() bool

type VNDBTitle

type VNDBTitle struct {
	VNID     string
	Language string
	Official bool
	Title    string
	Latin    *string
}

type VNDBVisualNovel

type VNDBVisualNovel struct {
	ID               string
	OriginalLanguage string
	ImageID          *string
}

Jump to

Keyboard shortcuts

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