Chinaunix首页 | 论坛 | 博客
  • 博客访问: 119468
  • 博文数量: 32
  • 博客积分: 2067
  • 博客等级: 大尉
  • 技术积分: 383
  • 用 户 组: 普通用户
  • 注册时间: 2009-05-08 07:47
文章分类

全部博文(32)

文章存档

2011年(1)

2010年(14)

2009年(17)

我的朋友

分类: LINUX

2009-07-22 10:49:38

从老弟那里弄了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) |
给主人留下些什么吧!~~