-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathromaji-renamer.sh
60 lines (59 loc) · 1.95 KB
/
romaji-renamer.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
#!/bin/bash
RUN_ANIMES_SCRIPT=0
RUN_MOVIES_SCRIPT=0
RUN_SEASONAL_SCRIPT=0
SCRIPT_FOLDER=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
source "$SCRIPT_FOLDER/config/.env"
source "$SCRIPT_FOLDER/VERSION"
source "$SCRIPT_FOLDER/functions.sh"
if ! grep -q -w "$version" "$SCRIPT_FOLDER/config/version_last_run.txt"
then
rm "$SCRIPT_FOLDER/config/data/*.json"
fi
printf "%s" "$version" > "$SCRIPT_FOLDER/config/version_last_run.txt"
printf "%s - Romaji-Renamer v%s\n" "$(date +%H:%M:%S)" "$version" | tee -a "$LOG"
locale=$(locale -a | grep -i "utf" | head -n 1)
if [ -z "$locale" ]
then
printf "%s - Error no utf8 locale installed\n" "$(date +%H:%M:%S)" | tee -a "$LOG"
exit 1
else
export LC_ALL="$locale"
fi
if [ ! -d "$SCRIPT_FOLDER/config" ]
then
printf "%s - Error config folder missing\n" "$(date +%H:%M:%S)" | tee -a "$LOG"
exit 1
fi
if [ ! -f "$SCRIPT_FOLDER/config/default.env" ]
then
curl -s "https://raw.githubusercontent.com/Arial-Z/Romaji-Renamer/dev/config/default.env" > "$SCRIPT_FOLDER/config/default.env"
fi
if [ ! -f "$SCRIPT_FOLDER/config/override-ID-animes.example.tsv" ]
then
curl -s "https://raw.githubusercontent.com/Arial-Z/Romaji-Renamer/dev/config/override-ID-animes.example.tsv" > "$SCRIPT_FOLDER/config/override-ID-animes.example.tsv"
fi
if [ ! -f "$SCRIPT_FOLDER/config/override-ID-movies.example.tsv" ]
then
curl -s "https://raw.githubusercontent.com/Arial-Z/Romaji-Renamer/dev/config/override-ID-movies.example.tsv" > "$SCRIPT_FOLDER/config/override-ID-movies.example.tsv"
fi
# sleep infinity
if [ -f "$SCRIPT_FOLDER/config/.env" ]
then
source "$SCRIPT_FOLDER/config/.env"
if [[ $RUN_ANIMES_SCRIPT == "Yes" ]]
then
bash "$SCRIPT_FOLDER/animes-renamer.sh"
fi
if [[ $RUN_MOVIES_SCRIPT == "Yes" ]]
then
bash "$SCRIPT_FOLDER/movies-renamer.sh"
fi
if [[ $RUN_SEASONAL_SCRIPT == "Yes" ]]
then
bash "$SCRIPT_FOLDER/seasonal-animes-download.sh"
fi
else
printf "%s - Error no config found\n" "$(date +%H:%M:%S)" | tee -a "$LOG"
exit 1
fi