From: Mark Wooding Date: Mon, 22 Jun 2020 14:52:02 +0000 (+0100) Subject: bin/disorder-notify (watch_and_notify0): Track state while logging. X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/73d8ef9e1bbc84f8ed32a8a43906aaeefc6d7215 bin/disorder-notify (watch_and_notify0): Track state while logging. --- diff --git a/bin/disorder-notify b/bin/disorder-notify index f5b6468..95ed576 100755 --- a/bin/disorder-notify +++ b/bin/disorder-notify @@ -214,12 +214,18 @@ sub watch_and_notify0 ($) { my @f = split_fields $line; if ($f[1] eq "state") { my $msg = undef; - if ($f[2] eq "disable_random") { $msg = "Random play disabled"; } - elsif ($f[2] eq "enable_random") { $msg = "Random play enabled"; } - elsif ($f[2] eq "disable_play") { $msg = "Playing disabled"; } - elsif ($f[2] eq "enable_play") { $msg = "Playing enabled"; } - elsif ($f[2] eq "pause") { $msg = "Paused"; } - elsif ($f[2] eq "resume") { $msg = "Playing"; } + if ($f[2] eq "disable_random") + { $st->{random} = 0; $msg = "Random play disabled"; } + elsif ($f[2] eq "enable_random") + { $st->{random} = 1; $msg = "Random play enabled"; } + elsif ($f[2] eq "disable_play") + { $st->{play} = 0; $msg = "Playing disabled"; } + elsif ($f[2] eq "enable_play") + { $st->{play} = 1; $msg = "Playing enabled"; } + elsif ($f[2] eq "pause") + { $st->{pause} = 1; $msg = "Paused"; } + elsif ($f[2] eq "resume") + { $st->{pause} = 0; $msg = "Playing"; } notify "$TITLE state", $msg if defined $msg; } elsif ($f[1] eq "playing") { my %info;