All pastes #568470 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-06-15 15:30 UTC
rendered paste body
#!/usr/bin/env ruby
#

def dcop (val)
	str =`dcop amarok player #{val}`
	str.chomp! if str != nil
	return str
end

loop do
    message = gets().chomp() #Read message from stdin
    command = /[A-Za-z]*/.match( message ).to_s()

    case command
        when "configure"
            msg  = '"This script does not have configuration options."'
            `dcop amarok playlist popupMessage "#{msg}"`

        
        when "trackChange"
			info_keys = ['title', 'artist', 'album']
			informations = Hash.new
			info_keys.each do |info_key|
				informations[info_key] = dcop(info_key)
			end

			msg  = '"trackChange."'
            				`dcop amarok playlist popupMessage "#{informations}"`    
    end
end