gallery

package
v0.24.3 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2024 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPerformer added in v0.7.0

func AddPerformer(ctx context.Context, qb models.GalleryUpdater, o *models.Gallery, performerID int) error

func AddTag added in v0.7.0

func AddTag(ctx context.Context, qb models.GalleryUpdater, o *models.Gallery, tagID int) error

func CountByPerformerID added in v0.7.0

func CountByPerformerID(ctx context.Context, r models.GalleryQueryer, id int) (int, error)

func CountByStudioID added in v0.7.0

func CountByStudioID(ctx context.Context, r models.GalleryQueryer, id int, depth *int) (int, error)

func CountByTagID added in v0.7.0

func CountByTagID(ctx context.Context, r models.GalleryQueryer, id int, depth *int) (int, error)

func DestroyChapter added in v0.20.0

func DestroyChapter(ctx context.Context, galleryChapter *models.GalleryChapter, qb models.GalleryChapterDestroyer) error

func GetGalleryChaptersJSON added in v0.20.0

func GetGalleryChaptersJSON(ctx context.Context, chapterReader models.GalleryChapterFinder, gallery *models.Gallery) ([]jsonschema.GalleryChapter, error)

GetGalleryChaptersJSON returns a slice of GalleryChapter JSON representation objects corresponding to the provided gallery's chapters.

func GetIDs

func GetIDs(galleries []*models.Gallery) []int

func GetRefs added in v0.17.0

func GetRefs(galleries []*models.Gallery) []jsonschema.GalleryRef

func GetStudioName

func GetStudioName(ctx context.Context, reader models.StudioGetter, gallery *models.Gallery) (string, error)

GetStudioName returns the name of the provided gallery's studio. It returns an empty string if there is no studio assigned to the gallery.

func PathsFilter added in v0.12.0

func PathsFilter(paths []string) *models.GalleryFilterType

func ToBasicJSON

func ToBasicJSON(gallery *models.Gallery) (*jsonschema.Gallery, error)

ToBasicJSON converts a gallery object into its JSON object equivalent. It does not convert the relationships to other objects.

Types

type ChapterImporter added in v0.20.0

type ChapterImporter struct {
	GalleryID           int
	ReaderWriter        ChapterImporterReaderWriter
	Input               jsonschema.GalleryChapter
	MissingRefBehaviour models.ImportMissingRefEnum
	// contains filtered or unexported fields
}

func (*ChapterImporter) Create added in v0.20.0

func (i *ChapterImporter) Create(ctx context.Context) (*int, error)

func (*ChapterImporter) FindExistingID added in v0.20.0

func (i *ChapterImporter) FindExistingID(ctx context.Context) (*int, error)

func (*ChapterImporter) Name added in v0.20.0

func (i *ChapterImporter) Name() string

func (*ChapterImporter) PostImport added in v0.20.0

func (i *ChapterImporter) PostImport(ctx context.Context, id int) error

func (*ChapterImporter) PreImport added in v0.20.0

func (i *ChapterImporter) PreImport(ctx context.Context) error

func (*ChapterImporter) Update added in v0.20.0

func (i *ChapterImporter) Update(ctx context.Context, id int) error

type ChapterImporterReaderWriter added in v0.23.0

type ChapterImporterReaderWriter interface {
	models.GalleryChapterCreatorUpdater
	FindByGalleryID(ctx context.Context, galleryID int) ([]*models.GalleryChapter, error)
}

type ContentsChangedError added in v0.17.0

type ContentsChangedError struct {
	Gallery *models.Gallery
}

func (*ContentsChangedError) Error added in v0.17.0

func (e *ContentsChangedError) Error() string

type ImageFinder added in v0.17.0

type ImageFinder interface {
	FindByFolderID(ctx context.Context, folder models.FolderID) ([]*models.Image, error)
	FindByZipFileID(ctx context.Context, zipFileID models.FileID) ([]*models.Image, error)
	models.GalleryIDLoader
}

type ImageService added in v0.17.0

type ImageService interface {
	Destroy(ctx context.Context, i *models.Image, fileDeleter *image.FileDeleter, deleteGenerated, deleteFile bool) error
	DestroyZipImages(ctx context.Context, zipFile models.File, fileDeleter *image.FileDeleter, deleteGenerated bool) ([]*models.Image, error)
}

type ImageUpdater added in v0.17.0

type ImageUpdater interface {
	GetImageIDs(ctx context.Context, galleryID int) ([]int, error)
	AddImages(ctx context.Context, galleryID int, imageIDs ...int) error
	RemoveImages(ctx context.Context, galleryID int, imageIDs ...int) error
}

