-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
56 lines (42 loc) · 1.49 KB
/
main.py
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
import apod
import colorama
import colors
import config
import datetime
import os
import traceback
import utils
from logger import logger
def main() -> None:
apod_data = apod.get_apod_data()
# todo: progress bar
for apod_item in apod_data:
print()
apod.extend_apod(
apod_item["date"] if "date" in apod_item else None,
apod_item["title"] if "title" in apod_item else None,
apod_item["url"] if "url" in apod_item else None,
apod_item["hdurl"] if "hdurl" in apod_item else None,
apod_item["thumbnail_url"] if "thumbnail_url" in apod_item else None,
apod_item["media_type"] if "media_type" in apod_item else None,
apod_item["explanation"] if "explanation" in apod_item else None,
)
print()
if __name__ == "__main__":
_start_time = datetime.datetime.now()
try:
utils.print_start_info()
config.init()
os.makedirs("./.output/images/", exist_ok=True)
os.makedirs("./.output/data/", exist_ok=True)
os.makedirs("./.temp/", exist_ok=True)
colors.generate_filter_colors()
main()
except utils.CriticalError as critical_error:
logger.critical(critical_error)
except Exception as exception:
logger.critical(traceback.format_exc())
logger.info(
f"The program finished in {colorama.Style.BRIGHT}{(datetime.datetime.now() - _start_time).total_seconds()}{colorama.Style.NORMAL} sec!"
)
print()