photo

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Orphan = "orphan-photos"
	Broken = "broken-photos"
)

Names of special "albums".

Variables

View Source
var ThumbSizes = []ThumbSize{"2400w", "1200w", "600w", "300w", "200h", "400h"}

Functions

func AlbumHash

func AlbumHash(name string) uniq.Hash

Types

type Album

type Album struct {
	uniq.Head
	Title      string        `db:"title" json:"title" formType:"textarea" title:"Title" description:"Title of an album."`
	Name       string        `db:"name" json:"name" title:"Name" required:"true" readOnly:"true" description:"A slug value that is used in album URL."`
	Public     bool          `` /* 138-byte string literal not displayed */
	Hidden     bool          `` /* 145-byte string literal not displayed */
	CoverImage uniq.Hash     `db:"cover_image" json:"cover_image,omitempty" title:"Cover Image" description:"Hash of image to use as a cover."`
	Settings   AlbumSettings `db:"settings" json:"settings" title:"Settings" description:"Additional parameters for an album."`
	// contains filtered or unexported fields
}

type AlbumImageAdder

type AlbumImageAdder interface {
	AddImages(ctx context.Context, albumHash uniq.Hash, imageHashes ...uniq.Hash) error
}

type AlbumImageDeleter

type AlbumImageDeleter interface {
	DeleteImages(ctx context.Context, albumHash uniq.Hash, imageHashes ...uniq.Hash) error
}

type AlbumImageFinder

type AlbumImageFinder interface {
	FindImages(ctx context.Context, albumHash uniq.Hash) ([]Image, error)
	FindPreviewImages(ctx context.Context, albumHash uniq.Hash, coverImage uniq.Hash, limit uint64) ([]Image, error)
	FindOrphanImages(ctx context.Context) ([]Image, error)
	FindBrokenImages(ctx context.Context) ([]Image, error)
	FindImageAlbums(ctx context.Context, excludeAlbum uniq.Hash, imageHashes ...uniq.Hash) (map[uniq.Hash][]Album, error)
}

type AlbumSettings

type AlbumSettings struct {
	Description     string       `json:"description,omitempty" formType:"textarea" title:"Description" description:"Description of an album, can contain HTML."`
	GpxTracksHashes []uniq.Hash  `json:"gpx_tracks_hashes,omitempty" title:"GPX track hashes"`
	NewestFirst     bool         `json:"newest_first,omitempty" title:"Newest first" description:"Show newest images at the top."`
	Texts           []ChronoText `json:"texts,omitempty" title:"Chronological texts"`
}

func (*AlbumSettings) Scan

func (s *AlbumSettings) Scan(src any) error

func (AlbumSettings) Value

func (s AlbumSettings) Value() (driver.Value, error)

type ChronoText

type ChronoText struct {
	Time time.Time `json:"time" title:"Timestamp" description:"In RFC 3339 format, e.g. 2020-01-01T01:02:03Z"`
	Text string    `json:"text" title:"Text" formType:"textarea" description:"Text, can contain HTML."`
}

type Exif

type Exif struct {
	uniq.Head

	Rating          int        `db:"rating" json:"rating" title:"Rating" minimum:"0" maximum:"5"`
	ExposureTime    string     `db:"exposure_time" json:"exposure_time" title:"Exposure"`
	ExposureTimeSec float64    `db:"exposure_time_sec" json:"exposure_time_sec" title:"Exposure (sec.)"`
	FNumber         float64    `db:"f_number" json:"f_number" title:"Aperture"`
	FocalLength     float64    `db:"focal_length" json:"focal_length" title:"Focal length"`
	ISOSpeed        int        `db:"iso_speed" json:"iso_speed" title:"ISO"`
	LensModel       string     `db:"lens_model" json:"lens_model" title:"Lens"`
	CameraMake      string     `db:"camera_make" json:"camera_make" title:"Manufacturer"`
	CameraModel     string     `db:"camera_model" json:"camera_model" title:"Camera"`
	Software        string     `db:"software" json:"software" title:"Software"`
	Digitized       *time.Time `db:"digitized" json:"digitized" title:"Digitized"`
	ProjectionType  string     `db:"projection_type" json:"projection_type" title:"Projection" description:"Use 'equirectangular' for 360 panorama."`
}

