image

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const PosterVersion = 2

PosterVersion invalidates generated posters when their composition changes.

View Source
const URLPrefix = "/api/library/artwork/"

Variables

This section is empty.

Functions

func PosterSize added in v0.2.0

func PosterSize(width, height int, layout domain.CoverLayout) (int, int)

PosterSize measures the usable original pixels under the same layout policy used for cropping. It never treats upscaling as additional detail.

Types

type Artwork

type Artwork struct {
	Poster    string `json:"poster"`
	Fanart    string `json:"fanart"`
	Thumbnail string `json:"thumbnail"`
}

type Cache

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

func NewCache

func NewCache(dataDir string) (*Cache, error)

func (*Cache) Exists

func (cache *Cache) Exists(artwork Artwork) (bool, error)

func (*Cache) FromCover

func (cache *Cache) FromCover(body []byte, layout domain.CoverLayout) (Artwork, error)

func (*Cache) LockArtwork added in v0.2.0

func (cache *Cache) LockArtwork(ctx context.Context) error

Hold the artwork lock from cache writes through the commit of their database references. Pruning takes the same lock before reading those references.

func (*Cache) Prune added in v0.0.3

func (cache *Cache) Prune(ctx context.Context, retained map[string]bool) error

Prune removes only cache-owned JPEG files. The caller must serialize the reference snapshot and pruning with artwork generation and publication.

func (*Cache) Read

func (cache *Cache) Read(key string) ([]byte, error)

func (*Cache) ReadURL

func (cache *Cache) ReadURL(url string) ([]byte, error)

func (*Cache) RecropPoster added in v0.2.0

func (cache *Cache) RecropPoster(artwork Artwork, layout domain.CoverLayout) (Artwork, error)

RecropPoster upgrades a generated poster from the cached full cover, keeping the original fanart and thumbnail bytes and URLs intact.

func (*Cache) Restore

func (cache *Cache) Restore(poster, fanart []byte) (Artwork, error)

func (*Cache) Stats added in v0.0.3

func (cache *Cache) Stats(ctx context.Context, retained map[string]bool) (CacheStats, error)

func (*Cache) TryLockArtwork added in v0.2.0

func (cache *Cache) TryLockArtwork() bool

func (*Cache) UnlockArtwork added in v0.2.0

func (cache *Cache) UnlockArtwork()

type CacheStats added in v0.0.3

type CacheStats struct {
	SizeBytes        int64 `json:"size_bytes"`
	EntryCount       int   `json:"entry_count"`
	UnusedSizeBytes  int64 `json:"unused_size_bytes"`
	UnusedEntryCount int   `json:"unused_entry_count"`
}

Jump to

Keyboard shortcuts

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