mediadata

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnimeSearchFieldPrimaryTitle          = "primary_title"
	AnimeSearchFieldRomajiOfficialTitle   = "romaji_official_title"
	AnimeSearchFieldJapaneseOfficialTitle = "japanese_official_title"
	AnimeSearchFieldEnglishOfficialTitle  = "english_official_title"
)
View Source
const (
	VNSearchFieldJapaneseTitle = "japanese_title"
	VNSearchFieldEnglishTitle  = "english_title"
	VNSearchFieldRomajiTitle   = "romaji_title"
)

Variables

Functions

This section is empty.

Types

type Anime

type Anime struct {
	ID                    string   `json:"id"`
	PrimaryTitle          string   `json:"primaryTitle"`
	RomajiOfficialTitle   string   `json:"romajiOfficialTitle"`
	JapaneseOfficialTitle string   `json:"japaneseOfficialTitle"`
	EnglishOfficialTitle  string   `json:"englishOfficialTitle"`
	Sources               []string `json:"sources"`
	Picture               string   `json:"picture"`
	Thumbnail             string   `json:"thumbnail"`
	Tags                  []string `json:"tags"`
}

func DownloadAnime

func DownloadAnime(ctx context.Context) (anime []Anime, err error)

func (Anime) Marshal

func (a Anime) Marshal() (*bluge.Document, error)

func (*Anime) SearchFields

func (a *Anime) SearchFields() []string

func (*Anime) Unmarshal

func (a *Anime) Unmarshal(fields map[string][]byte) error

type Match

type Match[T any] struct {
	ID    string
	Value *T
	Score float64
	Field string
}

type MatchList

type MatchList[T any] map[string]Match[T]

TODO: Reimplement using a slice

func (MatchList[T]) Insert

func (l MatchList[T]) Insert(match Match[T])

func (MatchList[T]) ToSlice

func (l MatchList[T]) ToSlice() []Match[T]

func (MatchList[T]) Top

func (l MatchList[T]) Top(n int) []Match[T]

type MediaSearcher

type MediaSearcher struct {
	Logger *slog.Logger
	// contains filtered or unexported fields
}

func NewMediaSearcher

func NewMediaSearcher(path string) (s *MediaSearcher)

func (*MediaSearcher) Close

func (s *MediaSearcher) Close() (err error)

func (*MediaSearcher) Open

func (s *MediaSearcher) Open() (err error)

func (*MediaSearcher) ReadAnime

func (s *MediaSearcher) ReadAnime(ctx context.Context, id string) (*Anime, error)

func (*MediaSearcher) ReadVisualNovel

func (s *MediaSearcher) ReadVisualNovel(ctx context.Context, id string) (*VisualNovel, error)

func (*MediaSearcher) SearchAnime

func (s *MediaSearcher) SearchAnime(ctx context.Context, matchQuery string, limit int) ([]Match[Anime], error)

func (*MediaSearcher) SearchVisualNovel

func (s *MediaSearcher) SearchVisualNovel(ctx context.Context, matchQuery string, limit int) ([]Match[VisualNovel], error)

func (*MediaSearcher) UpdateData

func (s *MediaSearcher) UpdateData(ctx context.Context) (err error)

type Read

type Read[T any] interface {
	*T
	Unmarshal(map[string][]byte) error
	SearchFields() []string
}

type Store

type Store interface {
	Marshal() (*bluge.Document, error)
}

type VisualNovel

type VisualNovel struct {
	ID            string
	JapaneseTitle string
	EnglishTitle  string
	RomajiTitle   string
	ImageID       string
	ImageNSFW     bool
}

func DownloadVisualNovels

func DownloadVisualNovels(ctx context.Context) (vns []VisualNovel, err error)

func (VisualNovel) ImageURL

func (vn VisualNovel) ImageURL() string

func (VisualNovel) Marshal

func (vn VisualNovel) Marshal() (*bluge.Document, error)

func (*VisualNovel) SearchFields

func (vn *VisualNovel) SearchFields() []string

func (*VisualNovel) Unmarshal

func (vn *VisualNovel) Unmarshal(fields map[string][]byte) error

Jump to

Keyboard shortcuts

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