来个bt的: mpd 当前歌曲

sh/bash/dash/ksh/zsh等Shell脚本
回复
头像
c\nc
帖子: 231
注册时间: 2007-12-25 12:51

来个bt的: mpd 当前歌曲

#1

帖子 c\nc » 2008-10-15 14:26

代码: 全选

#!/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 <hobbit@avian.org>,
Written by Giovanni Giacobbi <giovanni@giacobbi.net>.
zabbey
帖子: 296
注册时间: 2006-05-06 2:03

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

#2

帖子 zabbey » 2008-10-15 21:08

WOOOOO~看样子可以用到Conky里,哈哈~
头像
内存不足
论坛版主
帖子: 3277
注册时间: 2005-08-18 18:43
联系:

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

#3

帖子 内存不足 » 2008-10-15 21:28

不明白 conky里默认就可以显示mpd播放的歌曲信息啊
lz的脚本是用在哪里的?
໌→ iCookie Gtk Theme
໌→DropPlusBluetheme
กรัก กรัก`菠萝
头像
c\nc
帖子: 231
注册时间: 2007-12-25 12:51

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

#4

帖子 c\nc » 2008-10-16 8:48

最后一句是用notify提示的,我没装conky,需要知道歌名的时候就按个热键……
头像
eexpress
帖子: 58428
注册时间: 2005-08-14 21:55
来自: 长沙

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

#5

帖子 eexpress » 2008-10-16 10:23

moc多好。简单多了。
● 鸣学
头像
dogfox
论坛版主
帖子: 5311
注册时间: 2006-09-02 14:18
来自: 汉桑城
联系:

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

#6

帖子 dogfox » 2008-10-16 10:38

mplayer简单
全世界linux爱好者联合起来 !
回复