From fa750c3405ee4f498db4240ebd09b111586e0dca Mon Sep 17 00:00:00 2001 From: shinosaki Date: Sat, 15 Feb 2025 11:45:12 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20config=20=E3=81=AE=20output=5Fbase=5Fdi?= =?UTF-8?q?r=20=E3=81=8C=E9=81=A9=E7=94=A8=E3=81=95=E3=82=8C=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cli/alert.go | 4 ++-- internal/alert/alert.go | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cli/alert.go b/cli/alert.go index 05320c9..ce683b5 100644 --- a/cli/alert.go +++ b/cli/alert.go @@ -34,7 +34,7 @@ func Alert() *cobra.Command { if programs, err := alert.FetchRecentPrograms(true, client); err != nil { return err } else { - alert.Alert(sc, programs, config.Following.Users["nico"], config.Paths.FFmpeg) + alert.Alert(sc, programs, config) } // Check programs loop @@ -51,7 +51,7 @@ func Alert() *cobra.Command { if programs, err := alert.FetchRecentPrograms(false, client); err != nil { return err } else { - alert.Alert(sc, programs, config.Following.Users["nico"], config.Paths.FFmpeg) + alert.Alert(sc, programs, config) } } } diff --git a/internal/alert/alert.go b/internal/alert/alert.go index 41dedfd..21d7bad 100644 --- a/internal/alert/alert.go +++ b/internal/alert/alert.go @@ -9,6 +9,7 @@ import ( "time" "github.com/shinosaki/namagent/internal/alert/types" + "github.com/shinosaki/namagent/internal/config" "github.com/shinosaki/namagent/internal/recorder" "github.com/shinosaki/namagent/utils" ) @@ -16,9 +17,13 @@ import ( func Alert( sc *utils.SignalContext, programs []types.RecentProgram, - followingUsers []string, - ffmpegPath string, + config config.Config, ) { + var ( + ffmpegPath = config.Paths.FFmpeg + followingUsers = config.Following.Users["nico"] + ) + for _, program := range programs { if slices.Contains(followingUsers, program.ProgramProvider.Id) { // show information @@ -41,6 +46,7 @@ func Alert( outputPath, err := filepath.Abs( filepath.Join( + config.Paths.OutputBaseDir, program.ProgramProvider.Id, fmt.Sprintf("%s-%s-%s-%s.%s", time.Now().Format("20060102"),