[cappuccino]

At The Beginning Of The New Journey

About Me

Subscribe now!

Latest posts

Twitter Updates

Friends

Loading...

Opensource.com.vn - Mã nguồn mở Việt Nam

Gentoo Linux News

20 Sep 2009

[Toy] Download nhạc từ Dreammedia.ru

0 comments

Đây là script mà tôi dùng để thuyết trình trong sfd 2009, cách sử dụng rất đơn giản, copy nội dung dưới đây, lưu lại với tên tùy ý [dot]sh, chmod +x file, dạo một vòng dreammedia.ru, chọn ban nhạc và tên album yêu thích, chạy script, nhập thông tin yêu cầu và download nhạc về.

#!/bin/bash
url="http://dreammedia.ru"
username=`whoami`
path="/home/$username"
input="$path/playlist.xml"
output="$path/playlist.txt"

read -p 'Enter name of band you want to download: ' band

echo
read -p 'Enter name of Album, include space if it has: ' album
playlist="http://dreammedia.ru/playlist/$band/$album/playlist.xml"
wget -O $input "$playlist"
if test ! -s $input 
then
echo 'Cannot get playlist, sorry!'
rm -f $path/playlist.xml
exit 1
else
echo 'Got it'
echo 'Start this game'
touch $output 
cat $input | awk -F '[<>]' '/mp3/{print $3}' | sed 's/\ /%20/g'> $output
fi
for i in `more $output` 
do
echo Downloading
wget  "$url$i"
done
exit 0


Chỉ có thế, ko có gì nói thêm :-D