从Last.FM的资料库中给iTune中的音乐加标签
作者:Anonymous 翻译:Kid
我需要一个可以根据Last.FM的资料库来给我音乐自动设置标签的功能。所以我写了一个bash shell脚本,可以让iTune使用最常用的三个标签给我所指定的专辑加标签。
脚本如下
- #!/bin/bash
- TAGS="extract.txt"
- TITLE=`exec osascript <<EOF
- tell application "iTunes"
- get artist of current track
- --set genre of current track to "HORSE POP"
- end tell`
- echo "Fetching tags for: " $TITLE
- wget -q http://last.fm/music/$TITLE/+tags
- sed -n 's/rel="tag"//p' +tags >gt;>gt; $TAGS
- TAGLIST=`awk '{print $4,$6,$7,$8,$9,$10}' $TAGS |sort -r|head -3|sed 's/.*" >gt;//g'|sed 's/</a>gt;//g'`
- TAGLIST=`echo $TAGLIST|sed '/SCENE.*[^.]$/N;s/n */ /'`
- echo $TAGLIST >gt; $TAGS
- echo "Setting tags to :" $TAGLIST
- NEWTAGS=`exec osascript <</EOF
- set tags to do shell script "cat extract.txt"
- tell application "iTunes"
- set genre of current track to tags
- end tell`
- rm +tags
- rm $TAGS
复制代码
这不是最完美的解决办法,不过这让设置标签更简单了,至少对我来说。
希望这对你有用或者能启发你:)
原帖地址:猛点我 |