Skip to content

Commit

Permalink
The mpg123 client is now also able to return the current volume level…
Browse files Browse the repository at this point in the history
… correctly. Tested on CentOS.
  • Loading branch information
abuisman committed Apr 6, 2012
1 parent bc35984 commit 490b1b1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/play/clients/mpg123_client.rb
Expand Up @@ -62,5 +62,14 @@ def self.say(msg)
def self.volume=(volume)
system "amixer set Master #{volume}% > /dev/null 2>&1"
end

# Get the current volume level
#
# Returns the current volume from 0 to 100
def self.volume
vol = `amixer get Master`.scan(/([0-9]+)%/).first.last
vol.to_i
end

end
end

0 comments on commit 490b1b1

Please sign in to comment.