Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #
- # CREATOR
- # This code in writen by nanorocks
- #
- #
- # POINT
- # Helping script to download mp3 music from file filled with links from youtube
- #
- #
- # USAGE
- # For OS's who compile SHELL SCRIPTS (GNU/LINUX)
- #
- #GLOBAL VARIABLES
- data=$1
- flag=0
- # just logo on start up
- function logo()
- {
- echo "---------------------------------"
- echo "| YOUTUBE SONGS LIST DOWNLOADER |"
- echo "---------------------------------"
- }
- # requirements on start up
- function checkRequirements()
- {
- echo -e "REQUIREMENTS: (youtube-dl,ffmpeg)"
- if ! type "youtube-dl" > /dev/null; then
- echo "You must install youtube-dl on your system."
- exit
- elif ! type "ffmpeg" > /dev/null; then
- echo "You must install ffmpeg on your system."
- exit
- else
- echo "Your requirements are installed."
- fi
- }
- # validation input goes here
- function validationInput()
- {
- if ! [ -f $data ]
- then
- echo "File $data not exist."
- exit
- elif [[ -z "$data" ]]
- then
- echo -e "Set file as parameter after this script.\n E.G: bash <scriptname> <file>"
- exit
- fi
- if ! [ -d songs ]
- then
- mkdir songs
- fi
- }
- # main fuction for music
- function loopingMusic()
- {
- for i in `cat $data`
- do
- echo "Downloading new song from youtube!!!"
- echo `youtube-dl --extract-audio --audio-format mp3 $i`
- flag=$((flag+1))
- done
- ls | grep '.mp3' | while read j
- do
- # echo "$j"
- mv "$j" songs
- done
- echo "You downloaded $flag songs from youtube."
- }
- logo .
- checkRequirements .
- validationInput .
- loopingMusic .
Add Comment
Please, Sign In to add comment