分页: 1 / 1

来个bt的: mpd 当前歌曲

发表于 : 2008-10-15 14:26
c\nc

代码: 全选

#!/bin/bash
# mpd 地址;端口;密码
host=localhost; port=6600; password=

csm="`echo -e "password password\\ncurrentsong\\nclose" | nc $host $port`"
export IFS=$'\n'
if echo "$csm" | egrep '^file:'; then
	for line in $csm; do
		eval "${line//: /=\"}\"" 2>/dev/null
	done
	### 如果一切正常,以下变量将被赋值: 
	### file, Time, Artist, Title, Album, Track, Date, Pos, Id 
	
	notify-send -t 2000 "$Artist - $Album" "$Title"  
fi
我的 nc 版本:
netcat (The GNU Netcat) 0.7.1
Copyright (C) 2002 - 2003 Giovanni Giacobbi

This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of this program under the terms of
the GNU General Public License.
For more information about these matters, see the file named COPYING.

Original idea and design by Avian Research <[email protected]>,
Written by Giovanni Giacobbi <[email protected]>.

Re: 来个bt的: mpd 当前歌曲

发表于 : 2008-10-15 21:08
zabbey
WOOOOO~看样子可以用到Conky里,哈哈~

Re: 来个bt的: mpd 当前歌曲

发表于 : 2008-10-15 21:28
内存不足
不明白 conky里默认就可以显示mpd播放的歌曲信息啊
lz的脚本是用在哪里的?

Re: 来个bt的: mpd 当前歌曲

发表于 : 2008-10-16 8:48
c\nc
最后一句是用notify提示的,我没装conky,需要知道歌名的时候就按个热键……

Re: 来个bt的: mpd 当前歌曲

发表于 : 2008-10-16 10:23
eexpress
moc多好。简单多了。

Re: 来个bt的: mpd 当前歌曲

发表于 : 2008-10-16 10:38
dogfox
mplayer简单