-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.sh
29 lines (23 loc) · 1.09 KB
/
main.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!usr/bin/env bash
clear
echo Please enter the filename of the exported CSV file from Exportify
read sprfile
awk -F "," '{print $2" "$3}' $sprfile >> templist.txt #Gets song names and artist names
sed '1d' templist.txt > list.txt #Puts them into list.txt
declare -i SongNum
SongNum=0
file="list.txt"
PWD=$(pwd)
{mkdir Music} &> /dev/null
TotSongNum=$(wc -l < $file)
while read -r line; do
SongNum+=1
echo -n '[ '$SongNum '/'$TotSongNum' ]' $line
ID=$(youtube-dl "ytsearch:$line" --get-id) #Finds URL from song title
URL=youtube.com/watch?v=$ID #Formats URL into usable link
{
youtube-dl --output "$PWD/Music/%(title)s.%(ext)s" --extract-audio --audio-format mp3 $URL #Downloads song from URL
} &> /dev/null
echo -n " ✔"
echo ''
done <$file #End