-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate.sh
executable file
·45 lines (42 loc) · 1.06 KB
/
generate.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
#!/usr/bin/env bash
#
# Generates "README.md" with IMDb top 50 movies
#
# Colors
NC="\033[0m"
RED="\033[0;31m"
GREEN="\033[1;32m"
YELLOW="\033[1;33m"
# Get current directory
ROOT_DIR="$(pwd)"
# Main Script
./IMDb.py 1>/dev/null
ERROR_CODE="$?"
if [[ "${ERROR_CODE}" != "0" ]]; then
echo -e "${RED}Running Python IMDb.py Program Failed.${NC}"
echo -e "${RED}Exiting...${NC}"
exit 1
fi
echo -e "${GREEN}'README.md' file generated.${NC}"
echo ""
echo -e "${GREEN}JSON file(s) are being generated.${NC}"
cd data/top50 || exit 1
csvtojson movies.csv >movies.json
csvtojson shows.csv >shows.json
cd "${ROOT_DIR}" || exit 1
cd data/top250 || exit 1
csvtojson movies.csv >movies.json
csvtojson shows.csv >shows.json
cd "${ROOT_DIR}" || exit 1
cd data/popular || exit 1
csvtojson movies.csv >movies.json
csvtojson shows.csv >shows.json
echo ""
echo -e "${GREEN}README.md and JSON file(s) are ready for committing.${NC}"
echo ""
if [[ -z $(git status --porcelain) ]]; then
echo -e "${GREEN}Nothing to Update${NC}"
else
echo -e "${YELLOW}File(s) changed -${NC}"
git diff --name-only
fi