# Copyright (c) 2015 by nashgul # < nashgul > < chat.freenode.net : #debian-es-offtopic > # # Inspired in: Copyright (c) 2006 by DeltaS4 # # I only make some changes over the original by DeltaS4: # # 1. I give color to the output # 2. I give support for streaming # 3. If the length of the song is 0:00, don't show it # 4. I show additional info (get with audtool like the original script) # # 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. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # weechat::register ("audacious2", "nashgul", "0.1", "GPL", "audacious-weechat current song script (usage: /audacious)", "", ""); weechat::hook_command("audacious", "", "", "", "", "audtool", ""); # white => "00", black => "01", darkblue => "02", darkgreen => "03", lightred => "04", # darkred => "05", magenta => "06", orange => "07", yellow => "08", lightgreen => "09", # cyan => "10", lightcyan => "11", lightblue => "12", lightmagenta => "13", gray => "14", # lightgray => "15" sub audtool { my ($data, $buffer, $args) = @_; chomp(my ($cs, $cslen, $posicion, $calidad, $fichero) = (`audtool --current-song`, `audtool --current-song-length`,`audtool --current-song-output-length`, `audtool --current-song-bitrate-kbps`, `audtool --current-song-filename`)); $cero = '0:00'; if ($cslen == $cero) { $estado = "\cC15[\cC \cC04$posicion\cC \cC07@\cC \cC04$calidad kbps\cC \cC15]\cC"; } else { $estado = "\cC15[\cC \cC04$posicion\cC \cC15-\cC \cC04$cslen\cC \cC07@\cC \cC04$calidad kbps\cC \cC15]\cC"; } if ($fichero =~ /^http/) { $fuente = "$fichero"; } else { $fuente = ""; } my $text_output = "\cB\cC05está reproduciendo\cC\cB\cC15:\cC \cB\cC07$fuente\cC\cB \cC05♬ \cC \cB\cC02$cs\cC\cB $estado \cC05♬ \cC"; weechat::command($buffer, "/me $text_output"); return weechat::WEECHAT_RC_OK; }