从老弟那里弄了20G的音乐,不过是从windows下拷过来的,文件名不适合linux,用mplayer播放时没问题,管理起来就麻烦,就写个脚本统统rename一下,再用资源占用极小的mplayer播放
为避免每次播放前重复rename,分为两个脚本:
1.rename.sh
#!/bin/bash
#this will run several times until no warnings
for ((i=1; i<=10; i=i+1))
do
find /home/stesen/music/ * |rename "s/\ /-/g"
find /home/stesen/music/ * |rename "s/\[//g"
find /home/stesen/music/ * |rename "s/\《/find /home/stesen/music/ * |rename "s/\]//g"
find /home/stesen/music/ * |rename "s/\》/>/g"
find /home/stesen/music/ * |rename "s/"MP3"/"mp3"/g"
find /home/stesen/music/ * |rename "s/"WMA"/"wma"/g"
find /home/stesen/music/ * |rename "s/\&/-and-/g"
find /home/stesen/music/ * |rename "s/\@/-at-/g"
find /home/stesen/music/ * |rename "s/\”/\"/g"
find /home/stesen/music/ * |rename "s/\“/\"/g"
find /home/stesen/music/ * |rename "s/\(//g"
find /home/stesen/music/ * |rename "s/\)//g"
find /home/stesen/music/ * |rename "s/\[//g"
find /home/stesen/music/ * |rename "s/\]//g"
find /home/stesen/music/ * |rename "s/\'//g"
find /home/stesen/music/ * |rename "s/\`//g"
done
因为一次只能改一层目录或文件,所以循环10次,笨办法了~~
2.autoplay.sh
事先要建立~/music/playmusic/文件夹
#!/bin/bash
#this is the vision 2009-7-19-1 for playing all music file in this folder
#2009-7-19-1
#by stesen
#run the rename.sh first
#warning you should have the permissin to creat a playlist in this folder
find ~/music/ mp3|grep 'mp3$' > ~/music/playmusic/playlist
find ~/music/ wma|grep 'wma$' >> ~/music/playmusic/playlist
mplayer -playlist ~/music/playmusic/playlist -shuffle -loop 0
阅读(634) | 评论(0) | 转发(0) |