assets

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2025 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Album

type Album struct {
	ID          string  `json:"-"`                     // The album ID
	Title       string  `json:"title,omitempty"`       // either the directory base name, or metadata
	Description string  `json:"description,omitempty"` // As found in the metadata
	Latitude    float64 `json:"latitude,omitempty"`    // As found in the metadata
	Longitude   float64 `json:"longitude,omitempty"`   // As found in the metadata
}

func NewAlbum added in v0.24.6

func NewAlbum(id string, title string, description string) Album

func (Album) LogValue

func (a Album) LogValue() slog.Value

type Asset

type Asset struct {
	// File system and file name
	File     fshelper.FSAndName
	FileDate time.Time // File creation date
	ID       string    // Immich ID after upload
	Checksum string    // Hash of the file as delivered by Immich

	// Common fields
	OriginalFileName string // File name as delivered to Immich/Google
	Description      string // Google Photos may a have description
	FileSize         int    // File size in bytes

	// Metadata for the process and the upload to Immich
	CaptureDate time.Time // Date of the capture
	Trashed     bool      // The asset is trashed
	Archived    bool      // The asset is archived
	FromPartner bool      // the asset comes from a partner
	Favorite    bool      // the asset is marked as favorite
	Rating      int       // the asset is marked with stars
	Albums      []Album   // List of albums the asset is in
	Tags        []Tag     // List of tags the asset is tagged with

	// Information inferred from the original file name
	NameInfo

	FromSideCar     *Metadata // Metadata extracted from a sidecar file (XMP or JSON)
	FromSourceFile  *Metadata // Metadata extracted from the file content (embedded metadata)
	FromApplication *Metadata // Metadata extracted from the application that created the file

	// GPS location
	Latitude  float64 // GPS latitude
	Longitude float64 // GPS longitude
	// contains filtered or unexported fields
}

func (*Asset) AddTag

func (a *Asset) AddTag(tag string)

func (*Asset) Close

func (a *Asset) Close() error

Close close the temporary file and close the source

func (Asset) DeviceAssetID

func (a Asset) DeviceAssetID() string

func (*Asset) GetChecksum added in v0.24.7

func (a *Asset) GetChecksum() (string, error)

GetChecksum returns the checksum of the asset. If the checksum is already set, it returns it. Otherwise, it computes it. Use this method to get the checksum of an asset.

func (Asset) LogValue

func (a Asset) LogValue() slog.Value

LogValue returns a slog.Value representing the LocalAssetFile's properties.

func (*Asset) MergeAlbums

func (a *Asset) MergeAlbums(a2 []Album)

func (*Asset) MergeTags

func (a *Asset) MergeTags(t2 []Tag)

func (*Asset) OpenFile

func (a *Asset) OpenFile() (osfs.OSFS, error)

func (*Asset) SetNameInfo

func (a *Asset) SetNameInfo(ni NameInfo)

func (*Asset) UseMetadata

func (a *Asset) UseMetadata(md *Metadata) *Metadata

type Group

type Group struct {
	Assets     []*Asset
	Removed    []removed
	Grouping   GroupBy
	CoverIndex int // index of the cover assert in the Assets slice
}

func NewGroup

func NewGroup(grouping GroupBy, a ...*Asset) *Group

NewGroup create a new asset group

func (*Group) AddAsset

func (g *Group) AddAsset(a *Asset)

AddAsset add an asset to the group

func (*Group) RemoveAsset

func (g *Group) RemoveAsset(a *Asset, reason string)

RemoveAsset remove an asset from the group

func (*Group) SetCover

func (g *Group) SetCover(i int) *Group

SetCover set the cover asset of the group

func (*Group) Validate

func (g *Group) Validate() error

type GroupBy

type GroupBy int
const (
	GroupByNone    GroupBy = iota
	GroupByBurst           // Group by burst
	GroupByRawJpg          // Group by raw/jpg
	GroupByHeicJpg         // Group by heic/jpg
	GroupByOther           // Group by other (same radical, not previous cases)
)

type Kind

type Kind int

Kind is the probable type of the image

const (
	KindNone Kind = iota
	KindBurst
	KindEdited
	KindPortrait
	KindNight
	KindMotion
	KindLongExposure
)

type Metadata

type Metadata struct {
	File        fshelper.FSAndName `json:"-"`                     // File name and file system that holds the metadata. Could be empty
	FileName    string             `json:"fileName,omitempty"`    // File name as presented to users
	Latitude    float64            `json:"latitude,omitempty"`    // GPS
	Longitude   float64            `json:"longitude,omitempty"`   // GPS
	FileDate    time.Time          `json:"fileDate,omitzero"`     // Date of the file
	DateTaken   time.Time          `json:"dateTaken,omitzero"`    // Date of exposure
	Description string             `json:"description,omitempty"` // Long description
	Albums      []Album            `json:"albums,omitempty"`      // Used to list albums that contain the file
	Tags        []Tag              `json:"tags,omitempty"`        // Used to list tags
	Rating      byte               `json:"rating,omitempty"`      // 0 to 5
	Trashed     bool               `json:"trashed,omitempty"`     // Flag to indicate if the image has been trashed
	Archived    bool               `json:"archived,omitempty"`    // Flag to indicate if the image has been archived
	Favorited   bool               `json:"favorited,omitempty"`   // Flag to indicate if the image has been favorited
	FromPartner bool               `json:"fromPartner,omitempty"` // Flag to indicate if the image is from a partner
}

func UnMarshalMetadata

func UnMarshalMetadata(data []byte) (*Metadata, error)

func (*Metadata) AddTag

func (m *Metadata) AddTag(tag string)

func (Metadata) IsSet

func (m Metadata) IsSet() bool

func (Metadata) LogValue

func (m Metadata) LogValue() slog.Value

type NameInfo

type NameInfo struct {
	Base       string    // base name (with extension)
	Ext        string    // extension
	Radical    string    // base name usable for grouping photos
	Type       string    // type of the asset  video, image
	Kind       Kind      // type of the series
	Index      int       // index of the asset in the series
	Taken      time.Time // date taken
	IsCover    bool      // is this is the cover if the series
	IsModified bool      // is this is a modified version of the original
}

type Tag

type Tag struct {
	ID    string `json:"-"`               // Tag ID in immich
	Name  string `json:"-"`               // the leaf name of the tag: subtag
	Value string `json:"value,omitempty"` // the full tag name rootTag/subtag
}

func (Tag) LogValuer

func (t Tag) LogValuer() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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