-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsong_getter.sh
76 lines (40 loc) · 1.13 KB
/
song_getter.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
echo "Song Getter 1.0"
artist=$1
source=$2
isNew=0
echo " checking: $1"
#check for parameters
#check if an artist exists
if [ -d "/media/pi/3234-3964/Music/$1" ]
then
echo "This artist already exists"
isNew=0
else
echo "$1 is a new Artist, Creating new Directory"
isNew=1
mkdir /media/pi/3234-3964/tempbackup/$artist
fi
cd /media/pi/3234-3964/tempbackup/$artist
youtube-dl -x -i --write-thumbnail --audio-format mp3 $2
echo "********** Extraction complete *********"
echo " Cleaning Files... "
FILES=/media/pi/EMTEC/Music/$artist/*
#for f in $FILES
#do
#file_name="${f##*/}"
#song_title=$(echo $file_name | cut -d'(' -f 1 )
#extension=".mp3"
#new_name=${song_title%?}$extension
#new_name=${new_name// /_}
#echo "Renaming file to : $new_name"
#mv -- "$f" "$new_name"
#done
ls /media/pi/3234-3964/tempbackup/$artist
echo " ****** Finished Download Successfully ************"
#dir=$(pwd)
#find $dir -name '*.mp3' -exec mv {} /media/pi/EMTEC/Music/Led_Zepplin/ \;
#for i in $dir
#do
#mv -- "$i" "/media/pi/EMTEC/Music/Led_Zepplin/"
#done