Queue multiple thumbnail drops
This commit is contained in:
parent
46810a6900
commit
8cfa43b210
16
main.go
16
main.go
|
|
@ -11074,7 +11074,7 @@ func (s *appState) handleDrop(pos fyne.Position, items []fyne.URI) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load first video
|
// Multi-drop: add jobs for each file and set first as current preview
|
||||||
go func() {
|
go func() {
|
||||||
src, err := probeVideo(videoPaths[0])
|
src, err := probeVideo(videoPaths[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -11090,10 +11090,22 @@ func (s *appState) handleDrop(pos fyne.Position, items []fyne.URI) {
|
||||||
s.showThumbView()
|
s.showThumbView()
|
||||||
logging.Debug(logging.CatModule, "loaded video into thumb module")
|
logging.Debug(logging.CatModule, "loaded video into thumb module")
|
||||||
}, false)
|
}, false)
|
||||||
|
|
||||||
|
if len(videoPaths) > 1 && s.jobQueue != nil {
|
||||||
|
for _, path := range videoPaths {
|
||||||
|
s.jobQueue.Add(s.createThumbJobForPath(path))
|
||||||
|
}
|
||||||
|
if !s.jobQueue.IsRunning() {
|
||||||
|
s.jobQueue.Start()
|
||||||
|
}
|
||||||
|
fyne.CurrentApp().Driver().DoFromGoroutine(func() {
|
||||||
|
dialog.ShowInformation("Thumbnails", fmt.Sprintf("Queued %d thumbnail jobs.", len(videoPaths)), s.window)
|
||||||
|
}, false)
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// If in filters module, handle single video file
|
// If in filters module, handle single video file
|
||||||
if s.active == "filters" {
|
if s.active == "filters" {
|
||||||
|
|
|
||||||
|
|
@ -237,43 +237,7 @@ func buildThumbView(state *appState) fyne.CanvasObject {
|
||||||
|
|
||||||
// Helper function to create thumbnail job
|
// Helper function to create thumbnail job
|
||||||
createThumbJob := func() *queue.Job {
|
createThumbJob := func() *queue.Job {
|
||||||
// Create output directory in same folder as video
|
return state.createThumbJobForPath(state.thumbFile.Path)
|
||||||
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))
|
|
||||||
|
|
||||||
// Configure based on mode
|
|
||||||
var count, width int
|
|
||||||
var description string
|
|
||||||
if state.thumbContactSheet {
|
|
||||||
// Contact sheet: count is determined by grid, use larger width for analyzable screenshots
|
|
||||||
count = state.thumbColumns * state.thumbRows
|
|
||||||
width = state.thumbSheetWidth
|
|
||||||
description = fmt.Sprintf("Contact sheet: %dx%d grid (%d thumbnails)", state.thumbColumns, state.thumbRows, count)
|
|
||||||
} else {
|
|
||||||
// Individual thumbnails: use user settings
|
|
||||||
count = state.thumbCount
|
|
||||||
width = state.thumbWidth
|
|
||||||
description = fmt.Sprintf("%d individual thumbnails (%dpx width)", count, width)
|
|
||||||
}
|
|
||||||
|
|
||||||
return &queue.Job{
|
|
||||||
Type: queue.JobTypeThumb,
|
|
||||||
Title: "Thumbnails: " + filepath.Base(state.thumbFile.Path),
|
|
||||||
Description: description,
|
|
||||||
InputFile: state.thumbFile.Path,
|
|
||||||
OutputFile: outputDir,
|
|
||||||
Config: map[string]interface{}{
|
|
||||||
"inputPath": state.thumbFile.Path,
|
|
||||||
"outputDir": outputDir,
|
|
||||||
"count": float64(count),
|
|
||||||
"width": float64(width),
|
|
||||||
"contactSheet": state.thumbContactSheet,
|
|
||||||
"showTimestamp": state.thumbShowTimestamps,
|
|
||||||
"columns": float64(state.thumbColumns),
|
|
||||||
"rows": float64(state.thumbRows),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate Now button - adds to queue and starts it
|
// Generate Now button - adds to queue and starts it
|
||||||
|
|
@ -472,3 +436,39 @@ func (s *appState) executeThumbJob(ctx context.Context, job *queue.Job, progress
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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))
|
||||||
|
|
||||||
|
var count, width int
|
||||||
|
var description string
|
||||||
|
if s.thumbContactSheet {
|
||||||
|
count = s.thumbColumns * s.thumbRows
|
||||||
|
width = s.thumbSheetWidth
|
||||||
|
description = fmt.Sprintf("Contact sheet: %dx%d grid (%d thumbnails)", s.thumbColumns, s.thumbRows, count)
|
||||||
|
} else {
|
||||||
|
count = s.thumbCount
|
||||||
|
width = s.thumbWidth
|
||||||
|
description = fmt.Sprintf("%d individual thumbnails (%dpx width)", count, width)
|
||||||
|
}
|
||||||
|
|
||||||
|
return &queue.Job{
|
||||||
|
Type: queue.JobTypeThumb,
|
||||||
|
Title: "Thumbnails: " + filepath.Base(path),
|
||||||
|
Description: description,
|
||||||
|
InputFile: path,
|
||||||
|
OutputFile: outputDir,
|
||||||
|
Config: map[string]interface{}{
|
||||||
|
"inputPath": path,
|
||||||
|
"outputDir": outputDir,
|
||||||
|
"count": float64(count),
|
||||||
|
"width": float64(width),
|
||||||
|
"contactSheet": s.thumbContactSheet,
|
||||||
|
"showTimestamp": s.thumbShowTimestamps,
|
||||||
|
"columns": float64(s.thumbColumns),
|
||||||
|
"rows": float64(s.thumbRows),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user