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/now-playing.rb | |
parent | a0e8ec4062cadf9f871469755758c7fd43c0f447 (diff) | |
download | weechat-e3c41c785e0385d80ec3d1262784bfba82ccc6b7.zip |
Removed wrong directory "scripts" in git root (added by mistake)
Diffstat (limited to 'scripts/ruby/now-playing.rb')
-rw-r--r-- | scripts/ruby/now-playing.rb | 66 |
1 files changed, 0 insertions, 66 deletions
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 |