chiark / gitweb /
bin/disorder-notify: Refactor the state reporting machinery.
[profile] / bin / disorder-notify
index d36db9a1d57c4f70394fd3dc872e0a946f05fffa..757e12f91de75e5dc43cb7f17bf9177459c8034f 100755 (executable)
@@ -73,18 +73,15 @@ for (;;) {
     my $what = $f[1];
     if ($what eq "state") {
       my $st = $f[2];
-      if ($st eq "disable_random") {
-       notify "DisOrder state", "Random play disabled";
-      } elsif ($st eq "enable_random") {
-       notify "DisOrder state", "Random play enabled";
-      } elsif ($st eq "disable_play") {
-       notify "DisOrder state", "Playing disabled";
-      } elsif ($st eq "enable_play") {
-       notify "DisOrder state", "Playing enabled";
-      } elsif ($st eq "pause") {
-       notify "DisOrder state", "Paused";
-      } elsif ($st eq "resume") {
-       notify "DisOrder state", "Resuming";
+      my $msg;
+      if ($st eq "disable_random") { $msg = "random play disabled"; }
+      elsif ($st eq "enable_random") { $msg = "random play enabled"; }
+      elsif ($st eq "disable_play") { $msg = "playing disabled"; }
+      elsif ($st eq "enable_play") { $msg = "playing enabled"; }
+      elsif ($st eq "pause") { $msg = "paused"; }
+      elsif ($st eq "resume") { $msg = "playing"; }
+      else { next LINE; }
+      notify "DisOrder state", ucfirst $msg;
       }
     } elsif ($what eq "playing") {
       now_playing $f[2];