File: cmus.pl

package info (click to toggle)
weechat-scripts 20100422-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,184 kB
  • ctags: 1,634
  • sloc: python: 8,545; perl: 8,472; ruby: 147; tcl: 137; sh: 8; makefile: 2
file content (22 lines) | stat: -rw-r--r-- 644 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Written by Sid Vicious (Trashlord) <dornenreich666@gmail.com>
# Released under GPL3

use warnings;
use strict;
use diagnostics;

weechat::register("Cmus", "Sid", "0.1", "GPL3", "Cmus status display", "", "");
weechat::hook_command("cmus", "", "", "", "", "cmd_cmus", "");

sub cmd_cmus {
	#We'll fix the god damn vim syntax highlighting problem later
	open CMUS, '<', '/tmp/cmus-status' or return weechat::WEECHAT_RC_ERROR;
	my $line = <CMUS>;
	close CMUS;
	my $buffer = weechat::current_buffer;
	if ($line && $buffer) { 
		weechat::command($buffer, "$line");
		return weechat::WEECHAT_RC_OK;
	}
	else { return weechat::WEECHAT_RC_ERROR; }
}