From 25f1f574efdf0c0e7e3693e5f75e2033fd68f131 Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Sun, 4 Jan 2026 18:47:21 -0500 Subject: [PATCH] Keep contact sheets out of thumbnails folders --- thumb_module.go | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/thumb_module.go b/thumb_module.go index 40e4e1e..9c16c1d 100644 --- a/thumb_module.go +++ b/thumb_module.go @@ -419,11 +419,8 @@ func buildThumbView(state *appState) fyne.CanvasObject { videoDir := filepath.Dir(state.thumbFile.Path) videoBaseName := strings.TrimSuffix(filepath.Base(state.thumbFile.Path), filepath.Ext(state.thumbFile.Path)) outputDir := filepath.Join(videoDir, fmt.Sprintf("%s_thumbnails", videoBaseName)) - - // Check if output exists - if _, err := os.Stat(outputDir); os.IsNotExist(err) { - dialog.ShowInformation("No Results", "No generated thumbnails found. Generate thumbnails first.", state.window) - return + if state.thumbContactSheet { + outputDir = videoDir } // If contact sheet mode, try to open contact sheet image @@ -435,6 +432,22 @@ func buildThumbView(state *appState) fyne.CanvasObject { } return } + legacyDir := filepath.Join(videoDir, fmt.Sprintf("%s_thumbnails", videoBaseName)) + legacyPath := filepath.Join(legacyDir, fmt.Sprintf("%s_contact_sheet.jpg", videoBaseName)) + if _, err := os.Stat(legacyPath); err == nil { + if err := openFile(legacyPath); err != nil { + dialog.ShowError(fmt.Errorf("failed to open contact sheet: %w", err), state.window) + } + return + } + dialog.ShowInformation("No Results", "No generated contact sheet found. Generate one first.", state.window) + return + } + + // Check if output exists + if _, err := os.Stat(outputDir); os.IsNotExist(err) { + dialog.ShowInformation("No Results", "No generated thumbnails found. Generate thumbnails first.", state.window) + return } // Otherwise, open first thumbnail @@ -587,6 +600,11 @@ func (s *appState) createThumbJobForPath(path string) *queue.Job { videoDir := filepath.Dir(path) videoBaseName := strings.TrimSuffix(filepath.Base(path), filepath.Ext(path)) outputDir := filepath.Join(videoDir, fmt.Sprintf("%s_thumbnails", videoBaseName)) + outputFile := outputDir + if s.thumbContactSheet { + outputDir = videoDir + outputFile = filepath.Join(videoDir, fmt.Sprintf("%s_contact_sheet.jpg", videoBaseName)) + } var count, width int var description string @@ -605,7 +623,7 @@ func (s *appState) createThumbJobForPath(path string) *queue.Job { Title: "Thumbnails: " + filepath.Base(path), Description: description, InputFile: path, - OutputFile: outputDir, + OutputFile: outputFile, Config: map[string]interface{}{ "inputPath": path, "outputDir": outputDir,