diff --git a/.DS_Store b/.DS_Store index a11574a..5c2610f 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.gitignore b/.gitignore index 42a3862..f376a88 100644 --- a/.gitignore +++ b/.gitignore @@ -3,9 +3,11 @@ .venv *.mp4 *.mp3 +*.tar.gz +*.whl tts_audio lib bin include -__pycache__ -.vscode \ No newline at end of file +__pycache__/ +.vscode/ \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 7df5345..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "python.experiments.optOutFrom": [ - "pythonTerminalEnvVarActivation" - ], - "python.terminal.activateEnvironment": false -} \ No newline at end of file diff --git a/README.md b/README.md index bfcbe11..7269c08 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,13 @@ # GuideFrame A walkthrough video generation tool created for the final project module on the HDip in Computer Science SETU + +## Installation + +GuideFrame is packaged and available on pypi. It can be installed using: + +```pip install guideframe``` + +Once installed, you will need to install the non-python dependencies. A setup script is packaged with GuideFrame for this. You can simply copy it from the GuideFrame repo and run it locally or you can run the following: + +```bash $(python -c "import guideframe, os; print(os.path.join(os.path.dirname(guideframe.__file__), 'setup_env.sh'))")``` diff --git a/__pycache__/assembly.cpython-313.pyc b/__pycache__/assembly.cpython-313.pyc deleted file mode 100644 index 2094871..0000000 Binary files a/__pycache__/assembly.cpython-313.pyc and /dev/null differ diff --git a/__pycache__/audio.cpython-313.pyc b/__pycache__/audio.cpython-313.pyc deleted file mode 100644 index 8059a9c..0000000 Binary files a/__pycache__/audio.cpython-313.pyc and /dev/null differ diff --git a/__pycache__/video.cpython-313.pyc b/__pycache__/video.cpython-313.pyc deleted file mode 100644 index 7b22f3c..0000000 Binary files a/__pycache__/video.cpython-313.pyc and /dev/null differ diff --git a/guideframe/__init__.py b/guideframe/__init__.py new file mode 100644 index 0000000..d0f255e --- /dev/null +++ b/guideframe/__init__.py @@ -0,0 +1,5 @@ +from . import assembly +from . import audio +from . import selenium +from . import utils +from . import video diff --git a/guideframe_assembly.py b/guideframe/assembly.py similarity index 98% rename from guideframe_assembly.py rename to guideframe/assembly.py index 66081d5..561305a 100644 --- a/guideframe_assembly.py +++ b/guideframe/assembly.py @@ -1,7 +1,7 @@ import ffmpeg import os import uuid -from guideframe_utils import extract_script_name +from guideframe.utils import extract_script_name ''' The assembly.py file contains the functions to combine the audio and video files into a single video file diff --git a/guideframe_audio.py b/guideframe/audio.py similarity index 100% rename from guideframe_audio.py rename to guideframe/audio.py diff --git a/guideframe/scripts/install_dependencies.sh b/guideframe/scripts/install_dependencies.sh new file mode 100644 index 0000000..bd50ffd --- /dev/null +++ b/guideframe/scripts/install_dependencies.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +set -e # Exit immediately if a command exits with a non-zero status +set -x # Print each command before executing it (for debugging) + +# Update package list +sudo apt-get update + +# Install system dependencies +sudo apt-get install -y \ + ffmpeg \ + xvfb \ + chromium-driver \ + chromium-browser + +echo "Guideframe setup completed successfully!" diff --git a/guideframe_selenium.py b/guideframe/selenium.py similarity index 100% rename from guideframe_selenium.py rename to guideframe/selenium.py diff --git a/guideframe_utils.py b/guideframe/utils.py similarity index 95% rename from guideframe_utils.py rename to guideframe/utils.py index fe56cdc..e2b218c 100644 --- a/guideframe_utils.py +++ b/guideframe/utils.py @@ -1,5 +1,5 @@ -from guideframe_audio import generate_voicover -from guideframe_video import start_ffmpeg_recording, stop_ffmpeg_recording +from guideframe.audio import generate_voicover +from guideframe.video import start_ffmpeg_recording, stop_ffmpeg_recording import time import sys diff --git a/guideframe_video.py b/guideframe/video.py similarity index 100% rename from guideframe_video.py rename to guideframe/video.py diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..387f5ed --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,25 @@ +[project] +name = "guideframe" +version = "0.5.0" +description = "A tool to generate reusable software walkthrough videos via code." +authors = [ + {name = "Pat O'Connor"} +] +license = {text = "MIT"} +readme = "README.md" +requires-python = ">=3.11" +dependencies = [ + "selenium (==4.27.1)", + "ffmpeg-python (==0.2.0)", + "mutagen (==1.47.0)", + "gtts (==2.5.4)" +] + + +[build-system] +requires = ["poetry-core>=2.0.0,<3.0.0"] +build-backend = "poetry.core.masonry.api" + + +[tool.poetry] +include = ["guideframe/scripts/install_dependencies.sh"] diff --git a/selenium_demos/selenium_automation_tests.py b/selenium_demos/selenium_automation_tests.py index 8e5eec6..0422e4c 100644 --- a/selenium_demos/selenium_automation_tests.py +++ b/selenium_demos/selenium_automation_tests.py @@ -1,5 +1,5 @@ -from guideframe_selenium import * -from guideframe_utils import get_env_settings # Importing the guide_step and get_env_settings functions from guideframe_utils.py +from guideframe.selenium import * +from guideframe.utils import get_env_settings # Importing the guide_step and get_env_settings functions from guideframe_utils.py import time # Setup the driver and perform automation tests @@ -13,9 +13,13 @@ def selenium_automation_tests(): # Set window size and navigate to URL set_window_size(driver) open_url(driver, "https://magento.softwaretestingboard.com/") - - # Clicking the agree button for the privacy policy + time.sleep(2) + + ''' + # Removing this as cookie is not present in github runner environment click_button_by_span_text(driver, "AGREE") + time.sleep(2) + ''' # Click on the 'Sign In' link click_element(driver, ".authorization-link > a") @@ -74,17 +78,19 @@ def selenium_automation_tests(): # Click the "Sign Out" button click_element(driver, "a[href='https://magento.softwaretestingboard.com/customer/account/logout/']") time.sleep(2) - - # Print the success message - print("Test Passed ✅") + + print("Test Passed ✅") # Print the success message + exit_code = 0 # Set the exit code to 0 except Exception as e: # print the failure message print(f"Test Failed ❌: {str(e)}") - + exit_code = 1 # Set the exit code to 1 + raise + finally: - # Close the browser driver.quit() + exit(exit_code) # Run the automation test if __name__ == "__main__": diff --git a/selenium_demos/selenium_function_demo.py b/selenium_demos/selenium_function_demo.py index b801d54..ce11b5c 100644 --- a/selenium_demos/selenium_function_demo.py +++ b/selenium_demos/selenium_function_demo.py @@ -1,6 +1,6 @@ -from guideframe_selenium import * # Importing all functions from selenium_functions.py -from guideframe_assembly import assemble # Importing the assemble_clips function from assembly.py -from guideframe_utils import get_env_settings, guide_step # Importing the guide_step and get_env_settings functions from guideframe_utils.py +from guideframe.selenium import * # Importing all functions from selenium_functions.py +from guideframe.assembly import assemble # Importing the assemble_clips function from assembly.py +from guideframe.utils import get_env_settings, guide_step # Importing the guide_step and get_env_settings functions from guideframe_utils.py # This function will run the full script diff --git a/tutors_test.py b/tutors_test.py index e7fead1..434be80 100644 --- a/tutors_test.py +++ b/tutors_test.py @@ -1,6 +1,6 @@ -from guideframe_selenium import * # Moved all selenium functions to external file -from guideframe_assembly import assemble # Importing the assemble_clips function from assembly.py -from guideframe_utils import guide_step, get_env_settings # Importing the guide_step and get_env_settings functions from guideframe_utils.py +from guideframe.selenium import * # Moved all selenium functions to external file +from guideframe.assembly import assemble # Importing the assemble_clips function from assembly.py +from guideframe.utils import guide_step, get_env_settings # Importing the guide_step and get_env_settings functions from guideframe_utils.py '''