Skip to content

Commit

Permalink
feat: add debug mode
Browse files Browse the repository at this point in the history
  • Loading branch information
dpolakovics committed Dec 16, 2024
1 parent 9af6619 commit 7149358
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
8 changes: 7 additions & 1 deletion internal/logic/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func getAudioFiles(folder string) ([]string, error) {
return audioFiles, nil
}

func CombineFiles(folder1 string, folder2 string, outputFolder string, progress *widget.ProgressBar, soundscapeVolume float64, statusCallback func(string)) error {
func CombineFiles(folder1 string, folder2 string, outputFolder string, progress *widget.ProgressBar, soundscapeVolume float64, debug bool, statusCallback func(string)) error {
soundscapeVolume = 0.5 + (soundscapeVolume / 100.0 * 0.5)

files1, err := getAudioFiles(folder1)
Expand Down Expand Up @@ -89,6 +89,12 @@ func CombineFiles(folder1 string, folder2 string, outputFolder string, progress
if ext == ".mp3" || ext == ".flac" {
arguments = append(arguments, getCoverArtArguments(file, files2[index])...)
}

// If debug mode is enabled, add verbose logging arguments
if debug {
arguments = append(arguments, "-loglevel", "verbose")
}

arguments = append(arguments, newFileName)

cmd := exec.CommandContext(ctx, ffmpeg, arguments...)
Expand Down
6 changes: 5 additions & 1 deletion internal/ui/windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,13 @@ func CreateMainContent(app fyne.App, window fyne.Window) fyne.CanvasObject {

statusLabel := widget.NewLabel("Idle")

// Add a checkbox for debug mode
debugCheck := widget.NewCheck("Debug Mode", func(checked bool) {})

startButton.OnTapped = func() {
startButton.Disable()
progressBar.Show()
err := logic.CombineFiles(folder1, folder2, folderOutput, progressBar, volumeSlider.Value, func(msg string) {
err := logic.CombineFiles(folder1, folder2, folderOutput, progressBar, volumeSlider.Value, debugCheck.Checked, func(msg string) {
statusLabel.SetText(msg)
})
progressBar.Hide()
Expand All @@ -202,6 +205,7 @@ func CreateMainContent(app fyne.App, window fyne.Window) fyne.CanvasObject {
"",
container.NewVBox(
statusLabel,
debugCheck,
startButton,
progressBar,
),
Expand Down

0 comments on commit 7149358

Please sign in to comment.