Guest User

Untitled

a guest
Dec 26th, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.55 KB | None | 0 0
  1. rbot_remote = '~/bin/rbot-remote'
  2. rbot_user = 'owner'
  3. rbot_password = 'PASSWORD'
  4. channel = '#CHANNEL'
  5.  
  6. event = ARGV.first
  7. if event == 'songstart'
  8.   d = {}
  9.  
  10.   STDIN.each_line { |line| d.store(*line.chomp.split('=', 2)) }
  11.   if (d['rating'] == '1') do
  12.     if (d['loved'].to_i >3) do
  13.       d['loved'] = 3
  14.     end
  15.   end
  16.  
  17.   IO.popen("#{rbot_remote} -u #{rbot_user} -p #{rbot_password} -d '#{channel}'",
  18.     'w') do |p|
  19.     p.write("Now playing: \"#{d['title']}\" by \"#{d['artist']}\" on \"#{d['album']}\" loved \"#{d['loved']}\")
  20.  end
  21.  
  22. end
Add Comment
Please, Sign In to add comment