Something went wrong. Try again.
dotfiles
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091class Spotify def [](_) false end
def available run('status') != 'Not available' end
def status run('status').downcase.to_sym end
def play run 'play' end
def pause run 'pause' end
def stop run 'stop' end
def toggle run 'play-pause' end
def next run 'next' end
def previous run 'previous' end
def long data = metadata
return file if data[:title].empty?
output = data[:title]
output = "#{data[:artist]} - #{output}" unless data[:artist].empty? output = "#{output} (#{data[:album]}" unless data[:album].empty?
output end
def short metadata[:title] end
def file run 'metadata mpris:trackid' end
def to_s data = metadata return data[:title] if data[:artist].empty? "#{data[:artist]} - #{data[:title]}" end
private
def run(command) `playerctl -p spotify #{command}`.strip end
def artist run 'metadata artist' end
def title run 'metadata title' end
def album run 'metadata album' end
def metadata { artist: artist.strip, title: title.strip, album: album.strip } endend