Documentation ¶
Overview ¶
Package photoprism provides the core functionality of PhotoPrism®.
Copyright (c) 2018 - 2024 PhotoPrism UG. All rights reserved.
This program is free software: you can redistribute it and/or modify it under Version 3 of the GNU Affero General Public License (the "AGPL"): <https://docs.photoprism.app/license/agpl> This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. The AGPL is supplemented by our Trademark and Brand Guidelines, which describe how our Brand Assets may be used: <https://www.photoprism.app/trademark>
Feel free to send an email to hello@photoprism.app if you have questions, want to support our work, or just want to say hello.
Additional information can be found in our Developer Guide: <https://docs.photoprism.app/developer-guide/>
Index ¶
- Constants
- func BackupAlbums(backupPath string, force bool) (count int, result error)
- func CacheName(fileHash, namespace, cacheKey string) (cacheName string, err error)
- func CachePath(fileHash, namespace string) (cachePath string, err error)
- func Config() *config.Config
- func ConvertWorker(jobs <-chan ConvertJob)
- func DeleteFiles(files entity.Files, originals bool) (numFiles int)
- func DeletePhoto(p entity.Photo, mediaFiles bool, originals bool) (numFiles int, err error)
- func ExifToolCacheName(hash string) (string, error)
- func FileName(fileRoot, fileName string) string
- func ImportWorker(jobs <-chan ImportJob)
- func IndexWorker(jobs <-chan IndexJob)
- func RelName(fileName, directory string) string
- func RestoreAlbums(backupPath string, force bool) (count int, result error)
- func Root(fileName string) string
- func RootPath(fileName string) string
- func RootRelName(fileName string) string
- func SetConfig(c *config.Config)
- func ThumbsWorker(jobs <-chan ThumbsJob)
- type CleanUp
- type CleanUpOptions
- type Convert
- func (c *Convert) AvcBitrate(f *MediaFile) string
- func (c *Convert) AvcConvertCommand(f *MediaFile, avcName string, encoder ffmpeg.AvcEncoder) (result *exec.Cmd, useMutex bool, err error)
- func (c *Convert) FixJpeg(f *MediaFile, force bool) (*MediaFile, error)
- func (c *Convert) JpegConvertCommands(f *MediaFile, jpegName string, xmpName string) (result []*exec.Cmd, useMutex bool, err error)
- func (c *Convert) PngConvertCommands(f *MediaFile, pngName string) (result []*exec.Cmd, useMutex bool, err error)
- func (c *Convert) Start(dir string, ext []string, force bool) (err error)
- func (c *Convert) ToAvc(f *MediaFile, encoder ffmpeg.AvcEncoder, noMutex, force bool) (file *MediaFile, err error)
- func (c *Convert) ToImage(f *MediaFile, force bool) (*MediaFile, error)
- func (c *Convert) ToJson(f *MediaFile, force bool) (jsonName string, err error)
- type ConvertJob
- type Faces
- func (w *Faces) Audit(fix bool) (err error)
- func (w *Faces) Cancel()
- func (w *Faces) Canceled() bool
- func (w *Faces) Cluster(opt FacesOptions) (added entity.Faces, err error)
- func (w *Faces) Disabled() bool
- func (w *Faces) Match(opt FacesOptions) (result FacesMatchResult, err error)
- func (w *Faces) MatchFaces(faces entity.Faces, force bool, matchedBefore *time.Time) (result FacesMatchResult, err error)
- func (w *Faces) Optimize() (result FacesOptimizeResult, err error)
- func (w *Faces) Reset() (err error)
- func (w *Faces) Start(opt FacesOptions) (err error)
- func (w *Faces) StartDefault() (err error)
- func (w *Faces) Stats() (err error)
- type FacesMatchResult
- type FacesOptimizeResult
- type FacesOptions
- type Files
- func (m *Files) Done()
- func (m *Files) Exists(fileName, fileRoot string) bool
- func (m *Files) Ignore(fileName, fileRoot string, modTime time.Time, rescan bool) bool
- func (m *Files) Indexed(fileName, fileRoot string, modTime time.Time, rescan bool) bool
- func (m *Files) Init() error
- func (m *Files) Remove(fileName, fileRoot string)
- type Import
- type ImportJob
- type ImportOptions
- type Index
- func (ind *Index) Cancel()
- func (ind *Index) Faces(jpeg *MediaFile, expected int) face.Faces
- func (ind *Index) FileName(fileName string, o IndexOptions) (result IndexResult)
- func (ind *Index) Labels(jpeg *MediaFile) (results classify.Labels)
- func (ind *Index) LastRun() (lastRun time.Time, lastFound int)
- func (ind *Index) MediaFile(m *MediaFile, o IndexOptions, originalName, photoUID string) (result IndexResult)
- func (ind *Index) NSFW(m *MediaFile) bool
- func (ind *Index) Start(o IndexOptions) (found fs.Done, updated int)
- func (ind *Index) UserMediaFile(m *MediaFile, o IndexOptions, originalName, photoUID, userUID string) (result IndexResult)
- type IndexJob
- type IndexOptions
- type IndexResult
- func (r IndexResult) Archived() bool
- func (r IndexResult) Failed() bool
- func (r IndexResult) FileError() (string, error)
- func (r IndexResult) Indexed() bool
- func (r IndexResult) Skipped() bool
- func (r IndexResult) Stacked() bool
- func (r IndexResult) String() string
- func (r IndexResult) Success() bool
- type IndexStatus
- type Label
- type Labels
- type MediaFile
- func (m *MediaFile) AbsPrefix(stripSequence bool) string
- func (m *MediaFile) AspectRatio() float32
- func (m *MediaFile) BaseName() string
- func (m *MediaFile) BasePrefix(stripSequence bool) string
- func (m *MediaFile) Bounds() image.Rectangle
- func (m *MediaFile) CameraMake() string
- func (m *MediaFile) CameraModel() string
- func (m *MediaFile) CanonicalName() string
- func (m *MediaFile) CanonicalNameFromFile() string
- func (m *MediaFile) CanonicalNameFromFileWithDirectory() string
- func (m *MediaFile) ChangeOrientation(val int) (err error)
- func (m *MediaFile) CheckType() error
- func (m *MediaFile) Checksum() string
- func (m *MediaFile) ColorProfile() string
- func (m *MediaFile) Colors(thumbPath string) (perception colors.ColorPerception, err error)
- func (m *MediaFile) Copy(dest string) error
- func (m *MediaFile) CreateExifToolJson(convert *Convert) error
- func (m *MediaFile) CreateThumbnails(thumbPath string, force bool) (err error)
- func (m *MediaFile) DateCreated() time.Time
- func (m *MediaFile) DecodeConfig() (_ *image.Config, err error)
- func (m *MediaFile) Dir() string
- func (m *MediaFile) Duration() time.Duration
- func (m *MediaFile) EditedName() string
- func (m *MediaFile) Empty() bool
- func (m *MediaFile) ExceedsBytes(limit int64) (err error, fileSize int64)
- func (m *MediaFile) ExceedsResolution(limit int) (err error, resolution int)
- func (m *MediaFile) ExifSupported() bool
- func (m *MediaFile) ExifToolJsonName() (string, error)
- func (m *MediaFile) Exists() bool
- func (m *MediaFile) Exposure() string
- func (m *MediaFile) Extension() string
- func (m *MediaFile) FNumber() float32
- func (m *MediaFile) FileName() string
- func (m *MediaFile) FileSize() int64
- func (m *MediaFile) FileType() fs.Type
- func (m *MediaFile) FocalLength() int
- func (m *MediaFile) HasFileType(fileType fs.Type) bool
- func (m *MediaFile) HasMediaType(mediaType media.Type) bool
- func (m *MediaFile) HasPreviewImage() bool
- func (m *MediaFile) HasSameName(f *MediaFile) bool
- func (m *MediaFile) HasSidecarJson() bool
- func (m *MediaFile) HasTimeAndPlace() bool
- func (m *MediaFile) Hash() string
- func (m *MediaFile) Height() int
- func (m *MediaFile) InOriginals() bool
- func (m *MediaFile) InSidecar() bool
- func (m *MediaFile) IsAVIF() bool
- func (m *MediaFile) IsAVIFS() bool
- func (m *MediaFile) IsAnimated() bool
- func (m *MediaFile) IsAnimatedImage() bool
- func (m *MediaFile) IsBMP() bool
- func (m *MediaFile) IsDNG() bool
- func (m *MediaFile) IsGIF() bool
- func (m *MediaFile) IsHEIC() bool
- func (m *MediaFile) IsHEICS() bool
- func (m *MediaFile) IsHEIF() bool
- func (m *MediaFile) IsImage() bool
- func (m *MediaFile) IsImageNative() bool
- func (m *MediaFile) IsImageOther() bool
- func (m *MediaFile) IsJSON() bool
- func (m *MediaFile) IsJpeg() bool
- func (m *MediaFile) IsJpegXL() bool
- func (m *MediaFile) IsLive() bool
- func (m *MediaFile) IsMedia() bool
- func (m *MediaFile) IsPNG() bool
- func (m *MediaFile) IsPreviewImage() bool
- func (m *MediaFile) IsRaw() bool
- func (m *MediaFile) IsSVG() bool
- func (m *MediaFile) IsSidecar() bool
- func (m *MediaFile) IsTIFF() bool
- func (m *MediaFile) IsVector() bool
- func (m *MediaFile) IsVideo() bool
- func (m *MediaFile) IsWebP() bool
- func (m *MediaFile) IsXMP() bool
- func (m *MediaFile) Iso() int
- func (m *MediaFile) LensMake() string
- func (m *MediaFile) LensModel() string
- func (m *MediaFile) Location() (*entity.Cell, error)
- func (m *MediaFile) Media() media.Type
- func (m *MediaFile) Megapixels() (resolution int)
- func (m *MediaFile) MetaData() (result meta.Data)
- func (m *MediaFile) MimeType() string
- func (m *MediaFile) ModTime() time.Time
- func (m *MediaFile) Move(dest string) error
- func (m *MediaFile) NeedsExifToolJson() bool
- func (m *MediaFile) NeedsTranscoding() bool
- func (m *MediaFile) NotAnimated() bool
- func (m *MediaFile) Ok() bool
- func (m *MediaFile) Orientation() int
- func (m *MediaFile) PathNameInfo(stripSequence bool) (fileRoot, fileBase, relativePath, relativeName string)
- func (m *MediaFile) Portrait() bool
- func (m *MediaFile) PreviewImage() (*MediaFile, error)
- func (m *MediaFile) ReadExifToolJson() error
- func (m *MediaFile) RelName(directory string) string
- func (m *MediaFile) RelPath(directory string) string
- func (m *MediaFile) RelPrefix(directory string, stripSequence bool) string
- func (m *MediaFile) RelatedFiles(stripSequence bool) (result RelatedFiles, err error)
- func (m *MediaFile) RelatedSidecarFiles(stripSequence bool) (files []string, err error)
- func (m *MediaFile) Remove() error
- func (m *MediaFile) RemoveSidecarFiles() (numFiles int, err error)
- func (m *MediaFile) RenameSidecarFiles(oldFileName string) (renamed map[string]string, err error)
- func (m *MediaFile) Resample(path string, sizeName thumb.Name) (img image.Image, err error)
- func (m *MediaFile) Root() string
- func (m *MediaFile) RootPath() string
- func (m *MediaFile) RootRelName() string
- func (m *MediaFile) RootRelPath() string
- func (m *MediaFile) SetFileName(fileName string)
- func (m *MediaFile) SetModTime(modTime time.Time) *MediaFile
- func (m *MediaFile) SidecarJsonName() string
- func (m *MediaFile) SkipTranscoding() bool
- func (m *MediaFile) Stat() (size int64, mod time.Time, err error)
- func (m *MediaFile) SubDir(dir string) string
- func (m *MediaFile) TakenAt() (time.Time, string)
- func (m *MediaFile) Thumbnail(path string, sizeName thumb.Name) (filename string, err error)
- func (m *MediaFile) TimeZone() string
- func (m *MediaFile) VideoInfo() video.Info
- func (m *MediaFile) Width() int
- type MediaFiles
- type Moments
- type Photos
- type Places
- type Purge
- type PurgeOptions
- type RelatedFiles
- type S
- type Thumbs
- type ThumbsJob
Constants ¶
const ( ActionIndex = "index" ActionAutoIndex = "autoindex" ActionImport = "import" ActionAutoImport = "autoimport" ActionUpload = "upload" ActionUnknown = "" )
Variables ¶
This section is empty.
Functions ¶
func BackupAlbums ¶
BackupAlbums creates a YAML file backup of all albums.
func CacheName ¶
CacheName returns an absolute cache file name based on the base path, file hash and cache namespace.
func CachePath ¶
CachePath returns a cache directory name based on the base path, file hash and cache namespace.
func ConvertWorker ¶
func ConvertWorker(jobs <-chan ConvertJob)
func DeleteFiles ¶
DeleteFiles permanently deletes media and related sidecar files.
func DeletePhoto ¶
DeletePhoto removes a photo from the index and optionally all related media files.
func ExifToolCacheName ¶
ExifToolCacheName returns the ExifTool metadata cache file name.
func ImportWorker ¶
func ImportWorker(jobs <-chan ImportJob)
func IndexWorker ¶
func IndexWorker(jobs <-chan IndexJob)
func RestoreAlbums ¶
RestoreAlbums restores all album YAML file backups.
func RootRelName ¶
RootRelName returns the relative filename, and automatically detects the root path.
func ThumbsWorker ¶
func ThumbsWorker(jobs <-chan ThumbsJob)
Types ¶
type CleanUp ¶
type CleanUp struct {
// contains filtered or unexported fields
}
CleanUp represents a worker that deletes orphaned index entries, sidecar files and thumbnails.
func NewCleanUp ¶
NewCleanUp returns a new cleanup worker.
type CleanUpOptions ¶
type CleanUpOptions struct {
Dry bool
}
type Convert ¶
type Convert struct {
// contains filtered or unexported fields
}
Convert represents a converter that can convert RAW/HEIF images to JPEG.
func NewConvert ¶
NewConvert returns a new converter and expects the config as argument.
func (*Convert) AvcBitrate ¶
AvcBitrate returns the ideal AVC encoding bitrate in megabits per second.
func (*Convert) AvcConvertCommand ¶
func (c *Convert) AvcConvertCommand(f *MediaFile, avcName string, encoder ffmpeg.AvcEncoder) (result *exec.Cmd, useMutex bool, err error)
AvcConvertCommand returns the command for converting video files to MPEG-4 AVC.
func (*Convert) FixJpeg ¶
FixJpeg tries to re-encode a broken JPEG and returns the cached image file.
func (*Convert) JpegConvertCommands ¶
func (c *Convert) JpegConvertCommands(f *MediaFile, jpegName string, xmpName string) (result []*exec.Cmd, useMutex bool, err error)
JpegConvertCommands returns commands for converting a media file to JPEG, if possible.
func (*Convert) PngConvertCommands ¶
func (c *Convert) PngConvertCommands(f *MediaFile, pngName string) (result []*exec.Cmd, useMutex bool, err error)
PngConvertCommands returns commands for converting a media file to PNG, if possible.
func (*Convert) ToAvc ¶
func (c *Convert) ToAvc(f *MediaFile, encoder ffmpeg.AvcEncoder, noMutex, force bool) (file *MediaFile, err error)
ToAvc converts a single video file to MPEG-4 AVC.
type ConvertJob ¶
type ConvertJob struct {
// contains filtered or unexported fields
}
type Faces ¶
type Faces struct {
// contains filtered or unexported fields
}
Faces represents a worker for face clustering and matching.
func (*Faces) Cluster ¶
func (w *Faces) Cluster(opt FacesOptions) (added entity.Faces, err error)
Cluster clusters indexed face embeddings.
func (*Faces) Match ¶
func (w *Faces) Match(opt FacesOptions) (result FacesMatchResult, err error)
Match matches markers with faces and subjects.
func (*Faces) MatchFaces ¶
func (w *Faces) MatchFaces(faces entity.Faces, force bool, matchedBefore *time.Time) (result FacesMatchResult, err error)
MatchFaces matches markers against a slice of faces.
func (*Faces) Optimize ¶
func (w *Faces) Optimize() (result FacesOptimizeResult, err error)
Optimize optimizes the face lookup table.
func (*Faces) Reset ¶
Reset removes automatically added face clusters, marker matches, and dangling subjects.
func (*Faces) Start ¶
func (w *Faces) Start(opt FacesOptions) (err error)
Start face clustering and matching.
func (*Faces) StartDefault ¶
StartDefault starts face clustering and matching with default options.
type FacesMatchResult ¶
FacesMatchResult represents the outcome of Faces.Match().
func (*FacesMatchResult) Add ¶
func (r *FacesMatchResult) Add(result FacesMatchResult)
Add adds result counts.
type FacesOptimizeResult ¶
type FacesOptimizeResult struct {
Merged int
}
FacesOptimizeResult represents the outcome of Faces.Optimize().
type FacesOptions ¶
func FacesOptionsDefault ¶
func FacesOptionsDefault() FacesOptions
FacesOptionsDefault returns new faces options with default values.
func (FacesOptions) SampleThreshold ¶
func (o FacesOptions) SampleThreshold() int
SampleThreshold returns the face embeddings sample threshold for clustering.
type Files ¶
type Files struct {
// contains filtered or unexported fields
}
Files represents a list of already indexed file names and their unix modification timestamps.
func (*Files) Done ¶
func (m *Files) Done()
Done should be called after all files have been processed.
func (*Files) Ignore ¶
Ignore tests of a file requires indexing, file name must be relative to the originals path.
type Import ¶
type Import struct {
// contains filtered or unexported fields
}
Import represents an importer that can copy/move MediaFiles to the originals directory.
type ImportJob ¶
type ImportJob struct { FileName string Related RelatedFiles IndexOpt IndexOptions ImportOpt ImportOptions Imp *Import }
type ImportOptions ¶
type ImportOptions struct { UID string Action string Albums []string Path string Move bool NonBlocking bool DestFolder string RemoveDotFiles bool RemoveExistingFiles bool RemoveEmptyDirectories bool }
ImportOptions represents file import options.
func ImportOptionsCopy ¶
func ImportOptionsCopy(importPath, destFolder string) ImportOptions
ImportOptionsCopy returns import options for copying files to originals (read-only).
func ImportOptionsMove ¶
func ImportOptionsMove(importPath, destFolder string) ImportOptions
ImportOptionsMove returns import options for moving files to originals (modifies import directory).
func ImportOptionsUpload ¶
func ImportOptionsUpload(uploadPath, destFolder string) ImportOptions
ImportOptionsUpload returns options for importing user uploads.
func (*ImportOptions) SetUser ¶
func (o *ImportOptions) SetUser(user *entity.User) *ImportOptions
SetUser sets the user who performs the import operation.
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index represents an indexer that indexes files in the originals directory.
func NewIndex ¶
func NewIndex(conf *config.Config, tensorFlow *classify.TensorFlow, nsfwDetector *nsfw.Detector, faceNet *face.Net, convert *Convert, files *Files, photos *Photos) *Index
NewIndex returns a new indexer and expects its dependencies as arguments.
func (*Index) FileName ¶
func (ind *Index) FileName(fileName string, o IndexOptions) (result IndexResult)
FileName indexes a single file and returns the result.
func (*Index) LastRun ¶
LastRun returns the time when the index was last updated and how many files were found.
func (*Index) MediaFile ¶
func (ind *Index) MediaFile(m *MediaFile, o IndexOptions, originalName, photoUID string) (result IndexResult)
MediaFile indexes a single media file.
func (*Index) Start ¶
func (ind *Index) Start(o IndexOptions) (found fs.Done, updated int)
Start indexes media files in the "originals" folder.
func (*Index) UserMediaFile ¶
func (ind *Index) UserMediaFile(m *MediaFile, o IndexOptions, originalName, photoUID, userUID string) (result IndexResult)
UserMediaFile indexes a single media file owned by a user.
type IndexJob ¶
type IndexJob struct { FileName string Related RelatedFiles IndexOpt IndexOptions Ind *Index }
type IndexOptions ¶
type IndexOptions struct { UID string Action string Path string Rescan bool Convert bool Stack bool FacesOnly bool SkipArchived bool ByteLimit int64 ResolutionLimit int }
IndexOptions represents file indexing options.
func IndexOptionsAll ¶
func IndexOptionsAll() IndexOptions
IndexOptionsAll returns new index options with all options set to true.
func IndexOptionsFacesOnly ¶
func IndexOptionsFacesOnly() IndexOptions
IndexOptionsFacesOnly returns new index options for updating faces only.
func IndexOptionsNone ¶
func IndexOptionsNone() IndexOptions
IndexOptionsNone returns new index options with all options set to false.
func IndexOptionsSingle ¶
func IndexOptionsSingle() IndexOptions
IndexOptionsSingle returns new index options for unstacked, single files.
func NewIndexOptions ¶
func NewIndexOptions(path string, rescan, convert, stack, facesOnly, skipArchived bool) IndexOptions
NewIndexOptions returns new index options instance.
func (*IndexOptions) SetUser ¶
func (o *IndexOptions) SetUser(user *entity.User) *IndexOptions
SetUser sets the user who performs the index operation.
func (*IndexOptions) SkipUnchanged ¶
func (o *IndexOptions) SkipUnchanged() bool
SkipUnchanged checks if unchanged media files should be skipped.
type IndexResult ¶
type IndexResult struct { Status IndexStatus Err error FileID uint FileUID string PhotoID uint PhotoUID string }
IndexResult represents a media file indexing result.
func IndexMain ¶
func IndexMain(related *RelatedFiles, ind *Index, o IndexOptions) (result IndexResult)
IndexMain indexes the main file from a group of related files and returns the result.
func IndexRelated ¶
func IndexRelated(related RelatedFiles, ind *Index, o IndexOptions) (result IndexResult)
IndexRelated indexes a group of related files and returns the result.
func (IndexResult) Archived ¶
func (r IndexResult) Archived() bool
Archived checks whether a media file was skipped because it is archived.
func (IndexResult) Failed ¶
func (r IndexResult) Failed() bool
Failed checks if indexing has failed.
func (IndexResult) FileError ¶
func (r IndexResult) FileError() (string, error)
FileError checks if there is a file error and returns it.
func (IndexResult) Indexed ¶
func (r IndexResult) Indexed() bool
Indexed checks whether a media file was successfully indexed.
func (IndexResult) Skipped ¶
func (r IndexResult) Skipped() bool
Skipped checks whether a media file was skipped while indexing.
func (IndexResult) Stacked ¶
func (r IndexResult) Stacked() bool
Stacked checks whether a media file was stacked while indexing.
func (IndexResult) String ¶
func (r IndexResult) String() string
String returns the indexing result as string.
func (IndexResult) Success ¶
func (r IndexResult) Success() bool
Success checks whether a media file was successfully indexed or skipped.
type IndexStatus ¶
type IndexStatus string
const ( IndexUpdated IndexStatus = "updated" IndexAdded IndexStatus = "added" IndexStacked IndexStatus = "stacked" IndexSkipped IndexStatus = "skipped" IndexDuplicate IndexStatus = "skipped duplicate" IndexArchived IndexStatus = "skipped archived" IndexFailed IndexStatus = "failed" )
type Label ¶
type Label struct { Name string `json:"label"` // Label name Source string `json:"source"` // Where was this label found / detected? Uncertainty int `json:"uncertainty"` // >= 0 Priority int `json:"priority"` // >= 0 Categories []string `json:"categories"` // List of similar labels }
Label represents a MediaFile label (automatically created).
type MediaFile ¶
type MediaFile struct {
// contains filtered or unexported fields
}
MediaFile represents a single photo, video, sidecar, or other supported media file.
func NewMediaFile ¶
NewMediaFile returns a new media file and automatically resolves any symlinks.
func NewMediaFileSkipResolve ¶
NewMediaFileSkipResolve returns a new media file without resolving symlinks. This is useful because if it is known that the filename is fully resolved, it is much faster.
func (*MediaFile) AbsPrefix ¶
AbsPrefix returns the directory and base filename without any extensions.
func (*MediaFile) AspectRatio ¶
AspectRatio returns the aspect ratio of a MediaFile.
func (*MediaFile) BasePrefix ¶
BasePrefix returns the filename base without any extensions and path.
func (*MediaFile) CameraMake ¶
CameraMake returns the make of the camera with which the file was created.
func (*MediaFile) CameraModel ¶
CameraModel returns the camera model with which the media file was created.
func (*MediaFile) CanonicalName ¶
CanonicalName returns the canonical name of a media file.
func (*MediaFile) CanonicalNameFromFile ¶
CanonicalNameFromFile returns the canonical name of a file derived from the image name.
func (*MediaFile) CanonicalNameFromFileWithDirectory ¶
CanonicalNameFromFileWithDirectory gets the canonical name for a MediaFile including the directory.
func (*MediaFile) ChangeOrientation ¶
ChangeOrientation changes the file orientation.
func (*MediaFile) CheckType ¶
CheckType returns an error if the file extension is missing or invalid, see https://github.com/photoprism/photoprism/issues/3518 for details.
func (*MediaFile) ColorProfile ¶
ColorProfile returns the ICC color profile name.
func (*MediaFile) Colors ¶
func (m *MediaFile) Colors(thumbPath string) (perception colors.ColorPerception, err error)
Colors returns the ColorPerception of an image (only JPEG supported).
func (*MediaFile) CreateExifToolJson ¶
CreateExifToolJson extracts metadata to a JSON file using Exiftool.
func (*MediaFile) CreateThumbnails ¶
CreateThumbnails creates the default thumbnail sizes if the media file is a JPEG and they don't exist yet (except force is true).
func (*MediaFile) DateCreated ¶
DateCreated returns the media creation time in UTC.
func (*MediaFile) DecodeConfig ¶
DecodeConfig extracts the raw dimensions from the header of natively supported image file formats.
func (*MediaFile) EditedName ¶
EditedName returns the corresponding edited image file name as used by Apple (e.g. IMG_E12345.JPG).
func (*MediaFile) ExceedsBytes ¶
ExceedsBytes checks if the file exceeds the specified size limit in bytes.
func (*MediaFile) ExceedsResolution ¶
ExceedsResolution checks if an image in a natively supported format exceeds the configured resolution limit in megapixels.
func (*MediaFile) ExifSupported ¶
ExifSupported returns true if parsing exif metadata is supported for the media file type.
func (*MediaFile) ExifToolJsonName ¶
ExifToolJsonName returns the cached ExifTool metadata file name.
func (*MediaFile) FocalLength ¶
FocalLength return the length of the focal for a file.
func (*MediaFile) HasFileType ¶
HasFileType checks if the file has the given file type.
func (*MediaFile) HasMediaType ¶
HasMediaType checks if the file has is the given media type.
func (*MediaFile) HasPreviewImage ¶
HasPreviewImage returns true if the file has or is a JPEG or PNG image.
func (*MediaFile) HasSameName ¶
HasSameName compares a media file with another media file and returns if their filenames are matching or not.
func (*MediaFile) HasSidecarJson ¶
HasSidecarJson returns true if this file has or is a json sidecar file.
func (*MediaFile) HasTimeAndPlace ¶
func (*MediaFile) InOriginals ¶
InOriginals checks if the file is stored in the 'originals' folder.
func (*MediaFile) IsAVIF ¶
IsAVIF checks if the file is an AV1 Image File Format image with a supported file type extension.
func (*MediaFile) IsAVIFS ¶
IsAVIFS checks if the file is an AVIF image sequence with a supported file type extension.
func (*MediaFile) IsAnimated ¶
IsAnimated returns true if it is a video or animated image.
func (*MediaFile) IsAnimatedImage ¶
IsAnimatedImage checks if the file is an animated image.
func (*MediaFile) IsBMP ¶
IsBMP checks if the file is a bitmap image with a supported file type extension.
func (*MediaFile) IsDNG ¶
IsDNG checks if the file is a Adobe Digital Negative (DNG) image with a supported file type extension.
func (*MediaFile) IsGIF ¶
IsGIF checks if the file is a GIF image with a supported file type extension.
func (*MediaFile) IsHEIC ¶
IsHEIC checks if the file is a High Efficiency Image Container (HEIC) image with a supported file type extension.
func (*MediaFile) IsHEICS ¶
IsHEICS checks if the file is a HEIC image sequence with a supported file type extension.
func (*MediaFile) IsHEIF ¶
IsHEIF checks if the file is a High Efficiency Image File Format (HEIF) container with a supported file type extension.
func (*MediaFile) IsImageNative ¶
IsImageNative returns true if it is a natively supported image file.
func (*MediaFile) IsImageOther ¶
IsImageOther returns true if this is a PNG, GIF, BMP, TIFF, or WebP file.
func (*MediaFile) IsJSON ¶
IsJSON checks if the file is a JSON sidecar file with a supported file type extension.
func (*MediaFile) IsJpeg ¶
IsJpeg checks if the file is a JPEG image with a supported file type extension.
func (*MediaFile) IsJpegXL ¶
IsJpegXL checks if the file is a JPEG XL image with a supported file type extension.
func (*MediaFile) IsMedia ¶
IsMedia returns true if this is a media file (photo or video, not sidecar or other).
func (*MediaFile) IsPNG ¶
IsPNG checks if the file is a PNG image with a supported file type extension.
func (*MediaFile) IsPreviewImage ¶
IsPreviewImage return true if this media file is a JPEG or PNG image.
func (*MediaFile) IsSidecar ¶
IsSidecar checks if the file is a metadata sidecar file, independent of the storage location.
func (*MediaFile) IsTIFF ¶
IsTIFF checks if the file is a TIFF image with a supported file type extension.
func (*MediaFile) IsWebP ¶
IsWebP checks if the file is a WebP image file with a supported file type extension.
func (*MediaFile) Megapixels ¶
Megapixels returns the resolution in megapixels if possible.
func (*MediaFile) NeedsExifToolJson ¶
NeedsExifToolJson tests if an ExifTool JSON file needs to be created.
func (*MediaFile) NeedsTranscoding ¶
NeedsTranscoding checks whether the media file is a video or an animated image and should be transcoded to a playable format.
func (*MediaFile) NotAnimated ¶
NotAnimated checks if the file is not a video or an animated image.
func (*MediaFile) Orientation ¶
Orientation returns the Exif orientation of the media file.
func (*MediaFile) PathNameInfo ¶
func (m *MediaFile) PathNameInfo(stripSequence bool) (fileRoot, fileBase, relativePath, relativeName string)
PathNameInfo returns file name infos for indexing.
func (*MediaFile) PreviewImage ¶
PreviewImage returns a PNG or JPEG version of the media file, if exists.
func (*MediaFile) ReadExifToolJson ¶
ReadExifToolJson reads metadata from a cached ExifTool JSON file.
func (*MediaFile) RelatedFiles ¶
func (m *MediaFile) RelatedFiles(stripSequence bool) (result RelatedFiles, err error)
RelatedFiles returns files which are related to this file.
func (*MediaFile) RelatedSidecarFiles ¶
RelatedSidecarFiles finds additional sidecar files with naming schemes not matching the default glob pattern for related files. see https://github.com/photoprism/photoprism/issues/2983 for further information.
func (*MediaFile) RemoveSidecarFiles ¶
RemoveSidecarFiles permanently removes related sidecar files.
func (*MediaFile) RenameSidecarFiles ¶
RenameSidecarFiles moves related sidecar files.
func (*MediaFile) RootRelName ¶
RootRelName returns the relative filename, and automatically detects the root path.
func (*MediaFile) RootRelPath ¶
RootRelPath returns the relative path and automatically detects the root path.
func (*MediaFile) SetFileName ¶
SetFileName sets the filename to the given string.
func (*MediaFile) SetModTime ¶
SetModTime sets the file modification time.
func (*MediaFile) SidecarJsonName ¶
SidecarJsonName returns the corresponding JSON sidecar file name as used by Google Photos (and potentially other apps).
func (*MediaFile) SkipTranscoding ¶
SkipTranscoding checks if the media file is not animated or has already been transcoded to a playable format.
func (*MediaFile) Stat ¶
Stat calls os.Stat() to return the file size and modification time, or an error if this failed.
func (*MediaFile) TakenAt ¶
TakenAt returns the media creation time in UTC and the source from which it originates.
type MediaFiles ¶
type MediaFiles []*MediaFile
MediaFiles represents a slice of files.
func (MediaFiles) Less ¶
func (f MediaFiles) Less(i, j int) bool
Less compares two files based on the filename.
func (MediaFiles) Swap ¶
func (f MediaFiles) Swap(i, j int)
Swap the position of two files in the slice.
type Moments ¶
type Moments struct {
// contains filtered or unexported fields
}
Moments represents a worker that creates albums based on popular locations, dates and labels.
func NewMoments ¶
NewMoments returns a new Moments worker.
func (*Moments) MigrateSlug ¶
MigrateSlug updates deprecated moment slugs if needed.
type Photos ¶
type Photos struct {
// contains filtered or unexported fields
}
Photos represents photo id lookup table, sorted by date and S2 cell id.
type Places ¶
type Places struct {
// contains filtered or unexported fields
}
Places represents a geo data worker.
func (*Places) UpdatePhotos ¶
UpdatePhotos updates all location-related photo metadata in the index.
type Purge ¶
type Purge struct {
// contains filtered or unexported fields
}
Purge represents a worker that removes missing files from search results.
type PurgeOptions ¶
type RelatedFiles ¶
type RelatedFiles struct { Files MediaFiles Main *MediaFile }
RelatedFiles represents a list of related files to be indexed or imported.
func (RelatedFiles) Count ¶
func (m RelatedFiles) Count() int
Count returns the number of files without the main file.
func (RelatedFiles) HasPreview ¶
func (m RelatedFiles) HasPreview() bool
HasPreview checks if the list of files contains a PNG or JPEG image to render a preview in the UI.
func (RelatedFiles) MainFileType ¶
func (m RelatedFiles) MainFileType() string
MainFileType returns the main file type as string.
func (RelatedFiles) MainLogName ¶
func (m RelatedFiles) MainLogName() string
MainLogName returns the main file name for logging.
func (RelatedFiles) String ¶
func (m RelatedFiles) String() string
String returns file names as string.
type Thumbs ¶
type Thumbs struct {
// contains filtered or unexported fields
}
Thumbs represents a thumbnail image generator.
Source Files ¶
- actions.go
- albums.go
- cleanup.go
- cleanup_options.go
- colors.go
- config.go
- convert.go
- convert_fix.go
- convert_image.go
- convert_image_jpeg.go
- convert_image_png.go
- convert_sidecar_json.go
- convert_video_avc.go
- convert_worker.go
- delete.go
- faces.go
- faces_audit.go
- faces_cluster.go
- faces_match.go
- faces_optimize.go
- faces_options.go
- faces_reset.go
- faces_stats.go
- filename.go
- files.go
- import.go
- import_options.go
- import_worker.go
- index.go
- index_faces.go
- index_labels.go
- index_main.go
- index_mediafile.go
- index_nsfw.go
- index_options.go
- index_related.go
- index_result.go
- index_worker.go
- label.go
- location.go
- mediafile.go
- mediafile_meta.go
- mediafile_related.go
- mediafile_thumbs.go
- mediafiles.go
- moments.go
- photoprism.go
- photos.go
- places.go
- purge.go
- purge_options.go
- related.go
- thumbs.go
- thumbs_worker.go
- timezone.go