diff --git a/README.md b/README.md
index 3476e18..ec73843 100644
--- a/README.md
+++ b/README.md
@@ -43,10 +43,11 @@ YouTua is a GUI Program to download videos/playlists from various [supported sit
git clone https://github.com/dhhruv/YouTua.git
```
-3. Run YouTua
+3. Run setup.py
```
-python YouTua.py
+python setup.py
```
+This will install required packages and run `YouTua.py`
**You've to download [ffmpeg](https://ffmpeg.org/download.html) to run it manually.**
**OR**
@@ -65,4 +66,4 @@ python YouTua.py
One of the best features of YouTua is that you can Resume your download if it was interrupted. To resume your interrupted download, apply the same preferences of Output Folder, Format and Quality and Done. Enjoy !!
-Made with ❤ by Dhruv Panchal
\ No newline at end of file +Made with ❤ by Dhruv Panchal
diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..b992532 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +crypto +pyxattr +youtube_dl \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..d375219 --- /dev/null +++ b/setup.py @@ -0,0 +1,52 @@ +import sys +import subprocess +import os +# importing urllib.requests for internet cheking funtions +import urllib.request + +# To check if the system is connected to the internet +def connect(host='https://google.com/'): + # trying to open gfg + try: + urllib.request.urlopen(host) + return True + + # trying to catch exception when internet is not ON. + except: + return False + +# Reading package names +with open("requirements.txt",'r') as file: + package_q = file.readlines() + + for package in package_q: + # removing '\n' + package = package[:-2] + +def setup(module_name): + + # updating pip to latest version + subprocess.run('python -m pip install --upgrade pip') + + # commanding terminal to pip install required modules + p = subprocess.run('pip3 install '+module_name) + + # internet off + if(p.returncode == 1 and connect() == False): + print("error!! occured check\nInternet conection") + + # Every thing worked fine + elif(p.returncode == 0): + print("It worked", module_name, " is installed") + + # Name of module wrong + elif(p.returncode == 1 and connect() == True): + print("error!! occured check\nName of module") + +print('Installing') +print('Please wait....') +print('Do not close this program') +for package in package_q: #sending module names to the setup_a funtion + setup(package) +print('Installation finished') +subprocess.run('python YouTua.py') #to run the main.py file