kemono

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCreatorNotFound = errors.New("creator not found")
View Source
var ErrInvalidTimeType = errors.New("invalid time type")
View Source
var ErrNoAudio = errors.New("no audio file")
View Source
var ErrNoHosts = errors.New("kemono.hosts is empty")

Functions

func Routes

func Routes(r chi.Router, conf config.Kemono) error

Types

type Attachment

type Attachment struct {
	Name string `json:"name"`
	Path string `json:"path"`
	// contains filtered or unexported fields
}

func (*Attachment) Info

func (a *Attachment) Info(ctx context.Context) (*AttachmentInfo, error)

func (*Attachment) InfoAPIURL

func (a *Attachment) InfoAPIURL() *url.URL

func (*Attachment) IsAudio

func (a *Attachment) IsAudio() bool

func (*Attachment) IsImage

func (a *Attachment) IsImage() bool

func (*Attachment) IsVideo

func (a *Attachment) IsVideo() bool

func (*Attachment) ThumbURL

func (a *Attachment) ThumbURL() *url.URL

func (*Attachment) URL

func (a *Attachment) URL() *url.URL

type AttachmentInfo

type AttachmentInfo struct {
	ID       int    `json:"id"`
	Hash     string `json:"hash"`
	Created  string `json:"ctime"`
	Modified string `json:"mtime"`
	MIMEType string `json:"mime"`
	Ext      string `json:"ext"`
	Added    string `json:"added"`
	Size     int    `json:"size"`
}

type Creator

type Creator struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Service string `json:"service"`
	Indexed Time   `json:"indexed"`
	Updated Time   `json:"updated"`
	// contains filtered or unexported fields
}

func GetCreatorByID

func GetCreatorByID(ctx context.Context, host, service, id string) (*Creator, error)

func GetCreatorByUsername

func GetCreatorByUsername(ctx context.Context, host, service, username string) (*Creator, error)

func (*Creator) Feed

func (c *Creator) Feed(ctx context.Context, pages uint64, tag, query string) (*feeds.Feed, error)

func (*Creator) FetchPostPage

func (c *Creator) FetchPostPage(ctx context.Context, page uint64, query string) ([]*Post, error)

func (*Creator) ImageURL

func (c *Creator) ImageURL() *url.URL

func (*Creator) Podcast

func (c *Creator) Podcast(ctx context.Context, pages uint64, tag, query string) (*podcast.Podcast, error)

func (*Creator) PostAPIURL

func (c *Creator) PostAPIURL(page uint64, query string) *url.URL

func (*Creator) ProfileAPIURL

func (c *Creator) ProfileAPIURL() *url.URL

func (*Creator) PublicURL

func (c *Creator) PublicURL() *url.URL

func (*Creator) TagURL

func (c *Creator) TagURL(t string) *url.URL

type Embed

type Embed struct {
	URL         string `json:"url"`
	Subject     string `json:"subject"`
	Description string `json:"description"`
}

type Post

type Post struct {
	Creator     *Creator      `json:"-"`
	ID          string        `json:"id"`
	User        string        `json:"user"`
	Service     string        `json:"service"`
	Title       string        `json:"title"`
	Content     string        `json:"content"`
	Embed       Embed         `json:"embed"`
	Added       Time          `json:"added"`
	Published   Time          `json:"published"`
	Edited      Time          `json:"edited"`
	Tags        Tags          `json:"tags"`
	File        *Attachment   `json:"file"`
	Attachments []*Attachment `json:"attachments"`
}

func (*Post) FeedItem

func (p *Post) FeedItem() *feeds.Item

func (*Post) PodcastItem

func (p *Post) PodcastItem(ctx context.Context) (*podcast.Item, *Attachment, Time, Time, error)

func (*Post) URL

func (p *Post) URL() *url.URL

type Tags

type Tags []string

func (*Tags) UnmarshalJSON

func (t *Tags) UnmarshalJSON(bytes []byte) error

type Time

type Time struct {
	time.Time
}

func (*Time) UnmarshalJSON

func (d *Time) UnmarshalJSON(data []byte) error

type UpstreamResponseError

type UpstreamResponseError struct {
	Response *http.Response
	// contains filtered or unexported fields
}

func NewUpstreamResponseError

func NewUpstreamResponseError(resp *http.Response) UpstreamResponseError

func (UpstreamResponseError) Body

func (u UpstreamResponseError) Body() string

func (UpstreamResponseError) Error

func (u UpstreamResponseError) Error() string

Jump to

Keyboard shortcuts

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