From 8f3047169c43836d9467228a4c7f9443f646ad4a Mon Sep 17 00:00:00 2001 From: Chris Hocking Date: Sat, 24 Jun 2023 14:11:23 +1000 Subject: [PATCH] Moved code into a Source folder - Added a `build` script using `pyinstaller`. --- Source/build.sh | 2 ++ rename-avid-mxf.py => Source/rename-avid-mxf.py | 6 ++++++ rename-avid-mxf.sh => Source/rename-avid-mxf.sh | 0 3 files changed, 8 insertions(+) create mode 100755 Source/build.sh rename rename-avid-mxf.py => Source/rename-avid-mxf.py (88%) rename rename-avid-mxf.sh => Source/rename-avid-mxf.sh (100%) diff --git a/Source/build.sh b/Source/build.sh new file mode 100755 index 0000000..c223970 --- /dev/null +++ b/Source/build.sh @@ -0,0 +1,2 @@ +#!/bin/bash +pyinstaller --onefile --add-binary='/opt/homebrew/lib/libmediainfo.dylib:.' rename-avid-mxf.py \ No newline at end of file diff --git a/rename-avid-mxf.py b/Source/rename-avid-mxf.py similarity index 88% rename from rename-avid-mxf.py rename to Source/rename-avid-mxf.py index afd4d7c..f2bf6e2 100644 --- a/rename-avid-mxf.py +++ b/Source/rename-avid-mxf.py @@ -1,7 +1,13 @@ import os import argparse +import sys from pymediainfo import MediaInfo +# If we're running as a PyInstaller binary, add the directory containing bundled +# files to the library path +if getattr(sys, 'frozen', False): + os.environ['DYLD_LIBRARY_PATH'] = sys._MEIPASS + def rename_file(path): # Retrieve media information media_info = MediaInfo.parse(path) diff --git a/rename-avid-mxf.sh b/Source/rename-avid-mxf.sh similarity index 100% rename from rename-avid-mxf.sh rename to Source/rename-avid-mxf.sh