Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added setup.py #9

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.**<br>
**OR**<br>
Expand All @@ -65,4 +66,4 @@ python YouTua.py

<p align='center'><i>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 !!</i></p>

<p align='center'><b>Made with ❤ by Dhruv Panchal</b></p>
<p align='center'><b>Made with ❤ by Dhruv Panchal</b></p>
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
crypto
pyxattr
youtube_dl
52 changes: 52 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -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