pypsu
Installation
Use the following command to install the pypsu package with pip:
python -m pip install pypsu
Make sure the local bin path is in your path. If not, add it to ~/.bashrc or ~/.zshrc:
export PATH="$HOME/.local/bin:$PATH"
Usage
usage: psu [-h] [-v] {interactive,i,list,l,ls,create,c,import,im,export,e,rename,r,delete,d,del,rm} ...
Manipulate PS2 PSU game save files.
optional arguments:
-h, --help show this help message and exit
-v, --version show program's version number and exit
Commands:
{interactive,i,list,l,ls,create,c,import,im,export,e,rename,r,delete,d,del,rm}
interactive (i) Interactive command prompt.
list (l, ls) List the files and directories within the game save.
create (c) Create a PSU game save file.
import (im) Import a file from the local disk to the game save.
export (e) Export a file from the game save to the local disk.
rename (r) Rename a file within the game save.
delete (d, del, rm)
Delete a file from within the game save.
List files
└─$ psu list BASCUS-97129.psu
total 9
d Dec 23 2022 0 BASCUS-97129
d Dec 23 2022 0 .
d Dec 23 2022 0 ..
- Dec 23 2022 964 icon.sys
- Dec 23 2022 44376 bkmo1.ico
- Dec 23 2022 44376 bkmo2.ico
- Dec 23 2022 44376 bkmo3.ico
- Dec 23 2022 3460 BASCUS-97129
- Dec 23 2022 3460 bkmo0.dat
Create PSU
└─$ psu create BASCUS-97129.psu
[+] PSU file "BASCUS-97129.psu" saved
Import file into PSU
└─$ psu import BASCUS-97129.psu bkmo0.dat
[+] bkmo0.dat imported to bkmo0.dat
Export file from PSU
└─$ psu export BASCUS-97129.psu bkmo0.dat
[+] bkmo0.dat exported to bkmo0.dat
Rename file in PSU
└─$ psu rename BASCUS-97129.psu bkmo0.dat bkmo1.dat
[+] bkmo0.dat renamed to bkmo1.dat
Delete file in PSU
└─$ psu delete BASCUS-97129.psu bkmo0.dat
[+] bkmo0.dat deleted
Interactive mode
└─$ psu interactive BASCUS-97129.psu
# list
total 9
d Dec 23 2022 0 BASCUS-97129
d Dec 23 2022 0 .
d Dec 23 2022 0 ..
- Dec 23 2022 964 icon.sys
- Dec 23 2022 44376 bkmo1.ico
- Dec 23 2022 44376 bkmo2.ico
- Dec 23 2022 44376 bkmo3.ico
- Dec 23 2022 3460 BASCUS-97129
- Dec 23 2022 3460 bkmo0.dat
# export bkmo0.dat
[+] bkmo0.dat exported to bkmo0.dat
# import bkmo1.dat
[+] bkmo1.dat imported to bkmo1.dat
# rename bkmo3.ico bkmo4.ico
[+] bkmo3.ico renamed to bkmo4.ico
# list
total 10
d Dec 23 2022 0 BASCUS-97129
d Dec 23 2022 0 .
d Dec 23 2022 0 ..
- Dec 23 2022 964 icon.sys
- Dec 23 2022 44376 bkmo1.ico
- Dec 23 2022 44376 bkmo2.ico
- Dec 23 2022 44376 bkmo4.ico
- Dec 23 2022 3460 BASCUS-97129
- Dec 23 2022 3460 bkmo0.dat
- Jan 27 20:26 3460 bkmo1.dat
# exit
API
PSU
Create a new file
psu = PSU.create('BASCUS-97129.psu')
psu.write('hello.txt', 'Hello World')
psu.save()
Read an existing file
psu = PSU.load('BASCUS-97129.psu')
print(psu.read('hello.txt').decode('UTF-8'))
Update an existing file
psu = PSU.load('BASCUS-97129.psu')
print(psu.read('hello.txt').decode('UTF-8'))
psu.write('hello.txt', 'Hello World New')
psu.save()
Import an existing file
psu = PSU.load('BASCUS-97129.psu')
psu.copy('/tmp/hello.txt', 'hello.txt')
psu.save()
Export an existing file
psu = PSU.load('BASCUS-97129.psu')
psu.export('hello.txt', '/tmp/hello.txt')
psu.save()
Remove an existing file
psu = PSU.load('BASCUS-97129.psu')
psu.delete('hello.txt')
psu.save()
Check if an entry exists by name
psu = PSU.load('BASCUS-97129.psu')
if psu.has('hello.txt'):
print('hello.txt exists in BASCUS-97129.psu')
else:
print('hello.txt does not exist in BASCUS-97129.psu')
Get an entry by name
psu = PSU.load('BASCUS-97129.psu')
entry = psu.get('hello.txt')
print(entry)
Check if an entry is a file
psu = PSU.load('BASCUS-97129.psu')
if psu.isFile('hello.txt'):
print('hello.txt is a file')
else:
print('hello.txt is not a file')
Check if an entry is a directory
psu = PSU.load('BASCUS-97129.psu')
if psu.isDirectory('.'):
print('. is a file')
else:
print('. is not a file')
Get a list of files / directories
psu = PSU.load('BASCUS-97129.psu')
for entry in psu.list():
if entry.isFile():
print(f'FILE: {entry.name: <16} ({entry.header.size} bytes)')
continue
if entry.isDirectory():
print(f' DIR: {entry.name: <16} ({entry.header.size} entries)')
continue
Reference
Metadata
Release files for pypsu 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pypsu-0.1.2.tar.gz | 11.6 kB | Without provenance | Details for pypsu-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pypsu-0.1.2-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details for pypsu-0.1.2-py2.py3-none-any.whl |
Total release size: 23.0 kB
Release files / pypsu-0.1.2.tar.gz
| Download URL | pypsu-0.1.2.tar.gz |
|---|---|
| Size | 11.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c6b74a191cb3ca8aa564f0a71a0ccec4368c3364c90b1651e3b51e7596751393
|
|
BLAKE2b-256 checksum How to use checksums |
2bd319c018bbf4af8226c937b8ad62569eaeaf1c992fda68e50df29235a39d05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.10
|
Release files / pypsu-0.1.2-py2.py3-none-any.whl
| Download URL | pypsu-0.1.2-py2.py3-none-any.whl |
|---|---|
| Size | 11.5 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
8a2e1089334d6c3230cbd6255dd5c553eee6fe85b77e5234ac20cf46f1d42023
|
|
BLAKE2b-256 checksum How to use checksums |
9cbb7d523ad4b0610d5886085cb3b5a6359dc8507a8cf7426dcd5e0446aa644d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.10
|
Security for pypsu 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.