bato

package
v0.0.0-...-bd23c5e Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2025 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Domain = "https://bato.to"

	QueryTag          = "word"
	GenresTag         = "genres"
	OriginalLangTag   = "orig"
	TranslatedLangTag = "lang"
	StatusTag         = "status"
	UploadTag         = "upload"
)

Variables

View Source
var (
	VolumeChapterRegexes = []volumeChapterMapping{
		{regexp.MustCompile(`(?:(?:Volume|Vol\.?) (\d+)\s+)?(?:Chapter|Ch\.?) ([\d\\.]+)`), ""},
		{regexp.MustCompile(`(?:\[S(\d+)] ?)?Episode ([\d\\.]+)`), ""},
	}
	AuthorMappings = map[string]comicinfo.Roles{
		"(Story&Art)": {comicinfo.Writer, comicinfo.Colorist},
		"(Story)":     {comicinfo.Writer},
		"(Art)":       {comicinfo.Colorist},
	}
	TitleCleans = []string{
		"Official",
		"Unofficial",
		"Mature",
	}
	Braces = map[string]string{
		"[": "]",
		"(": ")",
		"«": "»",
	}
)

TODO: Make these configurable? Especially mapping and cleans

Would be fun to have YAMLs for these. I think UI/DB is over the top for them
But maybe not?

Functions

func New

func New(scope *dig.Scope) core.Downloadable

Types

type Author

type Author struct {
	Name  string
	Roles comicinfo.Roles
}

type Builder

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

func NewBuilder

func NewBuilder(log zerolog.Logger, httpClient *menou.Client, ps core.Client, repository Repository, cache services.CacheService) *Builder

func (*Builder) Client

func (b *Builder) Client() services.Client

func (*Builder) DownloadMetadata

func (b *Builder) DownloadMetadata() payload.DownloadMetadata

func (*Builder) Logger

func (b *Builder) Logger() zerolog.Logger

func (*Builder) Normalize

func (b *Builder) Normalize(t []SearchResult) []payload.Info

func (*Builder) Provider

func (b *Builder) Provider() models.Provider

func (*Builder) Search

func (b *Builder) Search(s SearchOptions) ([]SearchResult, error)

func (*Builder) Transform

func (b *Builder) Transform(request payload.SearchRequest) SearchOptions

type Chapter

type Chapter struct {
	Id      string
	Title   string
	Volume  string
	Chapter string
}

func (Chapter) ChapterFloat

func (c Chapter) ChapterFloat() float64

func (Chapter) GetChapter

func (c Chapter) GetChapter() string

func (Chapter) GetId

func (c Chapter) GetId() string

func (Chapter) GetTitle

func (c Chapter) GetTitle() string

func (Chapter) GetVolume

func (c Chapter) GetVolume() string

func (Chapter) VolumeFloat

func (c Chapter) VolumeFloat() float64

type ImageRenderProps

type ImageRenderProps struct {
	PageOpts   []any `json:"pageOpts"`
	ImageFiles []any `json:"imageFiles"`
	UrlP       []any `json:"urlP"`
}

type Publication

type Publication string
const (
	PublicationPending   Publication = "pending"
	PublicationOngoing   Publication = "ongoing"
	PublicationCompleted Publication = "completed"
	PublicationHiatus    Publication = "hiatus"
	PublicationCancelled Publication = "cancelled"
)

type Repository

type Repository interface {
	Search(ctx context.Context, options SearchOptions) ([]SearchResult, error)
	SeriesInfo(ctx context.Context, id string) (Series, error)
	ChapterImages(ctx context.Context, id string) ([]string, error)
}

func NewRepository

func NewRepository(httpClient *menou.Client, logger zerolog.Logger, markdown services.MarkdownService) Repository

type SearchOptions

type SearchOptions struct {
	Query              string
	Genres             []string
	OriginalLang       []string
	TranslatedLang     []string
	OriginalWorkStatus []Publication
	BatoUploadStatus   []Publication
}

type SearchResult

type SearchResult struct {
	Id            string
	ImageUrl      string
	Title         string
	Authors       []string
	Tags          []string
	LatestChapter string
	UploaderImg   string
	LastUploaded  string
}

type Series

type Series struct {
	Id                string
	Title             string
	CoverUrl          string
	OriginalTitle     string
	Authors           []Author
	Tags              []string
	PublicationStatus Publication
	BatoUploadStatus  Publication
	Summary           string
	WebLinks          []string
	Chapters          []Chapter
}

func (*Series) AllChapters

func (s *Series) AllChapters() []Chapter

func (*Series) GetId

func (s *Series) GetId() string

func (*Series) GetTitle

func (s *Series) GetTitle() string

func (*Series) RefUrl

func (s *Series) RefUrl() string

Jump to

Keyboard shortcuts

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