Permalink
Browse files

Don't block Client playing loop if MpcClient can't add the song.

  • Loading branch information...
medwards committed Nov 28, 2011
1 parent e0baa12 commit c767f6e8699f73053e50e5bf6a97b7330a166fe1
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/play/mpcclient.rb
View
@@ -5,7 +5,9 @@ class MpcClient < Client
# Returns nothing
def self.play(song_path)
if `mpc playlist | wc -l`.to_i < 1
- system('mpc', 'add', song_path.gsub(/^#{Play.config['path']}\//,""))
+ if not system('mpc', 'add',
+ song_path.gsub(/^#{Play.config['path']}\//,""))
+ return # mpc didn't add the song, so just return, don't block
end
`mpc play`
`mpc idle` # self.play is expected to block, so wait for an event

0 comments on commit c767f6e

Please sign in to comment.