| 1 | # sonata treck info for gajim status messages |
|---|
| 2 | |
|---|
| 3 | def 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}"` |
|---|
| 7 | end |
|---|
| 8 | |
|---|
| 9 | def open_stat_file |
|---|
| 10 | return File.open('/tmp/xmms-info').readlines |
|---|
| 11 | end |
|---|
| 12 | |
|---|
| 13 | file_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 | |
|---|