type Gps

type Gps struct {
	uniq.Head

	Altitude  float64   `db:"altitude" title:"Altitude" json:"altitude"`
	Latitude  float64   `db:"latitude" title:"Latitude" json:"latitude"`
	Longitude float64   `db:"longitude" title:"Longitude" json:"longitude"`
	GpsTime   time.Time `db:"time" title:"GPS Timestamp" json:"time"`
}

type Gpx

type Gpx struct {
	uniq.File

	Settings sqluct.JSON[GpxSettings] `db:"settings"`
}

func (*Gpx) Index

func (g *Gpx) Index() error

type GpxSettings

type GpxSettings struct {
	Name   string  `json:"name,omitempty"`
	MinLat float64 `json:"minLat"`
	MinLon float64 `json:"minLon"`
	MaxLat float64 `json:"maxLat"`
	MaxLon float64 `json:"maxLon"`
}

func (*GpxSettings) Scan

func (s *GpxSettings) Scan(src any) error

func (GpxSettings) Value

func (s GpxSettings) Value() (driver.Value, error)

type Image

type Image struct {
	uniq.File
	Width    int64         `db:"width" title:"Width, px" json:"width" readOnly:"true"`
	Height   int64         `db:"height" title:"Height, px" json:"height" readOnly:"true"`
	BlurHash string        `db:"blurhash" title:"BlurHash" json:"blurhash" readOnly:"true"`
	PHash    uniq.Hash     `db:"phash" title:"PerceptionHash" json:"phash" readonly:"true"` // uniq.Hash is used JSON accuracy.
	TakenAt  *time.Time    `db:"taken_at" title:"Taken At" json:"taken_at"`
	Settings ImageSettings `db:"settings" json:"settings" title:"Settings" description:"Additional parameters for an album."`
}

type ImageIndexer

type ImageIndexer interface {
	Index(ctx context.Context, image Image, flags IndexingFlags) error
	QueueIndex(ctx context.Context, img Image, flags IndexingFlags)
	QueueCallback(ctx context.Context, cb func(ctx context.Context))
}

type ImageSettings

type ImageSettings struct {
	Description string `json:"description,omitempty" formType:"textarea" title:"Description" description:"Description of an image, can contain HTML."`
}

func (*ImageSettings) Scan

func (s *ImageSettings) Scan(src any) error

TODO: generalize scanner with generics.

func (ImageSettings) Value

func (s ImageSettings) Value() (driver.Value, error)

type IndexingFlags

type IndexingFlags struct {
	RebuildExif bool `formData:"rebuild_exif"`
	RebuildGps  bool `formData:"rebuild_gps"`
}

type MapTile

type MapTile struct {
	Data       []byte
	ModifiedAt time.Time
}

type Thumb

type Thumb struct {
	uniq.Head
	Width    uint   `db:"width"`
	Height   uint   `db:"height"`
	Data     []byte `db:"data"`
	FilePath string `db:"file_path"`
}

func (Thumb) ReadSeeker

func (t Thumb) ReadSeeker() io.ReadSeeker

type ThumbSize

type ThumbSize string

func (ThumbSize) PrepareJSONSchema

func (t ThumbSize) PrepareJSONSchema(schema *jsonschema.Schema) error

func (ThumbSize) WidthHeight

func (t ThumbSize) WidthHeight() (uint, uint, error)

type Thumbnailer

type Thumbnailer interface {
	Thumbnail(ctx context.Context, image Image, size ThumbSize) (Thumb, error)
}

Jump to

Keyboard shortcuts

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