scripts

misc scripts and tools
git clone git://git.2f30.org/scripts
Log | Files | Refs

commit 5f9d6efac6ab6d45a7968d0189bd61369611b8fe
parent 90ade81e44002b2ececf3f183640526079d0561c
Author: cipher <haris@2f30.org>
Date:   Sat,  7 Dec 2013 13:58:54 +0200

moving weechat scripts to specific dir

Diffstat:
Dcmus.pl | 17-----------------
Dpastie.pl | 44--------------------------------------------
Dshorturl.pl | 17-----------------
3 files changed, 0 insertions(+), 78 deletions(-)

diff --git a/cmus.pl b/cmus.pl @@ -1,17 +0,0 @@ -# weechat plugin to display current playing cmus track -use strict; - -weechat::register("cmus", "cipher <haris\@2f30.org", "0.1", "Public Domain", - "displays cmus artist - song", "", ""); -weechat::hook_command("cmus", "Script to display what cmus is currently playing. Just /cmus and enjoy.", "", "", "", "cmus", ""); - -sub cmus { - my ($data, $buffer, $args) = @_; - my $artistfull = qx(cmus-remote -Q | grep [[:space:]]artist[[:space:]]); - chomp (my $artist = substr($artistfull,10)); - my $songfull = qx(cmus-remote -Q | grep [[:space:]]title[[:space:]]); - chomp (my $song = substr($songfull,10)); - - weechat::command($buffer, "/me cmus playing: $artist - $song"); - return weechat::WEECHAT_RC_OK; -} diff --git a/pastie.pl b/pastie.pl @@ -1,44 +0,0 @@ -use strict; - -my $SCRIPT_NAME = "pastie"; - -weechat::register("pastie", "cipher <haris\@2f30.org>", "0.1", "Public Domain", "Paste output", "", ""); -weechat::hook_command("pastie", "Just select your text with the cursor, and \"/pastie\" in your window. -By default, it uses \"xclip -o\" to output X selection. - -If you want another application for output, you can set it for example with: - - /set plugins.var.perl.pastie.ext_command \"xsel -o\" - -Replace \"xsel -o\" with your program of choice. -----------------------------------------------", "", "", "", "pastie", ""); - -my $pastie_command; - -init_config(); - -sub init_config { - my %options = ( - "ext_command" => "xclip -o", - ); - foreach my $option (keys %options) { - weechat::config_set_plugin($option, $options{$option}) unless weechat::config_is_set_plugin($option); - } -} - -sub pastie { - my ($data, $command, $return_code, $out, $err) = @_; - my $buffer = $data; - $pastie_command = weechat::config_get_plugin("ext_command"); - my @output = `$pastie_command`; - - weechat::command($buffer, ",--<--"); - - foreach my $output (@output) { - $output =~ s/(.*?)\t/ /g; - weechat::command($buffer, "| $output"); - } - - weechat::command($buffer, "`-->--"); - return weechat::WEECHAT_RC_OK; -} diff --git a/shorturl.pl b/shorturl.pl @@ -1,17 +0,0 @@ -# weechat script for url shorting -# Needed: WWW::Shorten::TinyURL -use strict; -use WWW::Shorten::TinyURL; -use Clipboard; - -weechat::register("shorten", "cipher <haris\@2f30.org", "0.1", "Public Domain", - "Short url", "", ""); -weechat::hook_command("shorten", "Press \"/shorten\" to output on the channel/buffer the url from clipboard in shortened form", "", "", "", "shorten", ""); - -sub shorten { - my $external = Clipboard->paste; - my ($data, $buffer, $args) = @_; - my $short_url = makeashorterlink($external); - weechat::command($buffer, "url: $short_url"); - return weechat::WEECHAT_RC_OK; -}