]> git.99rst.org Git - irssi-scripts.irssi.org.git/commitdiff
[lastfm] v5.9
authorsimmel <>
Wed, 29 Feb 2012 18:22:38 +0000 (19:22 +0100)
committerbw1 <redacted>
Sun, 31 Jan 2021 20:14:22 +0000 (21:14 +0100)
scripts/lastfm.pl

index 77ec944eedb43b3061c2e27a41d7d7218cc3efd3..34378ce017e5bc956589905b037528284ee59e46 100644 (file)
@@ -1,12 +1,11 @@
 # vim: set expandtab:
-use strict;
 use vars qw($VERSION %IRSSI);
-$VERSION = "5.8";
+$VERSION = "5.9";
 %IRSSI = (
         authors     => "Simon 'simmel' Lundström",
         contact     => 'simmel@(freenode|quakenet|efnet) http://last.fm/user/darksoy',
         name        => "lastfm",
-        date        => "20110125",
+        date        => "20120229",
         description => 'A now-playing-script which uses Last.fm',
         license     => "BSD",
         url         => "http://soy.se/code/",
@@ -63,6 +62,11 @@ Irssi::settings_add_bool("lastfm", "lastfm_get_player", 0);
 
 # Changelog#{{{
 
+# 5.9 -- Wed Feb 29 13:13:01 CET 2012
+# * "Fix" problem with /np returning "%( is )np: Rejects-Vision Smashed" when
+# no album was available. This is a "fix", the real fix is to use a real parser
+# and not regex. If you want to help with this, please contact me.
+
 # 5.8 -- Tue Jan 25 16:11:29 CET 2011
 # * Ignore a closure warning
 
@@ -232,6 +236,7 @@ Irssi::settings_add_bool("lastfm", "lastfm_get_player", 0);
 # }}}
 
 # TODO
+# Displaying track length via track.getinfo requested by rissy@QuakeNet
 # You tell me!
 
 # Move along now, there's nothing here to see.
@@ -241,6 +246,7 @@ sub DEBUG {
   Irssi::settings_get_bool("lastfm_debug");
 };
 
+use strict;
 use warnings;
 no warnings 'closure';
 use Data::Dumper;
@@ -321,7 +327,12 @@ sub lastfm_nowplaying {
 
   print Dumper \%data if DEBUG;
   print Dumper "Output pattern before: $nowplaying" if DEBUG;
-  $nowplaying =~ s/(%\((.*?%(\w+).?)\))/($data{$3} ? $2 : "")/ge;
+  if ($data{'album'}) {
+    $nowplaying =~ s/(%\((.*?%(\w+).*?)\))/($data{$3} ? $2 : "")/ge;
+  }
+  else {
+    $nowplaying =~ s/(%\((.*?%(\w+).?)\))/($data{$3} ? $2 : "")/ge;
+  }
   print Dumper "Output pattern after: $nowplaying" if DEBUG;
   $nowplaying =~ s/%$fields/$data{$1}/ge;
   decode_entities($nowplaying);
git clone https://git.99rst.org/PROJECT