GajimAndMpd: status.rb

File status.rb, 0.6 kB (added by xander.blr@…, 3 months ago)

only sonata treck info for gajim status messages. Ruby edition

Line 
1# sonata treck info for gajim status messages
2
3def reset_status_messages(name_status)
4  status_part1 = `gajim-remote get_status`.chomp
5  status_part2 = name_status
6 `gajim-remote change_status "#{status_part1}" "Playing: #{status_part2}"` 
7end
8
9def open_stat_file
10  return File.open('/tmp/xmms-info').readlines
11end
12
13file_old = open_stat_file
14 while system('sleep 1')
15 file = open_stat_file
16   if file == file_old
17    else 
18      if file[0].scan(/(Stopped|Paused)/).size == 1 
19        reset_status_messages('none')
20      else 
21        title = file[1].split(':')
22        reset_status_messages(title[1].chomp)
23   end     
24 end
25 end
26
27