Documentation ¶
Index ¶
- func BlacklistImage(hash [16]byte) (err error)
- func CheckSolution(id [64]byte, solution []byte) (solved bool, err error)
- func Close() error
- func CountPending(tag string) (n int, err error)
- func GenerateCaptcha(f Filters) (id [64]byte, images [9][16]byte, err error)
- func GetSolution(id [64]byte) (solution []byte, err error)
- func ImageCount(f Filters) (n int, err error)
- func InTransaction(fn func(*sql.Tx) error) (err error)
- func InsertImage(img Image) (err error)
- func InsertPendingImage(img PendingImage) (err error)
- func IsInDatabase(md5 [16]byte) (bool, error)
- func IsPendingImage(md5 [16]byte) (bool, error)
- func IsSolved(id [64]byte) (is bool, err error)
- func Open() (err error)
- func OpenForTests()
- type Filters
- type Image
- type PendingImage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BlacklistImage ¶
Add image to blacklist so that it is not fetched again
func CheckSolution ¶
Check, if a solution to a captcha is valid
func CountPending ¶ added in v1.4.0
Count pending images for tag
func GenerateCaptcha ¶
Generate a new captcha and return its ID and image list in order
func GetSolution ¶
Get solution for captcha by ID
func ImageCount ¶
Return count of images matching selectors
func InTransaction ¶
Runs function inside a transaction and handles comminting and rollback on error
func InsertPendingImage ¶ added in v1.1.0
func InsertPendingImage(img PendingImage) (err error)
Insert a new image pending processing
func IsInDatabase ¶
Return, if file is not already registered in the DB as valid thumbnail or in a blacklist
func IsPendingImage ¶ added in v1.1.0
Check, if image is already on the list of pending images
Types ¶
type Filters ¶
type Filters struct { common.FetchRequest Explicitness []boorufetch.Rating }
Filters for querying an image for a captcha
type Image ¶
type Image struct { Rating boorufetch.Rating Source common.DataSource MD5 [16]byte Tags []string }
type PendingImage ¶ added in v1.1.0
type PendingImage struct { Rating boorufetch.Rating MD5 [16]byte TargetTag, URL string Tags []string }
Image data fetched from boorus pending processing by random selection
func PopRandomPendingImage ¶ added in v1.1.0
func PopRandomPendingImage(tag string) (img PendingImage, err error)
Deletes random pending pending image for tag and returns it, if any