amixer sset PCM 10%{+,-}で相対的に音量増減できるはずなのだが、
上手く動作しないようなので
amixer sget PCMから現在のボリュームを取得して+-5するようにしてみた。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
/home/pi/aquestalkpi/AquesTalkPi -g 100 "らじお、ていし" | aplay | |
killall mplayer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
/home/pi/aquestalkpi/AquesTalkPi -g 100 "えぬえいちけい、いち、かいし" | aplay | |
killall mplayer | |
mplayer -playlist http://mfile.akamai.com/129931/live/reflector:46032.asx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
/home/pi/aquestalkpi/AquesTalkPi -g 100 "えぬえいちけい、に、かいし" | aplay | |
killall mplayer | |
mplayer -playlist http://mfile.akamai.com/129932/live/reflector:46056.asx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
/home/pi/aquestalkpi/AquesTalkPi -g 100 "えぬえいちけい、えふえむ、かいし" | aplay | |
killall mplayer | |
mplayer -playlist http://mfile.akamai.com/129933/live/reflector:46051.asx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
/home/pi/aquestalkpi/AquesTalkPi -g 100 "だらずえふえむ、かいし" | aplay | |
killall mplayer | |
mplayer -playlist http://www.darazfm.com/streaming.asx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
/home/pi/aquestalkpi/AquesTalkPi -g 100 "びーびーしー、いち、かいし" | aplay | |
killall mplayer | |
mplayer -playlist http://www.bbc.co.uk/radio/listen/live/r1.asx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
/home/pi/aquestalkpi/AquesTalkPi -g 100 "ろく" | aplay |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
`/home/pi/aquestalkpi/AquesTalkPi -g 100 "ぼりゅーむ" | aplay` | |
vo=`amixer sget PCM | awk 'match($0,/([[:digit:]]+)%/,data){ print data[1]}'` | |
vo=`expr $vo + 5` | |
if [ $vo -gt 100 ] | |
then | |
vo=100 | |
fi | |
`/home/pi/aquestalkpi/AquesTalkPi -g 100 "$voぱあせんと" | aplay` | |
amixer sset PCM "$vo%" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
`/home/pi/aquestalkpi/AquesTalkPi -g 100 "ぼりゅーむ" | aplay` | |
vo=`amixer sget PCM | awk 'match($0,/([[:digit:]]+)%/,data){ print data[1]}'` | |
vo=`expr $vo - 5` | |
if [ $vo -lt 75 ] | |
then | |
vo=75 | |
fi | |
`/home/pi/aquestalkpi/AquesTalkPi -g 100 "$voぱあせんと" | aplay` | |
amixer sset PCM "$vo%" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
/home/pi/aquestalkpi/AquesTalkPi -g 100 "きゅう" | aplay |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
/home/pi/aquestalkpi/AquesTalkPi -g 100 "でんとう" | aplay | |
irsend SEND_ONCE light power |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
/home/pi/aquestalkpi/AquesTalkPi -g 100 "ちょうこう" | aplay | |
irsend SEND_ONCE light choukou |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
/home/pi/aquestalkpi/AquesTalkPi -g 100 "じょうやとう" | aplay | |
irsend SEND_ONCE light jouyatou |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding:utf-8 | |
class Locked < StandardError | |
end | |
def lock(lock_file_path='/tmp/rirc') | |
File.open(lock_file_path, 'w') do |lock_file| | |
if lock_file.flock(File::LOCK_EX|File::LOCK_NB) | |
yield | |
else | |
raise Locked | |
end | |
end | |
end | |
def exec_script(cmd) | |
dir = File.expand_path(File.dirname(__FILE__)) | |
script = File.join(dir,"#{cmd}.sh") | |
if File.exist?(script) | |
Process.spawn(script) | |
end | |
end | |
INTERVAL_SEC = 1.0 | |
begin | |
lock do | |
IO.popen("irw","r") do |io| | |
st = Time.now | |
loop do | |
# 0000555af1484a8b 00 1 rimokon | |
line = io.gets.chomp | |
int = Time.now - st | |
if int > INTERVAL_SEC | |
cmd = line.split(" ")[-2..-1].join("-") # => 1-remokon | |
exec_script(cmd) | |
st = Time.now | |
end | |
end | |
end | |
end | |
rescue Locked | |
exit 0 | |
end |
0 件のコメント:
コメントを投稿