type Importer

type Importer struct {
	ReaderWriter        ImporterReaderWriter
	StudioWriter        models.StudioFinderCreator
	PerformerWriter     models.PerformerFinderCreator
	TagWriter           models.TagFinderCreator
	FileFinder          models.FileFinder
	FolderFinder        models.FolderFinder
	Input               jsonschema.Gallery
	MissingRefBehaviour models.ImportMissingRefEnum

	ID int
	// contains filtered or unexported fields
}

func (*Importer) Create

func (i *Importer) Create(ctx context.Context) (*int, error)

func (*Importer) FindExistingID

func (i *Importer) FindExistingID(ctx context.Context) (*int, error)

func (*Importer) Name

func (i *Importer) Name() string

func (*Importer) PostImport

func (i *Importer) PostImport(ctx context.Context, id int) error

func (*Importer) PreImport

func (i *Importer) PreImport(ctx context.Context) error

func (*Importer) Update

func (i *Importer) Update(ctx context.Context, id int) error

type ImporterReaderWriter added in v0.23.0

type ImporterReaderWriter interface {
	models.GalleryCreatorUpdater
	FindByFileID(ctx context.Context, fileID models.FileID) ([]*models.Gallery, error)
	FindByFolderID(ctx context.Context, folderID models.FolderID) ([]*models.Gallery, error)
	FindUserGalleryByTitle(ctx context.Context, title string) ([]*models.Gallery, error)
}

type ScanCreatorUpdater added in v0.23.0

type ScanCreatorUpdater interface {
	FindByFileID(ctx context.Context, fileID models.FileID) ([]*models.Gallery, error)
	FindByFingerprints(ctx context.Context, fp []models.Fingerprint) ([]*models.Gallery, error)
	GetFiles(ctx context.Context, relatedID int) ([]models.File, error)

	Create(ctx context.Context, newGallery *models.Gallery, fileIDs []models.FileID) error
	UpdatePartial(ctx context.Context, id int, updatedGallery models.GalleryPartial) (*models.Gallery, error)
	AddFileID(ctx context.Context, id int, fileID models.FileID) error
}

type ScanHandler added in v0.17.0

type ScanHandler struct {
	CreatorUpdater     ScanCreatorUpdater
	SceneFinderUpdater ScanSceneFinderUpdater
	ImageFinderUpdater ScanImageFinderUpdater
	PluginCache        *plugin.Cache
}

func (*ScanHandler) Handle added in v0.17.0

func (h *ScanHandler) Handle(ctx context.Context, f models.File, oldFile models.File) error

type ScanImageFinderUpdater added in v0.23.0

type ScanImageFinderUpdater interface {
	FindByZipFileID(ctx context.Context, zipFileID models.FileID) ([]*models.Image, error)
	UpdatePartial(ctx context.Context, id int, partial models.ImagePartial) (*models.Image, error)
}

type ScanSceneFinderUpdater added in v0.23.0

type ScanSceneFinderUpdater interface {
	FindByPath(ctx context.Context, p string) ([]*models.Scene, error)
	Update(ctx context.Context, updatedScene *models.Scene) error
	AddGalleryIDs(ctx context.Context, sceneID int, galleryIDs []int) error
}

type Service added in v0.17.0

type Service struct {
	Repository   models.GalleryReaderWriter
	ImageFinder  ImageFinder
	ImageService ImageService
	File         models.FileReaderWriter
	Folder       models.FolderReaderWriter
}

func (*Service) AddImages added in v0.17.0

func (s *Service) AddImages(ctx context.Context, g *models.Gallery, toAdd ...int) error

AddImages adds images to the provided gallery. It returns an error if the gallery does not support adding images, or if the operation fails.

func (*Service) Destroy added in v0.17.0

func (s *Service) Destroy(ctx context.Context, i *models.Gallery, fileDeleter *image.FileDeleter, deleteGenerated, deleteFile bool) ([]*models.Image, error)

func (*Service) RemoveImages added in v0.17.0

func (s *Service) RemoveImages(ctx context.Context, g *models.Gallery, toRemove ...int) error

RemoveImages removes images from the provided gallery. It does not validate if the images are part of the gallery. It returns an error if the gallery does not support removing images, or if the operation fails.

func (*Service) Updated added in v0.21.0

func (s *Service) Updated(ctx context.Context, galleryID int) error

func (*Service) ValidateImageGalleryChange added in v0.17.0

func (s *Service) ValidateImageGalleryChange(ctx context.Context, i *models.Image, updateIDs models.UpdateIDs) error

Jump to

Keyboard shortcuts

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