Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ jackmgr
- Loading branch information
eXerigumo Clanjor (哆啦比猫)
committed
Jun 30, 2012
1 parent
62f2ea0
commit 3cdfd16
Showing
2 changed files
with
71 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
dialog --menu "你想听什么?" 0 0 0 \ | ||
$(curl flac.repair-of.com | | ||
sed -n 's/.*<a href=\([^ ]\+\)[^>]\+>\([^<]\+\).*/\1 \2/g; | ||
s/ /_/g; | ||
s/html_/html /gp') 2> /tmp/selected | ||
curl $(cat /tmp/selected) > /tmp/detail | ||
if ! [ -z "$(cat /tmp/detail|grep '\.flac<')" ]; then | ||
curl $(cat /tmp/selected | sed 's/\.html/.pls/g') > /tmp/flacplaylist | ||
mplayer -playlist /tmp/flacplaylist | ||
else | ||
echo "居然是分开的……" | ||
echo > /tmp/flacplaylist | ||
count=$(curl $(cat /tmp/selected) | grep '[0-9]\+\/index.html' | wc -l) | ||
for i in $(seq $count); do | ||
curl $(cat /tmp/selected | sed "s/index.html/$i\/index.pls/g") >> /tmp/flacplaylist | ||
done | ||
mplayer -playlist /tmp/flacplaylist | ||
fi |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/bash | ||
# Jack Manager | ||
|
||
function jm_select_op() | ||
{ | ||
echo "0 | ||
启动 Jack | ||
1 | ||
关闭 Jack | ||
2 | ||
重启 Jack" | | ||
zenity --list --text="Jack 管理器" \ | ||
--column="" \ | ||
--column="操作" > /tmp/jm_selected || return 255 | ||
return $(cat /tmp/jm_selected) | ||
} | ||
|
||
function jm_is_jack_running() | ||
{ | ||
ps -A | grep jackd > /dev/zero | ||
} | ||
|
||
function jm_start_jack() | ||
{ | ||
if jm_is_jack_running; then | ||
return 0 | ||
fi | ||
|
||
jackd -mZ -d alsa | ||
} | ||
|
||
function jm_stop_jack() | ||
{ | ||
if ! jm_is_jack_running; then | ||
return 0 | ||
fi | ||
|
||
pkill -9 jackd | ||
} | ||
|
||
while true; do | ||
jm_select_op | ||
case $? in | ||
0) jm_start_jack& ;; | ||
1) jm_stop_jack ;; | ||
2) jm_stop_jack | ||
jm_start_jack& ;; | ||
*) break ;; | ||
esac | ||
done | ||
jm_stop_jack | ||
|