This commit is contained in:
√(noham)² 2024-09-22 15:27:21 +02:00
parent f63fa6ff5c
commit 8c28b9c680
3 changed files with 30 additions and 19 deletions

View File

@ -41,20 +41,18 @@ jobs:
- name: Install Dependencies - name: Install Dependencies
run: | run: |
pip install -r requirements.txt pip install -r requirements.txt
pip install nuitka
- name: Build Executable with Nuitka - name: Build Executable with Nuitka
uses: Nuitka/Nuitka-Action@main run: |
with: python -m nuitka --onefile --assume-yes-for-downloads --output-dir=dist gofilecli.py --include-data-files=./assets/sounds/Blow_edited.wav=assets/sounds/Blow_edited.wav
nuitka-version: main
script-name: gofilecli.py
onefile: true
- name: Upload Artifact[win-x64] - name: Upload Artifact[win-x64]
uses: actions/upload-artifact@v3.1.3 uses: actions/upload-artifact@v3.1.3
with: with:
name: GoFileCLI_win-x64 name: GoFileCLI_win-x64
path: | path: |
build/gofilecli.exe dist/gofilecli.exe
build-linux-x64: build-linux-x64:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -76,23 +74,21 @@ jobs:
run: | run: |
sudo apt-get install -y libasound2-dev sudo apt-get install -y libasound2-dev
pip install -r requirements.txt pip install -r requirements.txt
pip install nuitka
- name: Build Executable with Nuitka - name: Build Executable with Nuitka
uses: Nuitka/Nuitka-Action@main run: |
with: python -m nuitka --onefile --assume-yes-for-downloads --output-dir=dist gofilecli.py --include-data-files=./assets/sounds/Blow_edited.wav=assets/sounds/Blow_edited.wav
nuitka-version: main
script-name: gofilecli.py
onefile: true
- name: Rename Executable - name: Rename Executable
run: mv build/gofilecli.bin build/gofilecli run: mv dist/gofilecli.bin dist/gofilecli
- name: Upload Artifact[linux-x64] - name: Upload Artifact[linux-x64]
uses: actions/upload-artifact@v3.1.3 uses: actions/upload-artifact@v3.1.3
with: with:
name: GoFileCLI_linux-x64 name: GoFileCLI_linux-x64
path: | path: |
build/gofilecli dist/gofilecli
build-macos: build-macos:
runs-on: macos-latest runs-on: macos-latest
@ -117,8 +113,8 @@ jobs:
- name: Build Executable with Nuitka - name: Build Executable with Nuitka
run: | run: |
python -m nuitka --onefile --assume-yes-for-downloads --output-dir=dist --macos-target-arch=arm64 gofilecli.py python -m nuitka --onefile --assume-yes-for-downloads --output-dir=dist --macos-target-arch=arm64 gofilecli.py --include-data-files=./assets/sounds/Blow_edited.wav=assets/sounds/Blow_edited.wav
python -m nuitka --onefile --assume-yes-for-downloads --output-dir=dist_x86_64 --macos-target-arch=x86_64 gofilecli.py python -m nuitka --onefile --assume-yes-for-downloads --output-dir=dist_x86_64 --macos-target-arch=x86_64 gofilecli.py --include-data-files=./assets/sounds/Blow_edited.wav=assets/sounds/Blow_edited.wav
- name: Rename Executable - name: Rename Executable
run: | run: |

View File

@ -50,8 +50,16 @@ def reqst(url, method ,headers=None, data=None, files=None, params=None, json=No
sys.exit() sys.exit()
def load_file(file_name: str) -> str:
"""
Get the correct path to a file, regardless of development or compiled mode.
"""
return os.path.join(os.path.dirname(__file__), file_name)
def play_sound(): def play_sound():
wave_obj = sa.WaveObject.from_wave_file("assets/sounds/Blow_edited.wav") sound_path = load_file("assets/sounds/Blow_edited.wav")
wave_obj = sa.WaveObject.from_wave_file(sound_path)
play_obj = wave_obj.play() play_obj = wave_obj.play()
play_obj.wait_done() play_obj.wait_done()
@ -300,8 +308,15 @@ def uploadfile(serverName, folderId, filePath, logger):
# logger.error(f"Error: {e}") # logger.error(f"Error: {e}")
# logger.debug(f"{response.text}") # logger.debug(f"{response.text}")
# response = response.json() # response = response.json()
command = f"""curl -X POST 'https://{serverName}.gofile.io/contents/uploadfile' -H "Authorization: Bearer {TOKEN}" -F "file=@{filePath}" -F "folderId={folderId}" """ command = [
response = subprocess.run(command, shell=True, capture_output=True, text=True) "curl",
"-X", "POST",
f"https://{serverName}.gofile.io/contents/uploadfile",
"-H", f"Authorization: Bearer {TOKEN}",
"-F", f"file=@{filePath}",
"-F", f"folderId={folderId}",
]
response = subprocess.run(command, capture_output=True, text=True)
try: try:
response_json = json.loads(response.stdout) response_json = json.loads(response.stdout)
except json.JSONDecodeError: except json.JSONDecodeError:

View File

@ -11,7 +11,7 @@ tag=$1
source ~/miniconda3/etc/profile.d/conda.sh source ~/miniconda3/etc/profile.d/conda.sh
conda activate 310 conda activate 310
pip install -r requirements.txt pip install -r requirements.txt
python -m nuitka --onefile --assume-yes-for-downloads --output-dir=dist --static-libpython=no gofilecli.py python -m nuitka --onefile --assume-yes-for-downloads --output-dir=dist --static-libpython=no gofilecli.py --include-data-files=./assets/sounds/Blow_edited.wav=assets/sounds/Blow_edited.wav
mv dist/gofilecli.bin ./gofilecli mv dist/gofilecli.bin ./gofilecli
mkdir -p GoFileCLI_linux-arm64 mkdir -p GoFileCLI_linux-arm64