diff --git a/.github/workflows/pyinstaller.yml b/.github/workflows/pyinstaller.yml new file mode 100644 index 0000000..6f59f0b --- /dev/null +++ b/.github/workflows/pyinstaller.yml @@ -0,0 +1,54 @@ +name: PyInstaller Workflow + +on: + push: + branches: + - main + +jobs: + build: + runs-on: windows-latest + + steps: + - name: Check out repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.12.6' + + - name: Install Poetry + run: | + iex ((New-Object System.Net.WebClient).DownloadString('https://install.python-poetry.org')) + $env:PATH = "$env:USERPROFILE\.poetry\bin;$env:PATH" + + - name: Install dependencies using Poetry + run: | + poetry install --no-dev + + - name: Install PyInstaller + run: poetry add pyinstaller --dev + + - name: Define version and build with PyInstaller + run: | + $version = "1.1" + $outputName = "1blckhrt_video_generator_v$version.exe" + poetry run pyinstaller --onefile --name $outputName src\main.py + Rename-Item "dist\main.exe" $outputName + + - name: Upload PyInstaller build artifacts + uses: actions/upload-artifact@v2 + with: + name: built-application + path: dist\1blckhrt_video_generator_v1.1.exe + + - name: Create GitHub Release + id: create_release + uses: softprops/action-gh-release@v1 + with: + tag_name: v1.1 + release_name: "Release v1.1" + files: dist\1blckhrt_video_generator_v1.1.exe + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/src/main.py b/src/main.py index fe09861..50887cd 100644 --- a/src/main.py +++ b/src/main.py @@ -28,7 +28,7 @@ def browse_files(file_type: str) -> str: return filename -def ensure_16_9_aspect_ratio(image_path: str, output_path: str): +def ensure_16_9_aspect_ratio(image_path: str, output_path: str) -> str: """ Ensures the image has a 16:9 aspect ratio by resizing or padding it, and ensures both dimensions are divisible by 2. @@ -59,7 +59,7 @@ def ensure_16_9_aspect_ratio(image_path: str, output_path: str): return output_path -def ensure_even_dimensions(img): +def ensure_even_dimensions(img) -> Image: """ Ensures both width and height are divisible by 2. :param img: PIL Image object @@ -95,7 +95,7 @@ def get_output_path() -> str: return output_path -def combine_audio_image(audio_path: str, image_path: str, output_path: str): +def combine_audio_image(audio_path: str, image_path: str, output_path: str) -> None: """ Combines an image with audio to create a video using ffmpeg. :param image_path: Path to the image file @@ -134,10 +134,10 @@ def combine_audio_image(audio_path: str, image_path: str, output_path: str): messagebox.showinfo("Success", f"Output saved to: {output_path}") except subprocess.CalledProcessError as e: - messagebox.showerror("Error", f"An error occurred: {e}") + messagebox.showerror("Error", f"Please check that you have ffmpeg installed. An error occurred: {e}") -def remove_adjusted_image(image_path: str): +def remove_adjusted_image(image_path: str) -> None: """ Removes the adjusted image file if it exists. :param image_path: Path to the adjusted image file @@ -149,7 +149,7 @@ def remove_adjusted_image(image_path: str): messagebox.showerror("Error", f"An error occurred: {e}") -def main(): +def main() -> None: window = tk.Tk() window.title("(@1blckhrt) Audio and Image Merger") window.geometry("500x500") @@ -208,7 +208,7 @@ def set_image_path(): fg="white", ) - def combine_and_cleanup(): + def combine_and_cleanup() -> None: if not audio_path.get() or not image_path.get(): messagebox.showwarning("Warning", "Please select both an audio and image file.") return