Documentation ¶
Overview ¶
Package immich provides functions to interact with the Immich API.
It includes functionality for retrieving random images, fetching images associated with specific people or albums, and getting image statistics. The package also implements caching mechanisms to optimize API calls.
Index ¶
- Constants
- func ApiCacheCount() int
- func FlushApiCache()
- type ExifInfo
- type Face
- type ImageOrientation
- type ImmichAlbum
- type ImmichAlbums
- type ImmichApiCall
- type ImmichApiResponse
- type ImmichAsset
- func (i *ImmichAsset) AlbumImageCount(albumID string, requestID string) (int, error)
- func (i *ImmichAsset) AssetInfo(requestID string) error
- func (i *ImmichAsset) CheckForFaces(requestID string)
- func (i *ImmichAsset) FacesCenterPoint() (float64, float64)
- func (i *ImmichAsset) FacesCenterPointPX() (float64, float64)
- func (i *ImmichAsset) ImagePreview() ([]byte, error)
- func (i *ImmichAsset) OLDRandomImageOfPerson(personID, requestID, kioskDeviceID string, isPrefetch bool) error
- func (i *ImmichAsset) PersonImageCount(personID, requestID string) (int, error)
- func (i *ImmichAsset) PersonName(personID string)
- func (i *ImmichAsset) RandomAlbumFromAllAlbums(requestID string, excludedAlbums []string) (string, error)
- func (i *ImmichAsset) RandomAlbumFromSharedAlbums(requestID string, excludedAlbums []string) (string, error)
- func (i *ImmichAsset) RandomImage(requestID, kioskDeviceID string, isPrefetch bool) error
- func (i *ImmichAsset) RandomImageFromAlbum(albumID, requestID, kioskDeviceID string, isPrefetch bool) error
- func (i *ImmichAsset) RandomImageFromFavourites(requestID, kioskDeviceID string, isPrefetch bool) error
- func (i *ImmichAsset) RandomImageOfPerson(personID, requestID, kioskDeviceID string, isPrefetch bool) error
- type ImmichAssetType
- type ImmichError
- type ImmichPersonStatistics
- type ImmichSearchMetadataResponse
- type ImmichSearchRandomBody
- type Person
Constants ¶
const ( PortraitOrientation ImageOrientation = "PORTRAIT" LandscapeOrientation ImageOrientation = "LANDSCAPE" SquareOrientation ImageOrientation = "SQUARE" ImageType ImmichAssetType = "IMAGE" VideoType ImmichAssetType = "VIDEO" AudioType ImmichAssetType = "AUDIO" OtherType ImmichAssetType = "OTHER" AssetSizeThumbnail string = "thumbnail" AssetSizeOriginal string = "original" )
Variables ¶
This section is empty.
Functions ¶
func ApiCacheCount ¶
func ApiCacheCount() int
func FlushApiCache ¶
func FlushApiCache()
Types ¶
type ExifInfo ¶
type ExifInfo struct { Make string `json:"make"` Model string `json:"model"` ExifImageWidth int `json:"exifImageWidth"` ExifImageHeight int `json:"exifImageHeight"` FileSizeInByte int `json:"fileSizeInByte"` Orientation string `json:"orientation"` DateTimeOriginal time.Time `json:"dateTimeOriginal"` ModifyDate time.Time `json:"modifyDate"` TimeZone string `json:"timeZone"` LensModel string `json:"lensModel"` FNumber float64 `json:"fNumber"` FocalLength float64 `json:"focalLength"` Iso int `json:"iso"` ExposureTime string `json:"exposureTime"` Latitude float64 `json:"latitude"` Longitude float64 `json:"longitude"` City string `json:"city"` State string `json:"state"` Country string `json:"country"` Description string `json:"description"` ProjectionType any `json:"-"` // `json:"projectionType"` ImageOrientation ImageOrientation }
type ImageOrientation ¶
type ImageOrientation string
type ImmichAlbum ¶
type ImmichAlbum struct { ID string `json:"id"` AlbumName string `json:"albumName"` Assets []ImmichAsset `json:"assets"` AssetCount int `json:"assetCount"` }
type ImmichAlbums ¶
type ImmichAlbums []ImmichAlbum
func (*ImmichAlbums) RemoveExcludedAlbums ¶
func (a *ImmichAlbums) RemoveExcludedAlbums(exclude []string)
RemoveExcludedAlbums filters out albums whose IDs are in the exclude slice.
type ImmichApiResponse ¶
type ImmichApiResponse interface { ImmichAsset | []ImmichAsset | ImmichAlbum | ImmichAlbums | ImmichPersonStatistics | int | ImmichSearchMetadataResponse | []Face | immich_open_api.PersonResponseDto }
type ImmichAsset ¶
type ImmichAsset struct { ID string `json:"id"` DeviceAssetID string `json:"-"` // `json:"deviceAssetId"` OwnerID string `json:"-"` // `json:"ownerId"` DeviceID string `json:"-"` // `json:"deviceId"` LibraryID string `json:"-"` // `json:"libraryId"` Type ImmichAssetType `json:"type"` OriginalPath string `json:"-"` // `json:"originalPath"` OriginalFileName string `json:"originalFileName"` OriginalMimeType string `json:"originalMimeType"` Resized bool `json:"-"` // `json:"resized"` Thumbhash string `json:"-"` // `json:"thumbhash"` FileCreatedAt time.Time `json:"-"` // `json:"fileCreatedAt"` FileModifiedAt time.Time `json:"-"` // `json:"fileModifiedAt"` LocalDateTime time.Time `json:"localDateTime"` UpdatedAt time.Time `json:"-"` // `json:"updatedAt"` IsFavorite bool `json:"isFavorite"` IsArchived bool `json:"isArchived"` IsTrashed bool `json:"isTrashed"` Duration string `json:"-"` // `json:"duration"` ExifInfo ExifInfo `json:"exifInfo"` LivePhotoVideoID any `json:"-"` // `json:"livePhotoVideoId"` People []Person `json:"people"` UnassignedFaces []Face `json:"unassignedFaces"` Checksum string `json:"checksum"` StackCount any `json:"-"` // `json:"stackCount"` IsOffline bool `json:"-"` // `json:"isOffline"` HasMetadata bool `json:"-"` // `json:"hasMetadata"` DuplicateID any `json:"-"` // `json:"duplicateId"` // Data added and used by Kiosk RatioWanted ImageOrientation `json:"-"` IsPortrait bool `json:"-"` IsLandscape bool `json:"-"` KioskSource kiosk.Source `json:"-"` KioskSourceName string `json:"-"` }
func (*ImmichAsset) AlbumImageCount ¶
func (i *ImmichAsset) AlbumImageCount(albumID string, requestID string) (int, error)
AlbumImageCount retrieves the number of images in a specific album from Immich.
func (*ImmichAsset) AssetInfo ¶
func (i *ImmichAsset) AssetInfo(requestID string) error
AssetInfo fetches the image information from Immich
func (*ImmichAsset) CheckForFaces ¶
func (i *ImmichAsset) CheckForFaces(requestID string)
func (*ImmichAsset) FacesCenterPoint ¶
func (i *ImmichAsset) FacesCenterPoint() (float64, float64)
FacesCenterPoint calculates the center point of all detected faces in an image as percentages. It analyzes both assigned (People) and unassigned faces, finding the bounding box that encompasses all faces and returning its center as x,y percentages relative to the image dimensions. Returns (0,0) if no faces are detected or if image dimensions are invalid.
func (*ImmichAsset) FacesCenterPointPX ¶
func (i *ImmichAsset) FacesCenterPointPX() (float64, float64)
FacesCenterPointPX calculates the center point of all detected faces in an image in pixels. It analyzes both assigned (People) and unassigned faces, finding the bounding box that encompasses all faces and returning its center as x,y pixel coordinates. Returns (0,0) if no faces are detected or if all bounding boxes are empty.
func (*ImmichAsset) ImagePreview ¶
func (i *ImmichAsset) ImagePreview() ([]byte, error)
ImagePreview fetches the raw image data from Immich
func (*ImmichAsset) OLDRandomImageOfPerson ¶
func (i *ImmichAsset) OLDRandomImageOfPerson(personID, requestID, kioskDeviceID string, isPrefetch bool) error
DEPRECIATED RandomImageOfPerson retrieve random image of person from Immich
func (*ImmichAsset) PersonImageCount ¶
func (i *ImmichAsset) PersonImageCount(personID, requestID string) (int, error)
PersonImageCount returns the number of images associated with a specific person in Immich.
func (*ImmichAsset) PersonName ¶ added in v0.14.6
func (i *ImmichAsset) PersonName(personID string)
func (*ImmichAsset) RandomAlbumFromAllAlbums ¶
func (i *ImmichAsset) RandomAlbumFromAllAlbums(requestID string, excludedAlbums []string) (string, error)
RandomAlbumFromAllAlbums returns a random album ID from all albums. It takes a requestID for API call tracking and a slice of excluded album IDs. The selection is weighted based on the number of assets in each album. Returns an error if there are no available albums after exclusions or if the API call fails.
func (*ImmichAsset) RandomAlbumFromSharedAlbums ¶
func (i *ImmichAsset) RandomAlbumFromSharedAlbums(requestID string, excludedAlbums []string) (string, error)
RandomAlbumFromSharedAlbums returns a random album ID from shared albums. It takes a requestID for API call tracking and a slice of excluded album IDs. The selection is weighted based on the number of assets in each album. Returns an error if there are no available albums after exclusions or if the API call fails.
func (*ImmichAsset) RandomImage ¶
func (i *ImmichAsset) RandomImage(requestID, kioskDeviceID string, isPrefetch bool) error
GetRandomImage retrieve a random image from Immich
func (*ImmichAsset) RandomImageFromAlbum ¶
func (i *ImmichAsset) RandomImageFromAlbum(albumID, requestID, kioskDeviceID string, isPrefetch bool) error
RandomImageFromAlbum retrieve random image within a specified album from Immich
func (*ImmichAsset) RandomImageFromFavourites ¶
func (i *ImmichAsset) RandomImageFromFavourites(requestID, kioskDeviceID string, isPrefetch bool) error
RandomImageFromFavourites retrieves a random favorite image from the Immich server.
func (*ImmichAsset) RandomImageOfPerson ¶
func (i *ImmichAsset) RandomImageOfPerson(personID, requestID, kioskDeviceID string, isPrefetch bool) error
RandomImageOfPerson retrieve random image of person from Immich
type ImmichAssetType ¶
type ImmichAssetType string
type ImmichError ¶
type ImmichPersonStatistics ¶
type ImmichPersonStatistics struct {
Assets int `json:"assets"`
}
type ImmichSearchRandomBody ¶
type ImmichSearchRandomBody struct { City string `url:"city,omitempty" json:"city,omitempty"` Country string `url:"country,omitempty" json:"country,omitempty"` CreatedAfter string `url:"createdAfter,omitempty" json:"createdAfter,omitempty"` CreatedBefore string `url:"createdBefore,omitempty" json:"createdBefore,omitempty"` DeviceID string `url:"deviceId,omitempty" json:"deviceId,omitempty"` IsArchived bool `url:"isArchived,omitempty" json:"isArchived,omitempty"` IsEncoded bool `url:"isEncoded,omitempty" json:"isEncoded,omitempty"` IsFavorite bool `url:"isFavorite,omitempty" json:"isFavorite,omitempty"` IsMotion bool `url:"isMotion,omitempty" json:"isMotion,omitempty"` IsNotInAlbum bool `url:"isNotInAlbum,omitempty" json:"isNotInAlbum,omitempty"` IsOffline bool `url:"isOffline,omitempty" json:"isOffline,omitempty"` IsVisible bool `url:"isVisible,omitempty" json:"isVisible,omitempty"` LensModel string `url:"lensModel,omitempty" json:"lensModel,omitempty"` LibraryID string `url:"libraryId,omitempty" json:"libraryId,omitempty"` Make string `url:"make,omitempty" json:"make,omitempty"` Model string `url:"model,omitempty" json:"model,omitempty"` PersonIds []string `url:"personIds,omitempty" json:"personIds,omitempty"` Size int `url:"size,omitempty" json:"size,omitempty"` State string `url:"state,omitempty" json:"state,omitempty"` TakenAfter string `url:"takenAfter,omitempty" json:"takenAfter,omitempty"` TakenBefore string `url:"takenBefore,omitempty" json:"takenBefore,omitempty"` TrashedAfter string `url:"trashedAfter,omitempty" json:"trashedAfter,omitempty"` TrashedBefore string `url:"trashedBefore,omitempty" json:"trashedBefore,omitempty"` Type string `url:"type,omitempty" json:"type,omitempty"` UpdatedAfter string `url:"updatedAfter,omitempty" json:"updatedAfter,omitempty"` UpdatedBefore string `url:"updatedBefore,omitempty" json:"updatedBefore,omitempty"` WithArchived bool `url:"withArchived,omitempty" json:"withArchived,omitempty"` WithDeleted bool `url:"withDeleted,omitempty" json:"withDeleted,omitempty"` WithExif bool `url:"withExif,omitempty" json:"withExif,omitempty"` WithPeople bool `url:"withPeople,omitempty" json:"withPeople,omitempty"` WithStacked bool `url:"withStacked,omitempty" json:"withStacked,omitempty"` Page int `url:"page,omitempty" json:"page,omitempty"` }
type Person ¶
type Person struct { ID string `json:"id"` Name string `json:"name"` BirthDate any `json:"-"` // `json:"birthDate"` ThumbnailPath string `json:"-"` // `json:"thumbnailPath"` IsHidden bool `json:"-"` // `json:"isHidden"` UpdatedAt time.Time `json:"-"` // `json:"updatedAt"` Faces []Face `json:"faces"` }