Skip to content

Instantly share code, notes, and snippets.

@zachpendleton
Created June 29, 2012 15:37
Show Gist options
  • Select an option

  • Save zachpendleton/3018666 to your computer and use it in GitHub Desktop.

Select an option

Save zachpendleton/3018666 to your computer and use it in GitHub Desktop.
Save and format the current Pianobar song for display in tmux.
#!/usr/bin/env ruby
# coding: utf-8
event = ARGV[0]
if event == 'songstart'
d = Hash.new
STDIN.each_line { |line| d.store(*line.chomp.split('=', 2)) }
File.open('/path/to/home/.config/pianobar/current-song.txt', 'w') do |f|
f.write("#[bg=colour39,fg=colour8]♫ #{d['title']} - #{d['artist']} @ #{d['stationName']} #[fg=default,bg=default]")
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment