Documentation ¶
Overview ¶
Package image provides the application logic for images. The functionality is exposed via the Service type.
Index ¶
- Variables
- func AddPerformer(ctx context.Context, qb models.ImageUpdater, i *models.Image, performerID int) error
- func AddTag(ctx context.Context, qb models.ImageUpdater, i *models.Image, tagID int) error
- func CountByPerformerID(ctx context.Context, r QueryCounter, id int) (int, error)
- func CountByStudioID(ctx context.Context, r QueryCounter, id int, depth *int) (int, error)
- func CountByTagID(ctx context.Context, r QueryCounter, id int, depth *int) (int, error)
- func FindByGalleryID(ctx context.Context, r Queryer, galleryID int, sortBy string, ...) ([]*models.Image, error)
- func FindGalleryCover(ctx context.Context, r CoverQueryer, galleryID int, galleryCoverRegex string) (*models.Image, error)
- func GetStudioName(ctx context.Context, reader models.StudioGetter, image *models.Image) (string, error)
- func GetVipsPath() string
- func PathsFilter(paths []string) *models.ImageFilterType
- func Query(ctx context.Context, qb Queryer, imageFilter *models.ImageFilterType, ...) ([]*models.Image, error)
- func QueryOptions(imageFilter *models.ImageFilterType, findFilter *models.FindFilterType, ...) models.ImageQueryOptions
- func ToBasicJSON(image *models.Image) *jsonschema.Image
- type ClipPreviewOptions
- type CoverQueryer
- type FileDeleter
- type GalleryFinder
- type GalleryFinderCreator
- type Importer
- func (i *Importer) Create(ctx context.Context) (*int, error)
- func (i *Importer) FindExistingID(ctx context.Context) (*int, error)
- func (i *Importer) Name() string
- func (i *Importer) PostImport(ctx context.Context, id int) error
- func (i *Importer) PreImport(ctx context.Context) error
- func (i *Importer) Update(ctx context.Context, id int) error
- type ImporterReaderWriter
- type QueryCounter
- type Queryer
- type ScanConfig
- type ScanCreatorUpdater
- type ScanGenerator
- type ScanHandler
- type Service
- func (s *Service) Destroy(ctx context.Context, i *models.Image, fileDeleter *FileDeleter, ...) error
- func (s *Service) DestroyFolderImages(ctx context.Context, folderID models.FolderID, fileDeleter *FileDeleter, ...) ([]*models.Image, error)
- func (s *Service) DestroyZipImages(ctx context.Context, zipFile models.File, fileDeleter *FileDeleter, ...) ([]*models.Image, error)
- type ThumbnailEncoder
Constants ¶
This section is empty.
Variables ¶
var ( ErrUnsupportedImageFormat = errors.New("unsupported image format") // ErrNotSupportedForThumbnail is returned if the image format is not supported for thumbnail generation ErrNotSupportedForThumbnail = errors.New("unsupported image format for thumbnail") )
var (
ErrNotImageFile = errors.New("not an image file")
)
Functions ¶
func AddPerformer ¶ added in v0.7.0
func CountByPerformerID ¶ added in v0.7.0
func CountByStudioID ¶ added in v0.7.0
func CountByTagID ¶ added in v0.7.0
func FindByGalleryID ¶ added in v0.14.0
func FindGalleryCover ¶ added in v0.18.0
func GetStudioName ¶
func GetStudioName(ctx context.Context, reader models.StudioGetter, image *models.Image) (string, error)
GetStudioName returns the name of the provided image's studio. It returns an empty string if there is no studio assigned to the image.
func GetVipsPath ¶ added in v0.10.0
func GetVipsPath() string
func PathsFilter ¶ added in v0.12.0
func PathsFilter(paths []string) *models.ImageFilterType
func Query ¶ added in v0.11.0
func Query(ctx context.Context, qb Queryer, imageFilter *models.ImageFilterType, findFilter *models.FindFilterType) ([]*models.Image, error)
Query queries for images using the provided filters.
func QueryOptions ¶ added in v0.11.0
func QueryOptions(imageFilter *models.ImageFilterType, findFilter *models.FindFilterType, count bool) models.ImageQueryOptions
QueryOptions returns a ImageQueryResult populated with the provided filters.
func ToBasicJSON ¶
func ToBasicJSON(image *models.Image) *jsonschema.Image
ToBasicJSON converts a image object into its JSON object equivalent. It does not convert the relationships to other objects, with the exception of cover image.
Types ¶
type ClipPreviewOptions ¶ added in v0.21.0
type CoverQueryer ¶ added in v0.27.0
type FileDeleter ¶ added in v0.12.0
FileDeleter is an extension of file.Deleter that handles deletion of image files.
func (*FileDeleter) MarkGeneratedFiles ¶ added in v0.12.0
func (d *FileDeleter) MarkGeneratedFiles(image *models.Image) error
MarkGeneratedFiles marks for deletion the generated files for the provided image.
type GalleryFinder ¶ added in v0.17.0
type GalleryFinderCreator ¶ added in v0.17.0
type GalleryFinderCreator interface { FindByFileID(ctx context.Context, fileID models.FileID) ([]*models.Gallery, error) FindByFolderID(ctx context.Context, folderID models.FolderID) ([]*models.Gallery, error) Create(ctx context.Context, newObject *models.Gallery, fileIDs []models.FileID) error UpdatePartial(ctx context.Context, id int, updatedGallery models.GalleryPartial) (*models.Gallery, error) }
type Importer ¶
type Importer struct { ReaderWriter ImporterReaderWriter FileFinder models.FileFinder StudioWriter models.StudioFinderCreator GalleryFinder GalleryFinder PerformerWriter models.PerformerFinderCreator TagWriter models.TagFinderCreator Input jsonschema.Image MissingRefBehaviour models.ImportMissingRefEnum ID int // contains filtered or unexported fields }
func (*Importer) FindExistingID ¶
type ImporterReaderWriter ¶ added in v0.23.0
type QueryCounter ¶ added in v0.27.0
type QueryCounter interface {
QueryCount(ctx context.Context, imageFilter *models.ImageFilterType, findFilter *models.FindFilterType) (int, error)
}
type Queryer ¶ added in v0.11.0
type Queryer interface {
Query(ctx context.Context, options models.ImageQueryOptions) (*models.ImageQueryResult, error)
}
type ScanConfig ¶ added in v0.17.0
type ScanConfig interface {
GetCreateGalleriesFromFolders() bool
}
type ScanCreatorUpdater ¶ added in v0.23.0
type ScanCreatorUpdater interface { FindByFileID(ctx context.Context, fileID models.FileID) ([]*models.Image, error) FindByFolderID(ctx context.Context, folderID models.FolderID) ([]*models.Image, error) FindByFingerprints(ctx context.Context, fp []models.Fingerprint) ([]*models.Image, error) GetFiles(ctx context.Context, relatedID int) ([]models.File, error) GetGalleryIDs(ctx context.Context, relatedID int) ([]int, error) Create(ctx context.Context, newImage *models.Image, fileIDs []models.FileID) error UpdatePartial(ctx context.Context, id int, updatedImage models.ImagePartial) (*models.Image, error) AddFileID(ctx context.Context, id int, fileID models.FileID) error }
type ScanGenerator ¶ added in v0.21.0
type ScanHandler ¶ added in v0.17.0
type ScanHandler struct { CreatorUpdater ScanCreatorUpdater GalleryFinder GalleryFinderCreator ScanGenerator ScanGenerator ScanConfig ScanConfig PluginCache *plugin.Cache Paths *paths.Paths }
type Service ¶ added in v0.17.0
type Service struct { File models.FileReaderWriter Repository models.ImageReaderWriter }
func (*Service) Destroy ¶ added in v0.17.0
func (s *Service) Destroy(ctx context.Context, i *models.Image, fileDeleter *FileDeleter, deleteGenerated, deleteFile bool) error
Destroy destroys an image, optionally marking the file and generated files for deletion.
func (*Service) DestroyFolderImages ¶ added in v0.27.0
func (s *Service) DestroyFolderImages(ctx context.Context, folderID models.FolderID, fileDeleter *FileDeleter, deleteGenerated, deleteFile bool) ([]*models.Image, error)
DestroyFolderImages destroys all images in a folder, optionally marking the files and generated files for deletion. It will not delete images that are attached to more than one gallery. Returns a slice of images that were destroyed.
func (*Service) DestroyZipImages ¶ added in v0.17.0
func (s *Service) DestroyZipImages(ctx context.Context, zipFile models.File, fileDeleter *FileDeleter, deleteGenerated bool) ([]*models.Image, error)
DestroyZipImages destroys all images in zip, optionally marking the files and generated files for deletion. Returns a slice of images that were destroyed.
type ThumbnailEncoder ¶ added in v0.10.0
type ThumbnailEncoder struct { FFMpeg *ffmpeg.FFMpeg FFProbe *ffmpeg.FFProbe ClipPreviewOptions ClipPreviewOptions // contains filtered or unexported fields }
func NewThumbnailEncoder ¶ added in v0.10.0
func NewThumbnailEncoder(ffmpegEncoder *ffmpeg.FFMpeg, ffProbe *ffmpeg.FFProbe, clipPreviewOptions ClipPreviewOptions) ThumbnailEncoder
func (*ThumbnailEncoder) GetPreview ¶ added in v0.21.0
func (e *ThumbnailEncoder) GetPreview(inPath string, outPath string, maxSize int) error
GetPreview returns the preview clip of the provided image clip resized to the provided max size. It resizes based on the largest X/Y direction. It is hardcoded to 30 seconds maximum right now
func (*ThumbnailEncoder) GetThumbnail ¶ added in v0.10.0
GetThumbnail returns the thumbnail image of the provided image resized to the provided max size. It resizes based on the largest X/Y direction. It returns nil and an error if an error occurs reading, decoding or encoding the image, or if the image is not suitable for thumbnails.