fix pyinstaller

This commit is contained in:
Ghost 2024-03-20 10:13:08 +01:00
parent 5e119df765
commit 56e8a45d25
10 changed files with 55 additions and 19 deletions

3
.gitignore vendored
View File

@ -9,4 +9,5 @@ pyvenv.cfg
# Project specific
videos/
tmp/
debug.log
debug.log
run.exe

View File

@ -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...")

View File

@ -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'

View File

@ -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 = {}

View File

@ -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()

View File

@ -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()
return useragent.firefox

View File

@ -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

2
run.py
View File

@ -115,6 +115,8 @@ def main():
if __name__ == '__main__':
main()
while 1:
cmd_insert = input("Quit the script [yes/no]: ")

37
run.spec Normal file
View File

@ -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,
)

View File

@ -140,4 +140,6 @@ def main_upload() -> None:
)
download_and_extract_latest_commit(repository_owner, repository_name, ["config.json"])
main_upload()
main_upload()
# pyinstaller --onefile --add-data "./Src/upload/__version__.py;Src/upload" run.py