package libgallery
import "spiderden.org/libgallery"
libgallery provides an interface for accessing boorus, and other resources in a booru-like fashion.
Index ¶
- Variables
- func Register(name string, impl Driver)
- type Comment
- type Driver
- type Files
- type Post
- type RorderDriver
Package Files ¶
interface.go registry.go
Variables ¶
The registry contains a list of names suitable for identification mapped to implementations. The key should not have spaces or captialisation.
func Register ¶
Register new implementation, should only be accessed during Init() by implementation packages!
type Comment ¶
type Comment struct { Author string `json:"author"` Body string `json:"body"` Date time.Time `json:"date"` Score int64 `json:"score"` }
type Driver ¶
type Driver interface { Name() string // The proper name of a site, i.e. "Danbooru" // Search() can only accept space-separated snake-case tags. // If a booru doesn't support it you will need to // transmogrify the query. Search(string, uint64) ([]Post, error) // Tags, and page number. File(string) (Files, error) // Fetches a file with a given ID. Comments(string) ([]Comment, error) // Fetches the comments from a given ID. }
Driver interface provides a method to access boorus, or a view of resources in a booru-like fashion (called virtual implementations)
type Files ¶
type Files []io.ReadCloser
func (*Files) Close ¶
func (f *Files) Close()
type Post ¶
type Post struct { URL string ID string `json:"id"` NSFW bool `json:"nsfw"` Date time.Time `json:"date"` Description string `json:"description"` Tags string `json:"tags"` Uploader string `json:"uploader"` Source []string `json:"source"` Score int64 `json:"score"` }
Post has various fields for what a post may contain. All zero values aside from Score and NSFW should be considered not-implemented on the site or otherwise unfetchable. Uploader should be the ID, not the username (unless usernames are used as IDs like Reddit)
type RorderDriver ¶
type RorderDriver interface { Driver RorderSearch(string, uint64) ([]Post, error) // Functionally identical to Driver.Search(), except the posts returned are in a random order using something like order:random. }
A driver that can return posts in a random order.
Directories ¶
Path | Synopsis |
---|---|
cmd | |
drivers | Importing this package is the same as blank importing the below packages |
drivers/danbooru | Driver for Danbooru and compatible APIs. |
drivers/e621 | |
drivers/internal | |
drivers/rule34 |
- Version
- v0.0.0-20221013105553-4cfaa27d1934 (latest)
- Published
- Oct 13, 2022
- Platform
- linux/amd64
- Imports
- 2 packages (graph)
- Last checked
- 2 days ago –
Tools for package owners.