diff --git a/.gitignore b/.gitignore index 7b48ef8..eec4b5e 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,5 @@ pyvenv.cfg # Project specific videos/ tmp/ -debug.log \ No newline at end of file +debug.log +run.exe \ No newline at end of file diff --git a/Src/Lib/FFmpeg/my_m3u8.py b/Src/Lib/FFmpeg/my_m3u8.py index 2d80fe5..4eaf838 100644 --- a/Src/Lib/FFmpeg/my_m3u8.py +++ b/Src/Lib/FFmpeg/my_m3u8.py @@ -303,9 +303,7 @@ class M3U8_Segments: def join(self, output_filename): """Join all segments file to a mp4 file name""" - current_dir = os.path.dirname(os.path.realpath(__file__)) - file_list_path = os.path.join(current_dir, 'file_list.txt') - + file_list_path = os.path.join('file_list.txt') ts_files = [f for f in os.listdir(self.temp_folder) if f.endswith(".ts")] def extract_number(file_name): @@ -318,7 +316,7 @@ class M3U8_Segments: with open(file_list_path, 'w') as f: for ts_file in ts_files: - relative_path = os.path.relpath(os.path.join(self.temp_folder, ts_file), current_dir) + relative_path = os.path.relpath(os.path.join(self.temp_folder, ts_file)) f.write(f"file '{relative_path}'\n") console.log("[cyan]Joining all files...") diff --git a/Src/Upload/__version__.py b/Src/Upload/__version__.py index 0448e89..3e4e8d1 100644 --- a/Src/Upload/__version__.py +++ b/Src/Upload/__version__.py @@ -1,5 +1,5 @@ __title__ = 'Streaming_community' -__version__ = 'v0.9.1' +__version__ = 'v0.9.2' __author__ = 'Ghost6446' __description__ = 'A command-line program to download film' __license__ = 'MIT License' diff --git a/Src/Upload/update.py b/Src/Upload/update.py index 42ddf69..815e837 100644 --- a/Src/Upload/update.py +++ b/Src/Upload/update.py @@ -10,7 +10,6 @@ import os, requests, time repo_name = "StreamingCommunity_api" repo_user = "ghost6446" main = os.path.abspath(os.path.dirname(__file__)) -base = "\\".join(main.split("\\")[:-1]) def get_install_version(): about = {} diff --git a/Src/Util/config.py b/Src/Util/config.py index 4963f99..c92292e 100644 --- a/Src/Util/config.py +++ b/Src/Util/config.py @@ -1,5 +1,4 @@ -import json -from pathlib import Path +import json, os class ConfigManager: def __init__(self, file_path): @@ -18,6 +17,6 @@ class ConfigManager: # Example usage: -config_path = Path(__file__).parent.parent.parent / 'config.json' +config_path = os.path.join('config.json') config_manager = ConfigManager(config_path) config = config_manager.load_config() diff --git a/Src/Util/headers.py b/Src/Util/headers.py index 9a1e915..248d3e1 100644 --- a/Src/Util/headers.py +++ b/Src/Util/headers.py @@ -1,12 +1,10 @@ # 3.12.23 -> 10.12.23 # Import -from random_user_agent.user_agent import UserAgent -from random_user_agent.params import SoftwareName, OperatingSystem +import fake_useragent + +# Variable +useragent = fake_useragent.UserAgent(use_external_data=True) def get_headers(): - software_names = [SoftwareName.CHROME.value] - operating_systems = [OperatingSystem.WINDOWS.value, OperatingSystem.LINUX.value] - user_agent_rotator = UserAgent(software_names=software_names, operating_systems=operating_systems, limit=10) - - return user_agent_rotator.get_random_user_agent() \ No newline at end of file + return useragent.firefox \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 811359c..bfbceea 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ bs4 lxml tqdm rich -random-user-agent +fake-useragent==1.1.3 ffmpeg-python cryptography==3.4.8 # Problem with new version m3u8 diff --git a/run.py b/run.py index de016dd..b59c860 100644 --- a/run.py +++ b/run.py @@ -115,6 +115,8 @@ def main(): if __name__ == '__main__': + main() + while 1: cmd_insert = input("Quit the script [yes/no]: ") diff --git a/run.spec b/run.spec new file mode 100644 index 0000000..8136f7a --- /dev/null +++ b/run.spec @@ -0,0 +1,37 @@ +# -*- mode: python ; coding: utf-8 -*- + + +a = Analysis( + ['run.py'], + pathex=[], + binaries=[], + datas=[('./Src/upload/__version__.py', 'Src/upload')], + hiddenimports=[], + hookspath=[], + hooksconfig={}, + runtime_hooks=[], + excludes=[], + noarchive=False, +) +pyz = PYZ(a.pure) + +exe = EXE( + pyz, + a.scripts, + a.binaries, + a.datas, + [], + name='run', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + upx_exclude=[], + runtime_tmpdir=None, + console=True, + disable_windowed_traceback=False, + argv_emulation=False, + target_arch=None, + codesign_identity=None, + entitlements_file=None, +) diff --git a/update.py b/update.py index 4a27619..24c2a31 100644 --- a/update.py +++ b/update.py @@ -140,4 +140,6 @@ def main_upload() -> None: ) download_and_extract_latest_commit(repository_owner, repository_name, ["config.json"]) -main_upload() \ No newline at end of file +main_upload() + +# pyinstaller --onefile --add-data "./Src/upload/__version__.py;Src/upload" run.py