Skip to content

Commit

Permalink
[fix] config の output_base_dir が適用されるように修正
Browse files Browse the repository at this point in the history
  • Loading branch information
shinosaki committed Feb 15, 2025
1 parent 32b3d38 commit fa750c3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions cli/alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
}
}
}
Expand Down
10 changes: 8 additions & 2 deletions internal/alert/alert.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,21 @@ 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"
)

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
Expand All @@ -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"),
Expand Down

0 comments on commit fa750c3

Please sign in to comment.