-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.py
101 lines (89 loc) · 2.94 KB
/
start.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
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
import subprocess
import logging
import sys
import os
import ctypes
from importlib.metadata import distribution, PackageNotFoundError
os.system("cls" if os.name == "nt" else "clear")
def setTitle(title):
ctypes.windll.kernel32.SetConsoleTitleW(title)
setTitle(r"atlasata-code // YT-DL //")
try:
from src.colorTexts import red, green, yellow
except ImportError:
print(r"""
_____ _____ __ _____ _____ __ __ _____ ____ __
| _ ||_ _|| | | _ || __| ___ | | ||_ _|| \ | |
| | | | | |__ | ||__ ||___||_ _| | | | | || |__
|__|__| |_| |_____||__|__||_____| |_| |_| |____/ |_____|
""")
toPrint = "\nERR: the 'colored' is not installed. downloading..\n"
logging.info(toPrint)
print(toPrint)
try:
subprocess.check_call([sys.executable, "-m", "pip", "install", "colored"])
toPrint = "SUC: the 'colored' is installed.\n"
logging.info(toPrint)
print(toPrint)
from src.colorTexts import red, green, yellow
except subprocess.CalledProcessError as e:
toPrint = f"ERR: the 'colored' can't be installable."
logging.info(toPrint)
print(toPrint)
sys.exit(404)
requirements = [
"ansicon",
"blessed",
"Brotli",
"certifi",
"charset-normalizer",
"colored",
"editor",
"idna",
"inquirer",
"jinxed",
"mutagen",
"pycryptodomex",
"readchar",
"requests",
"runs",
"six",
"urllib3",
"wcwidth",
"websockets",
"xmod",
"yt-dlp"
]
for req in requirements:
try:
# Paket yüklüyse dağıtım bilgilerini al
distribution(req)
except PackageNotFoundError:
os.system("cls" if os.name == "nt" else "clear")
banner = r"""
_____ _____ __ _____ _____ __ __ _____ ____ __
| _ ||_ _|| | | _ || __| ___ | | ||_ _|| \ | |
| | | | | |__ | ||__ ||___||_ _| | | | | || |__
|__|__| |_| |_____||__|__||_____| |_| |_| |____/ |_____|
"""
print(green(banner))
toPrint = f"{red('ERR:')} the '{yellow(req)}' is not installed! {green('downloading...')}"
logging.info(toPrint)
print(toPrint)
try:
subprocess.check_call([sys.executable, "-m", "pip", "install", req])
toPrint = f"{green('SUC:')} the '{yellow(req)}' is installed."
logging.info(toPrint)
print(toPrint)
except subprocess.CalledProcessError as e:
toPrint = f"{red('ERR:')} the '{yellow(req)}' can't be installable. Details: {e}"
logging.info(toPrint)
print(toPrint)
# Ana programı çalıştırma kodu
mainPath = os.path.abspath(os.path.join("src", "main.py"))
try:
cmd = subprocess.Popen([sys.executable, mainPath], cwd=os.getcwd())
except Exception as e:
print(f"ERR: Failed to run the main program. Details: {e}")
logging.error(f"Failed to run the main program: {e}")
sys.exit(404)