logi-26 / psio-assist

Python scripts to format PlayStation 1 bin/cue files for use with PSIO
GNU General Public License v3.0
4 stars 0 forks source link

Make package with pyinstalller so user just have executable file and don´t have to install python #4

Open madocter opened 3 weeks ago

madocter commented 3 weeks ago

I would make an executable file with pyinstaller, what do you think ?

Instructions for Linux

Install pyinstaller: pip install pyinstaller

Launch for first time pyinstaller: python3 -m PyInstaller --onefile --windowed --add-binary "/usr/lib/x86_64-linux-gnu/libpython3.10.so.1.0:." psio_assist.py

Add shared libraries to avoid errors: --add-binary "/usr/lib/x86_64-linux-gnu/libpython3.10.so.1.0:."

Now you will have file: psio_assist.spec

And in Dist directory the executable file but will not be able to run because hidden imports

Open and edit the file named: psio_assist.spec and add:

(This doesn't work, don't do it)

Example:

a = Analysis( ['psio_assist.py'], pathex=[], binaries=[('/usr/lib/x86_64-linux-gnu/libpython3.10.so.1.0', '.')], datas=[], hiddenimports=['PIL._tkinter_finder', 'PIL.ImageTk'], hookspath=[], hooksconfig={}, runtime_hooks=[], excludes=[], noarchive=False, optimize=0, ) pyz = PYZ(a.pure)

exe = EXE( pyz, a.scripts, a.binaries, a.datas, [], name='psio_assist', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, upx_exclude=[], runtime_tmpdir=None, console=False, disable_windowed_traceback=False, argv_emulation=False, target_arch=None, codesign_identity=None, entitlements_file=None, )

Save and launch pyinstaller but this time to operate with the spec file:

python3 -m PyInstaller psio_assist.spec

Copy data directory from src and config file and put in same place than the psio_assist file in dist directory.

Now you have the executable file for LINUX, and do not need python or any dependency to execute it.

Executable for Linux: https://easyupload.io/1bmq2e

Instructions for windows:

pip install pyinstaller python -m PyInstaller --onefile --windowed psio_assist.py Copy data directory from src and config file and put in same place than the psio_assist file in dist directory.

Now you have the executable file for Windows, and do not need python or any dependency to execute it.

Executable for Windows 7 x64: https://easyupload.io/l2w1w5

luizbissoni commented 3 weeks ago

Thank you very much for sharing.

I followed the step-by-step instructions on Windows 11, and I was able to execute it, but when I select the folder with the .cue and .bin files and click on 'scan,' it keeps loading indefinitely, and nothing happens.

madocter commented 3 weeks ago

Thank you very much for sharing.

I followed the step-by-step instructions on Windows 11, and I was able to execute it, but when I select the folder with the .cue and .bin files and click on 'scan,' it keeps loading indefinitely, and nothing happens.

Yes I think this is kinda crap :D ... will have to make a program myself with Java that doesn't have all these issues.

Test with windows 7 and python 3.8 :

cue_sheet file_name: Blam! Machinehead (Europe).cue cue_sheet file_path: F:/xstation/01 CATEGORIAS/ACCION/Blam! Machinehead (Europe) \Blam! Machinehead (Europe).cue cue_sheet game_name: Blam! Machinehead (Europe) Exception in Tkinter callback Traceback (most recent call last): File "D:\K5\APPDATA\Local\Programs\Python\Python38\lib\tkinter__init.py", l ine 1883, in call return self.func(*args) File "psio_assist.py", line 615, in _scan_button_clicked _parse_game_list() File "psio_assist.py", line 459, in _parse_game_list _create_game_list(src_path.get()) File "psio_assist.py", line 424, in _create_game_list _print_game_details(the_game) File "psio_assist.py", line 448, in _print_game_details print(f('number of bin files: {len(bin_files)}')) File "D:\K5\APPDATA\Local\Programs\Python\Python38\lib\site-packages\fstring\f string.py", line 103, in str__ return self.cached_origin File "D:\K5\APPDATA\Local\Programs\Python\Python38\lib\functools.py", line 966 , in get val = self.func(instance) File "D:\K5\APPDATA\Local\Programs\Python\Python38\lib\site-packages\fstring\f string.py", line 45, in cached_origin return self.fstringify() File "D:\K5\APPDATA\Local\Programs\Python\Python38\lib\site-packages\fstring\f string.py", line 91, in fstringify value = eval(indicator, None, frame) # pylint: disable=eval-used File "", line 1, in NameError: name 'bin_files' is not defined


With Linux and Python 3.11.0 the same result than you, keeps loading with not any error in the console, but is because I selected the directory where is the game itself:

image

You need to pick upper directory:

image

So instead of: /media/K7/B416-BA22/blam just set /media/K7/B416-BA22/

luizbissoni commented 3 weeks ago

You can use psio-helper, it's very easy and practical to use.

madocter commented 3 weeks ago

You can use psio-helper, it's very easy and practical to use.

Thanks a lot , I guess this info should be in PSIO website because their tool is manual one by one not in batch like those.

So to make this software working the directory structure must be:

madocter commented 1 week ago

You can use psio-helper, it's very easy and practical to use.

Yeah the other is far better, but could only found 1 multidisc but I can done by hand this one is really crap haha:

bgerror failed to handle background error.
    Original error: can't invoke "winfo" command: application has been destroyed
    Error in bgerror: can't invoke "tk" command: application has been destroyed
Exception in Tkinter callback
Traceback (most recent call last):
  File "/usr/lib/python3.10/tkinter/__init__.py", line 1921, in __call__
    return self.func(*args)
  File "/home/Documents/PROGRAMS/psio-assist-0.2/src/psio_assist.py", line 610, in _scan_button_clicked
    _parse_game_list()
  File "/home/Documents/PROGRAMS/psio-assist-0.2/src/psio_assist.py", line 454, in _parse_game_list
    _create_game_list(src_path.get())
  File "/home/Documents/PROGRAMS/psio-assist-0.2/src/psio_assist.py", line 382, in _create_game_list
    cue_sheets = [f for f in listdir(game_directory_path) if f.lower().endswith('.cue') and not f.startswith('.')]
FileNotFoundError: [Errno 2] No such file or directory: '/media/482B-BFA9/ps12/A Sangre Fria (Spain) (Disc 1)'

Is really bad software, last time it could scan but who knows.

madocter commented 1 week ago

You can use psio-helper, it's very easy and practical to use.

That program is not working well neither :D ...

https://github.com/ncirocco/psio-helper/issues/1

I will have to create one robust and working program myself I believe or do the conversion by hand one by one