diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2007-09-06 17:55:48 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2007-09-06 17:55:48 +0200 |
commit | e3c41c785e0385d80ec3d1262784bfba82ccc6b7 (patch) | |
tree | 1b21557caef16cfbb46bedf501921e265567d34a /scripts/ruby | |
parent | a0e8ec4062cadf9f871469755758c7fd43c0f447 (diff) | |
download | weechat-e3c41c785e0385d80ec3d1262784bfba82ccc6b7.zip |
Removed wrong directory "scripts" in git root (added by mistake)
Diffstat (limited to 'scripts/ruby')
-rw-r--r-- | scripts/ruby/browse.rb | 127 | ||||
-rw-r--r-- | scripts/ruby/forcenick.rb | 35 | ||||
-rw-r--r-- | scripts/ruby/myuptime.rb | 20 | ||||
-rw-r--r-- | scripts/ruby/now-playing.rb | 66 | ||||
-rw-r--r-- | scripts/ruby/rbox.rb | 84 |
5 files changed, 0 insertions, 332 deletions
diff --git a/scripts/ruby/browse.rb b/scripts/ruby/browse.rb deleted file mode 100644 index 9ab9e0e51..000000000 --- a/scripts/ruby/browse.rb +++ /dev/null @@ -1,127 +0,0 @@ -# Copyright (c) 2007 by Javier Valencia <jvalencia@log01.org> -# -# 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 -# - -def weechat_init - Weechat.register("browse", "0.1", "", "Fast url browsing for Weechat.") - - Weechat.add_command_handler( - "browse", - "do_browse", - "Use your preferred browser to navigate an url.", - "[number of url] (-1 to browse all) (leave empty to browse first one)") - Weechat.add_command_handler( - "webbrowser", - "set_browser", - "Get/Set browser command", - "[command] (leavy empty to get current command)") - Weechat.add_command_handler( - "urls", - "get_url_list", - "Get a list of urls in a channel.") - - Weechat.print("") - Weechat.print("See help for 'browse', 'webbrowser' and 'urls' commands.") - if Weechat.get_plugin_config("webbrowser").empty? - Weechat.print("") - Weechat.print("WARNING: you must define a web browser with the command /webbrowser.") - end - return Weechat::PLUGIN_RC_OK -end - -def set_browser(server, args) - if args.empty? - Weechat.print("current web browser -> #{Weechat.get_plugin_config('webbrowser')}") - else - Weechat.set_plugin_config("webbrowser", args) - Weechat.print("web browser set to -> #{args}") - end - return Weechat::PLUGIN_RC_OK -end - -def get_url_array(buffer_data) - urls = Array.new - buffer_data.each do |line| - line["data"].split.each do |word| - if word =~ /^http\:\/\/.*/ - urls << word - end - end - end - return urls.uniq.reverse -end - -def get_url_list(server,args) - channel = Weechat.get_info("channel") - if channel.empty? - Weechat.print("You must be inside a channel.") - return Weechat::PLUGIN_RC_KO - end - buffer = Weechat.get_buffer_data(server, channel) - unless buffer - Weechat.print("Error retrieving window buffer, may be a bug?.") - return Weechat::PLUGIN_RC_KO - end - Weechat.print("") - Weechat.print("URL listing:") - pos = 0 - get_url_array(buffer).each do |url| - Weechat.print("#{pos}) #{url}") - pos += 1 - end - return Weechat::PLUGIN_RC_OK -end - -def do_browse(server, args) - num = args.to_i - channel = Weechat.get_info("channel") - if channel.empty? - Weechat.print("You must be inside a channel.") - return Weechat::PLUGIN_RC_KO - end - buffer = Weechat.get_buffer_data(server, channel) - unless buffer - Weechat.print("Error retrieving window buffer, may be a bug?.") - return Weechat::PLUGIN_RC_KO - end - browser = Weechat.get_plugin_config("webbrowser") - if browser.empty? - Weechat.print("") - Weechat.print("WARNING: you must define a web browser with the command /webbrowser.") - return Weechat::PLUGIN_RC_KO - end - urls = get_url_array(buffer) - if urls.empty? - Weechat.print("No urls in current channel.") - else - if num == -1 - Weechat.print("Starting browser...") - fork do # only for unix/posix - exec("#{browser} #{urls.join(' ')} &> /dev/null") - end - else - if urls[num] - Weechat.print("Starting browser...") - fork do # only for unix/posix - exec("#{browser} #{urls[num]} &> /dev/null") - end - else - Weechat.print("Invalid url number.") - end - end - end - return Weechat::PLUGIN_RC_OK -end diff --git a/scripts/ruby/forcenick.rb b/scripts/ruby/forcenick.rb deleted file mode 100644 index 3d2120e74..000000000 --- a/scripts/ruby/forcenick.rb +++ /dev/null @@ -1,35 +0,0 @@ -# Forcenick v1.0 - forces your original nickname -# Copyright (C) 2007 Pavel Shevchuk <stlwrt@gmail.com> - -# 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 - -def weechat_init - Weechat.register("forcenick", "1.0", "", "Forces your original nickname, wipes out ghosts and nick stealers") - Weechat.add_command_handler("forcenick", "forcenick", "Forces server_nick1, identifies to nickserv using server_password. Useful to call from server_command if your connection is unstable") -end - -def forcenick(server, args) - server_info = Weechat.get_server_info[server] - cur_nick = server_info['nick'] - forced_nick = server_info['nick1'] - password = server_info['password'] - if cur_nick != forced_nick - Weechat.command("/msg nickserv ghost #{forced_nick} #{password}", "", server) - Weechat.command("/nick #{forced_nick}", "", server) - Weechat.command("/msg nickserv identify #{password}", "", server) - end - return Weechat::PLUGIN_RC_OK -end - diff --git a/scripts/ruby/myuptime.rb b/scripts/ruby/myuptime.rb deleted file mode 100644 index 2aa6fcb6b..000000000 --- a/scripts/ruby/myuptime.rb +++ /dev/null @@ -1,20 +0,0 @@ -# ================================================================================================== -# myuptime.rb (c) April 2006 by David DEMONCHY (fusco) <fusco.spv@gmail.com> -# -# Licence : GPL v2 -# Description : Print machine uptime in the current canal -# Syntax : /myuptime -# => <nick> uptime <hostname> : 00:16:58 up 11:09, 4 users, load average: 0.05, 0.21, 0.29 -# -# ================================================================================================== - -def weechat_init - Weechat.register("myuptime", "0.1", "", "Script ruby WeeChat for display my uptime") - Weechat.add_command_handler("myuptime", "myuptime") - return Weechat::PLUGIN_RC_OK -end - -def myuptime(server, args) -Weechat.command("/me uptime "+ `hostname`.chomp + ":" + `uptime`.chomp) -return Weechat::PLUGIN_RC_OK -end diff --git a/scripts/ruby/now-playing.rb b/scripts/ruby/now-playing.rb deleted file mode 100644 index 0472226f5..000000000 --- a/scripts/ruby/now-playing.rb +++ /dev/null @@ -1,66 +0,0 @@ -# ============================================================================= -# wee-now-playing.rb (c) March 2006 by Tassilo Horn <heimdall@uni-koblenz.de> -# -# Licence : GPL v2 -# Description : Print what amaroK or moc is playing -# Syntax : /np -# => <nick> is listening to <Artist> - <Title> -# Precond : needs Ruby (1.8) and amaroK or moc (Music on Console) -# -# ============================================================================= - -def get_np_info - artist = title = "" - catch( :info_available ) do - # AMAROK - # ====== - # The dcopfind returns the string "DCOPRef(amarok,)" if amaroK is - # running, "" otherwise. So if the string is longer than 0 we can get - # the track. - if `dcopfind amarok`.length > 0 - artist = `dcop amarok player artist`.chomp - title = `dcop amarok player title`.chomp - throw( :info_available ) - end - - # MOCP - # ==== - # Amarok was not running, so check if mocp plays something! - if !`ps -e | grep mocp`.empty? - info_string = `mocp -i` - if !(info_string =~ /^State: STOP/) - info_string.grep(/^Artist:|^SongTitle:/) do |line| - if line =~ /^Artist:/ - artist = line.gsub!(/^Artist:/, '').strip! - else - title = line.gsub!(/^SongTitle:/, '').strip! - end - end - throw( :info_available ) - end - end - end - if !artist.empty? && !title.empty? - "#{artist} - #{title}" - else - "" - end -end - -def bye(server='', args='') - return Weechat::PLUGIN_RC_OK -end - -def print_now_playing(server='', args='') - np_string = get_np_info - if np_string.empty? - np_string = "nothing" - end - Weechat.command( "/me listenes to " + np_string + "." ) -end - -def weechat_init - Weechat.register("wee-now-playing", "0.1", "bye", "print now-playing infos") - Weechat.add_command_handler("np", "print_now_playing") - return Weechat::PLUGIN_RC_OK -end diff --git a/scripts/ruby/rbox.rb b/scripts/ruby/rbox.rb deleted file mode 100644 index 0adabb2a0..000000000 --- a/scripts/ruby/rbox.rb +++ /dev/null @@ -1,84 +0,0 @@ -# Rbox plugin (Rhythmnox control and now playing plugin.) -# Version 0.2 -# Released under GNU GPL v2 -# Metallines <metallines@gmail.com> -# /rbox-help for help - -def weechat_init - Weechat.register("rbox", "0.2", "", "Rhythmbox control and now playing plugin.") - Weechat.add_command_handler("rbox-print", "rbox_print") - Weechat.add_command_handler("rbox-play", "rbox_play") - Weechat.add_command_handler("rbox-pause", "rbox_pause") - Weechat.add_command_handler("rbox-previous", "rbox_previous") - Weechat.add_command_handler("rbox-next", "rbox_next") - Weechat.add_command_handler("rbox-help", "rbox_help") - return Weechat::PLUGIN_RC_OK -end - -def rbox_print(server, args) - if `ps -C rhythmbox` =~ /rhythmbox/ - artiste = `rhythmbox-client --print-playing-format %ta`.chomp - titre = `rhythmbox-client --print-playing-format %tt`.chomp - album = `rhythmbox-client --print-playing-format %at`.chomp - - couleur_artiste = "C05" - couleur_titre = "C10" - couleur_album = "C03" - couleur_entre = "C14" - - Weechat.command("/me écoute" + " %" + couleur_titre + titre + " %" + couleur_entre + "par" + " %" + couleur_artiste + artiste + " %" + couleur_entre + "de l'album" + " %" + couleur_album + album) - else - Weechat.print("Rhythmbox isn't running.") - end - return Weechat::PLUGIN_RC_OK -end - -def rbox_play(server, args) - if `ps -C rhythmbox` =~ /rhythmbox/ - `rhythmbox-client --play` - Weechat.print("Start playback.") - else - Weechat.print("Rhythmbox isn't running.") - end - return Weechat::PLUGIN_RC_OK -end - -def rbox_pause(server, args) - if `ps -C rhythmbox` =~ /rhythmbox/ - `rhythmbox-client --pause` - Weechat.print("Pause playback.") - else - Weechat.print("Rhythmbox isn't running.") - end - return Weechat::PLUGIN_RC_OK -end - -def rbox_previous(server, args) - if `ps -C rhythmbox` =~ /rhythmbox/ - `rhythmbox-client --previous` - Weechat.print("Skip to the previous track.") - else - Weechat.print("Rhythmbox isn't running.") - end - return Weechat::PLUGIN_RC_OK -end - -def rbox_next(server, args) - if `ps -C rhythmbox` =~ /rhythmbox/ - `rhythmbox-client --next` - Weechat.print("Skip to the next track.") - else - Weechat.print("Rhythmbox isn't running.") - end - return Weechat::PLUGIN_RC_OK -end - -def rbox_help(server, args) - Weechat.print("/rbox-play -> Start playback") - Weechat.print("/rbox-pause -> Pause playback") - Weechat.print("/rbox-previous -> Skip to previous track") - Weechat.print("/rbox-next -> Skip to next track") - Weechat.print("/rbox-print -> Print which song rhythmbox is playing in current channel") - Weechat.print("/robix-help -> Display this help") - return Weechat::PLUGIN_RC_OK -end |