Skip to content

Commit

Permalink
Merge pull request #6 from ArchLinuxAddict/main
Browse files Browse the repository at this point in the history
Ok check and merge make sure to change if any error
  • Loading branch information
furjac authored Jun 2, 2024
2 parents 807439b + e48f1f3 commit 0e2779d
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 6 deletions.
9 changes: 9 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
requests
chromedriver-autoinstaller
pyfiglet
fake-useragent
selenium
pillow
BeautifulSoup4
colorama
qbittorrent-api
3 changes: 1 addition & 2 deletions src/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ def extract(url, proxy):
options.add_experimental_option(
"excludeSwitches", ["enable-logging"])
options.add_argument("--log-level=3")
options.add_experimental_option("detach", True)

driver = webdriver.Chrome(options=options)
driver.set_script_timeout(30)
Expand All @@ -52,4 +51,4 @@ def extract(url, proxy):
f.close()

driver.quit()
raise SystemExit
raise SystemExit
31 changes: 27 additions & 4 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,12 @@
import tempfile
import time
import warnings
system_name = platform.system()
if system_name == "Windows":
import winreg
import zipfile
import socketserver
import random
import string
import http.server
import threading
import requests
from extractor import extract
import webbrowser
import socket
Expand Down Expand Up @@ -1185,8 +1181,35 @@ def server_selection_menu(self):
print(
Fore.RED + self.translator.translate("server_selection_error") + Style.RESET_ALL)
self.server_selection_menu()

def is_admin_or_sudo():
"""
Check if the script is running with administrative privileges (Windows)
or sudo privileges (Linux).
"""
system = platform.system()

if system == 'Windows':
# Check for admin privileges on Windows
try:
import ctypes
return ctypes.windll.shell32.IsUserAnAdmin() != 0
except Exception as e:
print(f"Error checking admin status on Windows: {e}")
return False

elif system == 'Linux':
# Check for sudo privileges on Linux
return os.geteuid() == 0

else:
raise NotImplementedError(f"Unsupported operating system: {system}")

if __name__ == "__main__":
if not Movies.is_admin_or_sudo():
print('Plz run the software as admin')
input('press enter to continue....')
raise SystemExit
locale = input('Enter your language code [eg. en, ru]: ')
movie_instance = Movies(language=locale)
movie_instance.setup_signal_handling()
Expand Down

0 comments on commit 0e2779d

Please sign in to comment.