From ebf8334929faf6092d764d80abe9c2147f3a3a27 Mon Sep 17 00:00:00 2001 From: Nyx Tutt Date: Fri, 7 Mar 2025 23:05:49 -0600 Subject: [PATCH] Meep? --- np.pl | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/np.pl b/np.pl index 313493f..8883cb1 100644 --- a/np.pl +++ b/np.pl @@ -26,8 +26,8 @@ Define colors for messages: Define format for now playing: /set plugins.var.perl.np.format - \%title\%, \%artist\%, \%album\%, \%date\% in addition to text - Default: \"\%title\% by \%artist\% from \%album\% (\%date\%)\" + \%title\%, \%artist\%, \%album\% in addition to text + Default: \"\%title\% by \%artist\% from \%album\%\" ", '', 'start', ''); @@ -39,17 +39,16 @@ sub start { my $output = "/me is now playing: "; my %data = ( - "title" => `mpc -f %title% | head -n 1`, - "artist" =>`mpc -f %artist% | head -n 1`, - "album" => `mpc -f %album% | head -n 1`, - "date" => `mpc -f %date% | head -n 1` + "title" => `playerctl metadata title`, + "artist" =>`playerctl metadata artist`, + "album" => `playerctl metadata album`, ); chomp %data; %data = addColor(\%data) unless weechat::config_get_plugin("use_color") eq "off"; # Todo: Add ability to change foramt - $output .= $data{"title"}." by ".$data{"artist"}." from ".$data{"album"}." (".$data{"date"}.")"; + $output .= $data{"title"}." by ".$data{"artist"}." from ".$data{"album"}.""; weechat::command(weechat::current_buffer, $output) } @@ -65,19 +64,16 @@ sub addColor { weechat::config_set_plugin("color.title", "lightmagenta") if weechat::config_get_plugin("color.title") eq ""; weechat::config_set_plugin("color.artist", "lightblue") if weechat::config_get_plugin("color.artist") eq ""; weechat::config_set_plugin("color.album", "lightgreen") if weechat::config_get_plugin("color.album") eq ""; - weechat::config_set_plugin("color.date", "yellow") if weechat::config_get_plugin("color.date") eq ""; # Convert to raw color codes my $color_title = "\cC" . $color_table{(weechat::config_get_plugin("color.title"))}; my $color_artist = "\cC" . $color_table{(weechat::config_get_plugin("color.artist"))}; my $color_album = "\cC" . $color_table{(weechat::config_get_plugin("color.album"))}; - my $color_date = "\cC" . $color_table{(weechat::config_get_plugin("color.date"))}; my $reset_color = "\cC00"; return ( "title" => $color_title.$_[0]{"title"}.$reset_color, "artist" => $color_artist.$_[0]{"artist"}.$reset_color, - "album" => $color_album.$_[0]{"album"}.$reset_color, - "date" => $color_date.$_[0]{"date"}.$reset_color + "album" => $color_album.$_[0]{"album"}.$reset_color ) }