Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # ==============================================================================
- # amarok.rb (c) July 2006 by Michael 'manveru' Fellinger <manveru@weez-int.com>
- #
- # Licence: GPL v2
- # Description: Display what Amarok is playing right now in the current channel
- # Syntax: /np
- #
- # ==============================================================================
- def weechat_init
- Weechat.register("amarok", "0.1", "", "display what Amarok is playing right now in the current channel (/np)")
- Weechat.add_command_handler("np", "amarok")
- return Weechat::PLUGIN_RC_OK
- end
- def amarok(server, args)
- # this maps directly to dcop-calls
- # options:
- # %album %artist %bitrate %comment %coverImage %currentTime %encodedURL
- # %engine %genre %lyrics %nowPlaying %path %title %totalTime %track %type %year
- # %% => %
- user = `whoami`.chomp
- unless `dcop --user #{user} amarok`.chomp == "ERROR: Couldn't attach to DCOP server!"
- format = %(%artist (%album) - %title [%totalTime])
- format.gsub!(/%([A-Za-z]+)/){|e| `dcop --user #{user} amarok player #{$1}`.chomp}
- format.gsub!('%%', '%')
- Weechat.command(format)
- end
- return Weechat::PLUGIN_RC_OK
- end
Add Comment
Please, Sign In to add comment