projects
/
openhab-process.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
029236a
)
Обработка команд увеличения/уменьшения громкости
author
Roman Bazalevsky
<rvb@rvb.name>
Fri, 30 Sep 2016 09:25:22 +0000
(12:25 +0300)
committer
Roman Bazalevsky
<rvb@rvb.name>
Fri, 30 Sep 2016 09:25:22 +0000
(12:25 +0300)
mqtt-mpd/mqmpd
patch
|
blob
|
history
diff --git
a/mqtt-mpd/mqmpd
b/mqtt-mpd/mqmpd
index 9867146a7e72c128dc032e256c13e4320e8d55a8..5d378ea140a912862b797c4d3620e3a0ca2db6d8 100755
(executable)
--- a/
mqtt-mpd/mqmpd
+++ b/
mqtt-mpd/mqmpd
@@
-60,24
+60,42
@@
do
if [[ "$arg" =~ [A-Za-z0-9]+ ]]
then
if [[ "$arg" =~ [A-Za-z0-9]+ ]]
then
+ echo "$cmd -> $arg"
+
case $cmd in
volume)
case $cmd in
volume)
- reply=( `$mpccmd volume`)
- currvolume=`echo ${reply[1]} | sed 's/%//'`
- if [ "$currvolume" ]
+ if [ "$arg" = "INCREASE" ]
then
then
- if [ "$arg" -gt "$currvolume" ]
- then
- delta=$(( $arg - $currvolume ))
- $mpccmd volume +$delta
- fi
- if [ "$arg" -lt "$currvolume" ]
+ $mpccmd volume +5
+ fi
+ if [ "$arg" = "DECREASE" ]
+ then
+ $mpccmd volume -5
+ fi
+ if [[ "$arg" =~ [0-9]+ ]]
+ then
+ reply=( `$mpccmd volume`)
+ currvolume=`echo ${reply[1]} | sed 's/%//'`
+ if [ "$currvolume" ]
then
then
- delta=$(( $currvolume - $arg ))
- $mpccmd volume -$delta
- fi
- fi
+ if [ "$arg" -gt "$currvolume" ]
+ then
+ delta=$(( $arg - $currvolume ))
+ $mpccmd volume +$delta
+ fi
+ if [ "$arg" -lt "$currvolume" ]
+ then
+ delta=$(( $currvolume - $arg ))
+ $mpccmd volume -$delta
+ fi
+ if [ "$arg" -eq "$currvolume" ]
+ then
+ $mpccmd repeat
+ $mpccmd repeat
+ fi
+ fi
+ fi
;;
status)
case $arg in
;;
status)
case $arg in
@@
-94,6
+112,10
@@
do
;;
esac
;;
;;
esac
;;
+ currentnum)
+ $mpccmd pause
+ $mpccmd play $arg
+ ;;
repeat|random|single|consume)
$mpccmd $cmd $arg
;;
repeat|random|single|consume)
$mpccmd $cmd $arg
;;