WIP: split up scanner into separate tasks

This commit is contained in:
viktorstrate
2022-02-15 17:22:41 +01:00
parent 6361df1793
commit 6e2a64bc77
21 changed files with 907 additions and 673 deletions

View File

@@ -54,10 +54,11 @@ func encodeImageJPEG(image image.Image, outputPath string, jpegQuality int) erro
// EncodeMediaData is used to easily decode media data, with a cache so expensive operations are not repeated
type EncodeMediaData struct {
Media *models.Media
_photoImage image.Image
_contentType *media_type.MediaType
_videoMetadata *ffprobe.ProbeData
Media *models.Media
CounterpartPath *string
_photoImage image.Image
_contentType *media_type.MediaType
_videoMetadata *ffprobe.ProbeData
}
// ContentType reads the image to determine its content type
@@ -86,7 +87,7 @@ func (img *EncodeMediaData) EncodeHighRes(outputPath string) error {
}
// Use darktable if there is no counterpart JPEG file to use instead
if contentType.IsRaw() && img.Media.CounterpartPath == nil {
if contentType.IsRaw() && img.CounterpartPath == nil {
if executable_worker.DarktableCli.IsInstalled() {
err := executable_worker.DarktableCli.EncodeJpeg(img.Media.Path, outputPath, 70)
if err != nil {
@@ -114,8 +115,8 @@ func (img *EncodeMediaData) photoImage() (image.Image, error) {
}
var photoPath string
if img.Media.CounterpartPath != nil {
photoPath = *img.Media.CounterpartPath
if img.CounterpartPath != nil {
photoPath = *img.CounterpartPath
} else {
photoPath = img.Media.Path
}