-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathledl.sh
More file actions
173 lines (162 loc) · 4.85 KB
/
ledl.sh
File metadata and controls
173 lines (162 loc) · 4.85 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#!/bin/bash
#LEDL - Local Entertainment Downloader
#Code can be used freely as long as I am credited
#FUNCTIONS SECTION START
function categoryChoice() {
echo "Which category do you want to download?"
echo "[1] movies"
echo "[2] series"
echo "[3] anime"
read -p "Category choice: [1-2]" category
}
#SECTIION START ANIME
function oldAnimeList() {
echo "This is a list of anime that is available:"
echo ""
ls /Volumes/Data/Shared/anime/
read -p "Which anime do you wish to download?: " ms
}
function newAnimeList() {
echo "This is a list of anime that is available:"
echo ""
ls /Volumes/Data/Shared/anime/__new_anime
read -p "Which anime do you wish to download?: " ms
}
function oldAnimeDownload () {
if [ -d ~/Movies/"$ms" ]; then
echo "Destination directory already exists downloading non-exsiting files..."
rsync -avz -r --ignore-existing --progress /Volumes/Data/Shared/anime/*"$ms"* ~/Movies/"$ms"
else
echo "Creating download directory..."
mkdir ~/Movies/"$ms"/
rsync -avz -r --progress /Volumes/Data/Shared/anime/*"$ms"* ~/Movies/"$ms"
fi
}
function newAnimeDownload () {
if [ -d ~/Movies/"$ms" ]; then
echo "Destination directory already exists downloading non-exsiting files..."
rsync -avz -r --ignore-existing --progress /Volumes/Data/Shared/anime/*"$ms"* ~/Movies/"$ms"
else
echo "Creating download directory..."
mkdir ~/Movies/"$ms"/
rsync -avz -r --progress /Volumes/Data/Shared/anime/__new_anime/*"$ms"* ~/Movies/"$ms"
fi
}
#SECTIION END ANIME
#SECTIION START SERIES
function oldSeriesList() {
echo "This is a list of series you already watched:"
echo ""
ls /Volumes/Data/Shared/series/
read -p "Which series do you want to download?: " ms
}
function newSeriesList() {
echo "This is a list of series you haven't watched yet:"
echo ""
ls /Volumes/Data/Shared/series/__new_series
read -p "Which series do you want to download?: " ms
}
function oldSeriesDownload() {
if [ -d ~/Movies/"$ms" ]; then
echo "Destination directory already exists downloading non-exsiting files..."
rsync -avz -r --ignore-existing --progress /Volumes/Data/Shared/series/*"$ms"* ~/Movies/"$ms"
else
echo "Creating download directory..."
mkdir ~/Movies/"$ms"/
rsync -avz -r --progress /Volumes/Data/Shared/series/*"$ms"* ~/Movies/"$ms"
fi
}
function newSeriesDownload() {
if [ -d ~/Movies/"$ms" ]; then
echo "Destination directory already exists downloading non-exsiting files..."
rsync -avz -r --ignore-existing --progress /Volumes/Data/Shared/series/__new_series/*"$ms"* ~/Movies/"$ms"
else
echo "Creating download directory..."
mkdir ~/Movies/"$ms"/
rsync -avz -r --progress /Volumes/Data/Shared/series/__new_series/*"$ms"* ~/Movies/"$ms"
fi
}
#SECTIION END SERIES
#SECTIION START MOVIES
function oldMoviesList() {
echo "This is a list of movies you already watched:"
echo ""
ls /Volumes/Data/Shared/movies/
read -p "Which movie do you wish to download?: " ms
}
function newMoviesList() {
echo "This is a list of movies you haven't watched yet:"
echo ""
ls /Volumes/Data/Shared/movies/__new_movies
read -p "Which movie do you wish to download?: " ms
}
function oldMoviesDownload() {
if [ -d ~/Movies/"$ms" ]; then
echo "Destination directory already exists downloading non-exsiting files..."
rsync -avz -r --ignore-existing --progress /Volumes/Data/Shared/movies/*"$ms"* ~/Movies/"$ms"
else
echo "Creating download directory..."
mkdir ~/Movies/"$ms"/
rsync -avz -r --progress /Volumes/Data/Shared/movies/*"$ms"* ~/Movies/"$ms"
fi
}
function newMovieDownload() {
if [ -d ~/Movies/"$ms" ]; then
echo "Destination directory already exists downloading non-exsiting files..."
rsync -avz -r --ignore-existing --progress /Volumes/Data/Shared/movies/__new_movies/*"$ms"* ~/Movies/"$ms"
else
echo "Creating download directory..."
mkdir ~/Movies/"$ms"/
rsync -avz -r --progress /Volumes/Data/Shared/movies/__new_movies/*"$ms"* ~/Movies/"$ms"
fi
}
#SECTIION END MOVIES
function oldVnewCheck() {
echo "Old or new entertainment?"
echo "[o] Old"
echo "[n] New"
read -p "Choice: [o/n] " ovn
}
function listAndDownload() {
#Check for Movies category
if [[ "$category" == "1" ]]; then
oldVnewCheck
if [[ "$ovn" == "o" ]]; then
oldMoviesList
oldMoviesDownload
elif [[ "$ovn" == "n" ]]; then
newMoviesList
newMovieDownload
fi
#Check for Series category
elif [[ "$category" == "2" ]]; then
oldVnewCheck
if [[ "$ovn" == "o" ]]; then
oldSeriesList
oldSeriesDownload
elif [[ "$ovn" == "n" ]]; then
newSeriesList
newSeriesDownload
fi
fi
#Check for Anime category
if [[ "$category" == "3" ]]; then
oldVnewCheck
if [[ "$ovn" == "o" ]]; then
oldAnimeList
oldAnimeDownload
elif [[ "$ovn" == "n" ]]; then
newAnimeList
newAnimeDownload
fi
fi
}
#FUNCTIONS SECTION END
#MAIN SECTION START
if [ -d "/Volumes/Data/Shared" ]; then
categoryChoice
listAndDownload
else
echo "Volume is not mounted"
fi
#MAIN SECTION END