From 03929dac2a29664878d2c971648a4fe1fb698462 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 22:19:02 +0200 Subject: Adding upstream version 20231031. Signed-off-by: Daniel Baumann --- scripts/ixmmsa.pl | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 scripts/ixmmsa.pl (limited to 'scripts/ixmmsa.pl') diff --git a/scripts/ixmmsa.pl b/scripts/ixmmsa.pl new file mode 100644 index 0000000..7d4e8ec --- /dev/null +++ b/scripts/ixmmsa.pl @@ -0,0 +1,63 @@ +#!/usr/bin/perl + +# ixmmsa.pl (iXMMSa - irssi XMMS announce), Version 0.3 +# +# Copyleft (>) 2002 Kristof Korwisi +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# The complete text of the GNU General Public License can be found +# on the World Wide Web: + +use Xmms(); +use Xmms::Remote (); +use strict; +use Irssi; +use vars qw($VERSION %IRSSI); + +$VERSION = "0.2+1"; +%IRSSI = ( + authors => 'Kristof Korwisi', + contact => 'kk@manoli.im-dachgeschoss.de', + name => 'iXMMSa', + description => '/xmms announces which _file_ is currently playing. E.g. Currently playing: "Kieran Halpin & Band - Mirror Town.mp3"', + license => 'GPL', + url => 'http://manoli.im-dachgeschoss.de/~kk/', + changed => '2006-10-27', + changes => 'added some comments, added $announce_message:_*-stuff', +); + +Irssi::print("*****\n* $IRSSI{name} $VERSION loaded.\n* Type /xmms to announce currently played file.\n*****"); + +sub cmd_xmms { + + my ($data, $server, $witem) = @_; + my $xmms_remote = Xmms::Remote->new; + + my $announce_message_front = "Currently playing:"; # announce message in front of the filename playing + my $announce_message_after = ""; # announce message after the filename playing + + + $filename= $xmms_remote->get_playlist_file($xmms_remote->get_playlist_pos); + + + $filename =~ s/.*\///g; # removes path + $filename =~ s/^$/Nothing's playing/; # in case there's nothing to listen to ;-) + $filename =~ s/[\r\n]/ /g; # remove newline characters + + if ($witem && ($witem->{type} eq "CHANNEL" || $witem->{type} eq "QUERY")) { + $witem->command("MSG ".$witem->{name}." $announce_message_front \"$filename\" $announce_message_after"); + } else { + Irssi::print("Not on active channel/query"); + } +} + +Irssi::command_bind('xmms', 'cmd_xmms'); -- cgit v1.2.3