http://deadbeef.sourceforge.net/
顺便分享一个infobar用的歌词脚本,从baidu歌词上挖的
[bash]
#!/bin/bash
# Infobar plugin for DeaDBeeF music player
# Copyright (C) 2011-2012 Dmitriy Simbiriatin <dmitriy.simbiriatin@gmail.com>
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# This an example lyrics script which fetches lyrics from http://lyrics.com.
# Encoded artist name.
ARTIST="$1"
# Encoded song title.
TITLE="$2"
#Encoded album name.
ALBUM="$3"
# By default, plugin encodes spaces using '_' character, you can use sed to
# replace them with the character you need.
# Lyrics.com uses '-' to encode the spaces, so we gonna replace default '_'
# characters with them.
ARTIST=`echo "$ARTIST" | sed 's/_/-/g'`
# Same as for artist name.
TITLE=`echo "$TITLE" | sed 's/_/-/g'`
# XPath expression to find the lyrics on the page.
#EXP="//div[@id=\"on_tour\"]"
EXP="//div[@class=\"lrc-content\"]"
# URL template.
#URL_TEMP="http://www.lyrics.com/$TITLE-lyrics-$ARTIST.html"
#URL_TEMP="http://www.xiami.com/search?key=$ARTIST+$TITLE+$ALBUM"
URL_TEMP="http://music.baidu.com/search/lrc?key=$ ... TLE+$ALBUM"
# I'm using xml_grep utility from "xml twig" package here (you can easily find
# this package in your favorite distro) to parse an html page, and "w3m" to form
# a pretty-looking lyrics text.
xml_grep -html $EXP $URL_TEMP | w3m -dump -T text/html | sed 1d | sed '/^复制歌词/,$d';
exit 0;
[/bash]
在自带的example.sh基础上改的。百度这个2货提供的歌词也不知道从哪找来的,提供了歌手、歌名、专辑,它居然还能显示好多段一样的歌词,而且格式都一模一样,没办法预处理只好本地处理,有点脏,凑合用吧。
deadbeef 0.5.6发布了
-
- 帖子: 1318
- 注册时间: 2005-09-13 4:56
- 系统: Ubuntu Jammy Jellyfi
- photor
- 论坛版主
- 帖子: 11004
- 注册时间: 2008-04-26 12:41
-
- 帖子: 69
- 注册时间: 2009-05-14 0:51
-
- 论坛版主
- 帖子: 5211
- 注册时间: 2009-12-12 19:29
- 系统: Kubuntu
Re: deadbeef 0.5.6发布了
坐等Deepin版
-
- 帖子: 1318
- 注册时间: 2005-09-13 4:56
- 系统: Ubuntu Jammy Jellyfi
Re: deadbeef 0.5.6发布了
今天man了xml_grep发现看漏了,原来可以指定匹配次数的,这就容易多了。
修改版,默认匹配歌手+歌名+专辑,如果匹配不到就只匹配歌手+歌名,只dump第一段匹配内容。
保存之后在deadbeef的infobar歌词配置里启用该脚本就可以了。
[bash]
#!/bin/bash
# Infobar plugin for DeaDBeeF music player
# Copyright (C) 2011-2012 Dmitriy Simbiriatin <dmitriy.simbiriatin@gmail.com>
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# This an example lyrics script which fetches lyrics from http://lyrics.com.
# Encoded artist name.
ARTIST="$1"
# Encoded song title.
TITLE="$2"
#Encoded album name.
ALBUM="$3"
# By default, plugin encodes spaces using '_' character, you can use sed to
# replace them with the character you need.
# Lyrics.com uses '-' to encode the spaces, so we gonna replace default '_'
# characters with them.
ARTIST="`echo "$ARTIST" | sed 's/_/ /g'`"
# Same as for artist name.
TITLE="`echo "$TITLE" | sed 's/_/ /g'`"
# XPath expression to find the lyrics on the page.
#EXP="//div[@id=\"on_tour\"]"
EXP="//div[@class=\"lrc-content\"]"
# URL template.
#URL_TEMP="http://www.lyrics.com/$TITLE-lyrics-$ARTIST.html"
URL_TEMP="http://music.baidu.com/search/lrc?key=$ ... TLE+$ALBUM"
# I'm using xml_grep utility from "xml twig" package here (you can easily find
# this package in your favorite distro) to parse an html page, and "w3m" to form
# a pretty-looking lyrics text.
total=$(xml_grep --count -html $EXP "$URL_TEMP" | sed -n 2p |awk '{print $2}')
if [ $total -eq 0 ]; then
URL_TEMP="http://music.baidu.com/search/lrc?key=$ARTIST+$TITLE"
echo "$URL_TEMP"
fi
xml_grep --nb_results 1 -html $EXP "$URL_TEMP" | w3m -dump -T text/html | sed 1d;
exit 0;
[/bash]
对了,如果不是特别需要,infobar里面歌词网站别开那么多,留着最上面的那个就行了。baidu上东西虽然乱,但是好处是够全,不匹配专辑名搜的话绝大部分都能搜到,而且速度也快。
修改版,默认匹配歌手+歌名+专辑,如果匹配不到就只匹配歌手+歌名,只dump第一段匹配内容。
保存之后在deadbeef的infobar歌词配置里启用该脚本就可以了。
[bash]
#!/bin/bash
# Infobar plugin for DeaDBeeF music player
# Copyright (C) 2011-2012 Dmitriy Simbiriatin <dmitriy.simbiriatin@gmail.com>
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# This an example lyrics script which fetches lyrics from http://lyrics.com.
# Encoded artist name.
ARTIST="$1"
# Encoded song title.
TITLE="$2"
#Encoded album name.
ALBUM="$3"
# By default, plugin encodes spaces using '_' character, you can use sed to
# replace them with the character you need.
# Lyrics.com uses '-' to encode the spaces, so we gonna replace default '_'
# characters with them.
ARTIST="`echo "$ARTIST" | sed 's/_/ /g'`"
# Same as for artist name.
TITLE="`echo "$TITLE" | sed 's/_/ /g'`"
# XPath expression to find the lyrics on the page.
#EXP="//div[@id=\"on_tour\"]"
EXP="//div[@class=\"lrc-content\"]"
# URL template.
#URL_TEMP="http://www.lyrics.com/$TITLE-lyrics-$ARTIST.html"
URL_TEMP="http://music.baidu.com/search/lrc?key=$ ... TLE+$ALBUM"
# I'm using xml_grep utility from "xml twig" package here (you can easily find
# this package in your favorite distro) to parse an html page, and "w3m" to form
# a pretty-looking lyrics text.
total=$(xml_grep --count -html $EXP "$URL_TEMP" | sed -n 2p |awk '{print $2}')
if [ $total -eq 0 ]; then
URL_TEMP="http://music.baidu.com/search/lrc?key=$ARTIST+$TITLE"
echo "$URL_TEMP"
fi
xml_grep --nb_results 1 -html $EXP "$URL_TEMP" | w3m -dump -T text/html | sed 1d;
exit 0;
[/bash]
对了,如果不是特别需要,infobar里面歌词网站别开那么多,留着最上面的那个就行了。baidu上东西虽然乱,但是好处是够全,不匹配专辑名搜的话绝大部分都能搜到,而且速度也快。
- soswxl
- 帖子: 33
- 注册时间: 2009-08-08 12:18
- 系统: Ubuntu 12.10
Re: deadbeef 0.5.6发布了

- Strange
- 帖子: 1824
- 注册时间: 2006-05-19 9:54
- 来自: Shanghai
- maoyaotang
- 帖子: 256
- 注册时间: 2011-03-12 14:40
- 来自: 伤感地带城市,梅穿裤子小区
- fuhaoyun
- 帖子: 526
- 注册时间: 2009-05-08 14:12
- 来自: http://weibo.com/u/2201287863
Re: deadbeef 0.5.6发布了

只用Ubuntu/Unity:安全、高效、自由、简洁!
http://weibo.com/u/2201287863
----------------------------------------------------
用了4年Ubuntu,发现离开windows也可以活得很好
看球赛、炒股、聊天、office等等都不算问题了
一切都是习惯,困难解决了就好