diff --git a/StreamingCommunity/Util/headers.py b/StreamingCommunity/Util/headers.py index 80ed6f1..37ca02b 100644 --- a/StreamingCommunity/Util/headers.py +++ b/StreamingCommunity/Util/headers.py @@ -9,7 +9,7 @@ from fake_useragent import UserAgent # Variable -ua = UserAgent() +ua = UserAgent(use_external_data=True) def extract_versions(user_agent): diff --git a/StreamingCommunity/Util/os.py b/StreamingCommunity/Util/os.py index e923495..80b6c73 100644 --- a/StreamingCommunity/Util/os.py +++ b/StreamingCommunity/Util/os.py @@ -441,35 +441,36 @@ class OsSummary(): console.print(f"[cyan]Path[white]: [red]ffmpeg [bold yellow]'{ffmpeg_path}'[/bold yellow][white], [red]ffprobe '[bold yellow]{ffprobe_path}'[/bold yellow]") console.print(f"[cyan]Exe versions[white]: [bold red]ffmpeg {ffmpeg_version}, ffprobe {ffprobe_version}[/bold red]") - # Check if requirements.txt exists, if not download it - requirements_file = 'requirements.txt' - if not os.path.exists(requirements_file): - await self.download_requirements( - 'https://raw.githubusercontent.com/Lovi-0/StreamingCommunity/refs/heads/main/requirements.txt', - requirements_file - ) + # Check if requirements.txt exists, if not on pyinstaller + if not getattr(sys, 'frozen', False): + requirements_file = 'requirements.txt' + if not os.path.exists(requirements_file): + await self.download_requirements( + 'https://raw.githubusercontent.com/Lovi-0/StreamingCommunity/refs/heads/main/requirements.txt', + requirements_file + ) - # Read the optional libraries from the requirements file - optional_libraries = [line.strip() for line in open(requirements_file, 'r', encoding='utf-8-sig')] - - # Check if libraries are installed and prompt to install missing ones - for lib in optional_libraries: - installed_version = self.get_library_version(lib) + # Read the optional libraries from the requirements file + optional_libraries = [line.strip() for line in open(requirements_file, 'r', encoding='utf-8-sig')] + + # Check if libraries are installed and prompt to install missing ones + for lib in optional_libraries: + installed_version = self.get_library_version(lib) - if 'not installed' in installed_version: - - # Prompt user to install missing library using Prompt.ask() - user_response = msg.ask(f"{lib} is not installed. Do you want to install it? (yes/no)", default="y") - - if user_response.lower().strip() in ["yes", "y"]: - self.install_library(lib) + if 'not installed' in installed_version: - else: - #console.print(f"[cyan]Library[white]: [bold red]{installed_version}[/bold red]") - logging.info(f"Library: {installed_version}") - - console.print(f"[cyan]Libraries[white]: [bold red]{', '.join([self.get_library_version(lib) for lib in optional_libraries])}[/bold red]\n") - logging.info(f"Libraries: {', '.join([self.get_library_version(lib) for lib in optional_libraries])}") + # Prompt user to install missing library using Prompt.ask() + user_response = msg.ask(f"{lib} is not installed. Do you want to install it? (yes/no)", default="y") + + if user_response.lower().strip() in ["yes", "y"]: + self.install_library(lib) + + else: + #console.print(f"[cyan]Library[white]: [bold red]{installed_version}[/bold red]") + logging.info(f"Library: {installed_version}") + + console.print(f"[cyan]Libraries[white]: [bold red]{', '.join([self.get_library_version(lib) for lib in optional_libraries])}[/bold red]\n") + logging.info(f"Libraries: {', '.join([self.get_library_version(lib) for lib in optional_libraries])}") diff --git a/requirements.txt b/requirements.txt index 0be135e..73e3d77 100644 --- a/requirements.txt +++ b/requirements.txt @@ -7,7 +7,7 @@ psutil unidecode jsbeautifier pathvalidate -fake-useragent +fake-useragent=1.1.3 qbittorrent-api python-qbittorrent googlesearch-python \ No newline at end of file