Skip to content

Commit

Permalink
cleanup: remove unused logs, make logs more clean
Browse files Browse the repository at this point in the history
Signed-off-by: Tomkoid <[email protected]>
  • Loading branch information
tomkoid committed Jun 2, 2024
1 parent 041be68 commit 0ab43bc
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
9 changes: 4 additions & 5 deletions internal/audio/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ func AudioMonitor(c *pulseaudio.Client, config *config.Config) {
var ms mutedSink

log.Println("Starting audio monitoring.")
log.Println(ms.Name)

// Monitor the default sink for changes
for {
Expand All @@ -58,9 +57,9 @@ func AudioMonitor(c *pulseaudio.Client, config *config.Config) {
defaultSink.CardID,
)

if ms.Name == defaultSink.CardID {
if config.Resume && ms.Name == defaultSink.CardID {
log.Println(
"Audio was muted, so unmuted it.!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!",
"Audio was muted, unmuted it.",
)

initialSinkName = defaultSink.CardID
Expand All @@ -78,8 +77,8 @@ func AudioMonitor(c *pulseaudio.Client, config *config.Config) {
ms.Name = initialSinkName
ms.Players = playingPlayers
}
log.Printf("1: %s\n", ms.Name)
log.Printf("2: %s\n", defaultSink.CardID)
// log.Printf("1: %s\n", ms.Name)
// log.Printf("2: %s\n", defaultSink.CardID)

initialSinkName = defaultSink.CardID
}
Expand Down
5 changes: 1 addition & 4 deletions internal/audio/playing.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package audio

import (
"log"
"strings"

"codeberg.org/tomkoid/audstopper/internal/tools"
Expand All @@ -18,7 +17,6 @@ func isPlaying(player string) (bool, []string) {
}

if string(output) == "Playing\n" {
println("playerctl playing!!!!!!!!!!!!!!!!!!!!!!!!!")
playing = true
players = append(players, player)
}
Expand All @@ -31,12 +29,11 @@ func isPlaying(player string) (bool, []string) {

println(string(output))
if strings.Contains(string(output), "[playing]") {
println("mpc playing!!!!!!!!!!!!!!!!!!!!!!!!!")
playing = true
players = append(players, player)
}
}

log.Printf("returned from isplaying: %v", players)
// log.Printf("returned from isplaying: %v", players)
return playing, players
}
2 changes: 0 additions & 2 deletions internal/audio/resume.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ func resumeAudio(config *config.Config, givenPlayers []string) {
log.Println("Resuming audio.")

for _, player := range listPlayers(config) {
log.Printf("available player: %s", player)
for _, givenPlayer := range givenPlayers {
log.Printf("comparison(%s, %s)", player.Name, givenPlayer)
if player.Name == givenPlayer {
log.Printf("Resuming audio for %s\n", givenPlayer)
_, err := tools.RunCommand(player.ResumeCommand[0], player.ResumeCommand[1:]...)
Expand Down
7 changes: 5 additions & 2 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ func GetConfig() Config {

configStr, err := readConfigFile(configFilePath)
if err != nil {
log.Println("using default config")
log.Println("Using default config.")
if err.Error() != "config file does not exist" {
log.Printf("config error: %s\n", err.Error())
}
return config
} else {
log.Printf("using config from %s\n", configFilePath)
log.Printf("Using config from %s.\n", configFilePath)
}

err = toml.Unmarshal([]byte(configStr), &config)
Expand Down

0 comments on commit 0ab43bc

Please sign in to comment.