scripts

misc scripts and tools
git clone git://git.2f30.org/scripts.git
Log | Files | Refs

cmus.pl (719B)


      1 # weechat plugin to display current playing cmus track
      2 use strict;
      3 
      4 weechat::register("cmus", "cipher <haris\@2f30.org", "0.1", "Public Domain",
      5                   "displays cmus artist - song", "", "");
      6 weechat::hook_command("cmus", "Script to display what cmus is currently playing. Just /cmus and enjoy.", "", "", "", "cmus", "");
      7 
      8 sub cmus {
      9   my ($data, $buffer, $args) = @_;
     10   my $artistfull = qx(cmus-remote -Q | grep [[:space:]]artist[[:space:]]);
     11   chomp (my $artist = substr($artistfull,10));
     12   my $songfull = qx(cmus-remote -Q | grep [[:space:]]title[[:space:]]);
     13   chomp (my $song = substr($songfull,10));
     14 
     15   weechat::command($buffer, "/me cmus playing: $artist - $song");
     16   return weechat::WEECHAT_RC_OK;
     17 }