# pypsu
## Installation
Use the following command to install the pypsu package with pip:
~~~sh
python -m pip install pypsu
~~~
Make sure the local bin path is in your path. If not, add it to `~/.bashrc` or `~/.zshrc`:
~~~sh
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
~~~py
psu = PSU.create('BASCUS-97129.psu')
psu.write('hello.txt', 'Hello World')
psu.save()
~~~
#### Read an existing file
~~~py
psu = PSU.load('BASCUS-97129.psu')
print(psu.read('hello.txt').decode('UTF-8'))
~~~
#### Update an existing file
~~~py
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
~~~py
psu = PSU.load('BASCUS-97129.psu')
psu.copy('/tmp/hello.txt', 'hello.txt')
psu.save()
~~~
#### Export an existing file
~~~py
psu = PSU.load('BASCUS-97129.psu')
psu.export('hello.txt', '/tmp/hello.txt')
psu.save()
~~~
#### Remove an existing file
~~~py
psu = PSU.load('BASCUS-97129.psu')
psu.delete('hello.txt')
psu.save()
~~~
#### Check if an entry exists by name
~~~py
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
~~~py
psu = PSU.load('BASCUS-97129.psu')
entry = psu.get('hello.txt')
print(entry)
~~~
#### Check if an entry is a file
~~~py
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
~~~py
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
~~~py
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
* <https://ps2savetools.com/documents/ps2-save-game-format-for-ems-adapter-psu/>
Raw data
{
"_id": null,
"home_page": "https://github.com/McCaulay/pypsu",
"name": "pypsu",
"maintainer": "McCaulay Hudson",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "ps2 gamesave psu",
"author": "McCaulay Hudson",
"author_email": "mccaulayhudson@protonmail.com",
"download_url": "https://files.pythonhosted.org/packages/2b/d3/19c018bbf4af8226c937b8ad62569eaeaf1c992fda68e50df29235a39d05/pypsu-0.1.2.tar.gz",
"platform": "Unix",
"description": "# pypsu\n\n## Installation\n\nUse the following command to install the pypsu package with pip:\n\n~~~sh\npython -m pip install pypsu\n~~~\n\nMake sure the local bin path is in your path. If not, add it to `~/.bashrc` or `~/.zshrc`:\n\n~~~sh\nexport PATH=\"$HOME/.local/bin:$PATH\"\n~~~\n\n## Usage\n~~~\nusage: psu [-h] [-v] {interactive,i,list,l,ls,create,c,import,im,export,e,rename,r,delete,d,del,rm} ...\n\nManipulate PS2 PSU game save files.\n\noptional arguments:\n -h, --help show this help message and exit\n -v, --version show program's version number and exit\n\nCommands:\n {interactive,i,list,l,ls,create,c,import,im,export,e,rename,r,delete,d,del,rm}\n interactive (i) Interactive command prompt.\n list (l, ls) List the files and directories within the game save.\n create (c) Create a PSU game save file.\n import (im) Import a file from the local disk to the game save.\n export (e) Export a file from the game save to the local disk.\n rename (r) Rename a file within the game save.\n delete (d, del, rm)\n Delete a file from within the game save.\n~~~\n\n### List files\n~~~\n\u2514\u2500$ psu list BASCUS-97129.psu\ntotal 9\nd Dec 23 2022 0 BASCUS-97129\nd Dec 23 2022 0 .\nd Dec 23 2022 0 ..\n- Dec 23 2022 964 icon.sys\n- Dec 23 2022 44376 bkmo1.ico\n- Dec 23 2022 44376 bkmo2.ico\n- Dec 23 2022 44376 bkmo3.ico\n- Dec 23 2022 3460 BASCUS-97129\n- Dec 23 2022 3460 bkmo0.dat\n~~~\n\n### Create PSU\n~~~\n\u2514\u2500$ psu create BASCUS-97129.psu\n[+] PSU file \"BASCUS-97129.psu\" saved\n~~~\n\n### Import file into PSU\n~~~\n\u2514\u2500$ psu import BASCUS-97129.psu bkmo0.dat\n[+] bkmo0.dat imported to bkmo0.dat\n~~~\n\n### Export file from PSU\n~~~\n\u2514\u2500$ psu export BASCUS-97129.psu bkmo0.dat\n[+] bkmo0.dat exported to bkmo0.dat\n~~~\n\n### Rename file in PSU\n~~~\n\u2514\u2500$ psu rename BASCUS-97129.psu bkmo0.dat bkmo1.dat\n[+] bkmo0.dat renamed to bkmo1.dat\n~~~\n\n### Delete file in PSU\n~~~\n\u2514\u2500$ psu delete BASCUS-97129.psu bkmo0.dat \n[+] bkmo0.dat deleted\n~~~\n\n### Interactive mode\n~~~\n\u2514\u2500$ psu interactive BASCUS-97129.psu\n# list\ntotal 9\nd Dec 23 2022 0 BASCUS-97129\nd Dec 23 2022 0 .\nd Dec 23 2022 0 ..\n- Dec 23 2022 964 icon.sys \n- Dec 23 2022 44376 bkmo1.ico \n- Dec 23 2022 44376 bkmo2.ico \n- Dec 23 2022 44376 bkmo3.ico \n- Dec 23 2022 3460 BASCUS-97129 \n- Dec 23 2022 3460 bkmo0.dat \n\n# export bkmo0.dat\n[+] bkmo0.dat exported to bkmo0.dat\n# import bkmo1.dat\n[+] bkmo1.dat imported to bkmo1.dat\n# rename bkmo3.ico bkmo4.ico\n[+] bkmo3.ico renamed to bkmo4.ico\n# list\ntotal 10\nd Dec 23 2022 0 BASCUS-97129\nd Dec 23 2022 0 .\nd Dec 23 2022 0 ..\n- Dec 23 2022 964 icon.sys \n- Dec 23 2022 44376 bkmo1.ico \n- Dec 23 2022 44376 bkmo2.ico \n- Dec 23 2022 44376 bkmo4.ico \n- Dec 23 2022 3460 BASCUS-97129 \n- Dec 23 2022 3460 bkmo0.dat \n- Jan 27 20:26 3460 bkmo1.dat \n\n# exit\n~~~\n\n## API\n### PSU\n#### Create a new file\n~~~py\npsu = PSU.create('BASCUS-97129.psu')\npsu.write('hello.txt', 'Hello World')\npsu.save()\n~~~\n\n#### Read an existing file\n~~~py\npsu = PSU.load('BASCUS-97129.psu')\nprint(psu.read('hello.txt').decode('UTF-8'))\n~~~\n\n#### Update an existing file\n~~~py\npsu = PSU.load('BASCUS-97129.psu')\nprint(psu.read('hello.txt').decode('UTF-8'))\npsu.write('hello.txt', 'Hello World New')\npsu.save()\n~~~\n\n#### Import an existing file\n~~~py\npsu = PSU.load('BASCUS-97129.psu')\npsu.copy('/tmp/hello.txt', 'hello.txt')\npsu.save()\n~~~\n\n#### Export an existing file\n~~~py\npsu = PSU.load('BASCUS-97129.psu')\npsu.export('hello.txt', '/tmp/hello.txt')\npsu.save()\n~~~\n\n#### Remove an existing file\n~~~py\npsu = PSU.load('BASCUS-97129.psu')\npsu.delete('hello.txt')\npsu.save()\n~~~\n\n#### Check if an entry exists by name\n~~~py\npsu = PSU.load('BASCUS-97129.psu')\nif psu.has('hello.txt'):\n print('hello.txt exists in BASCUS-97129.psu')\nelse:\n print('hello.txt does not exist in BASCUS-97129.psu')\n~~~\n\n#### Get an entry by name\n~~~py\npsu = PSU.load('BASCUS-97129.psu')\nentry = psu.get('hello.txt')\nprint(entry)\n~~~\n\n#### Check if an entry is a file\n~~~py\npsu = PSU.load('BASCUS-97129.psu')\nif psu.isFile('hello.txt'):\n print('hello.txt is a file')\nelse:\n print('hello.txt is not a file')\n~~~\n\n#### Check if an entry is a directory\n~~~py\npsu = PSU.load('BASCUS-97129.psu')\nif psu.isDirectory('.'):\n print('. is a file')\nelse:\n print('. is not a file')\n~~~\n\n#### Get a list of files / directories\n~~~py\npsu = PSU.load('BASCUS-97129.psu')\nfor entry in psu.list():\n if entry.isFile():\n print(f'FILE: {entry.name: <16} ({entry.header.size} bytes)')\n continue\n if entry.isDirectory():\n print(f' DIR: {entry.name: <16} ({entry.header.size} entries)')\n continue\n~~~\n\n## Reference\n* <https://ps2savetools.com/documents/ps2-save-game-format-for-ems-adapter-psu/>\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Library for analyzing and creating PS2 PSU game save files",
"version": "0.1.2",
"split_keywords": [
"ps2",
"gamesave",
"psu"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9cbb7d523ad4b0610d5886085cb3b5a6359dc8507a8cf7426dcd5e0446aa644d",
"md5": "2ff7252f47be1aed3eaa47466beddde0",
"sha256": "8a2e1089334d6c3230cbd6255dd5c553eee6fe85b77e5234ac20cf46f1d42023"
},
"downloads": -1,
"filename": "pypsu-0.1.2-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "2ff7252f47be1aed3eaa47466beddde0",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 11452,
"upload_time": "2023-01-29T11:10:16",
"upload_time_iso_8601": "2023-01-29T11:10:16.468451Z",
"url": "https://files.pythonhosted.org/packages/9c/bb/7d523ad4b0610d5886085cb3b5a6359dc8507a8cf7426dcd5e0446aa644d/pypsu-0.1.2-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2bd319c018bbf4af8226c937b8ad62569eaeaf1c992fda68e50df29235a39d05",
"md5": "7c37f0f2cb95401dffc7fc84d4f2823c",
"sha256": "c6b74a191cb3ca8aa564f0a71a0ccec4368c3364c90b1651e3b51e7596751393"
},
"downloads": -1,
"filename": "pypsu-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "7c37f0f2cb95401dffc7fc84d4f2823c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 11551,
"upload_time": "2023-01-29T11:10:18",
"upload_time_iso_8601": "2023-01-29T11:10:18.107404Z",
"url": "https://files.pythonhosted.org/packages/2b/d3/19c018bbf4af8226c937b8ad62569eaeaf1c992fda68e50df29235a39d05/pypsu-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-29 11:10:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "McCaulay",
"github_project": "pypsu",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pypsu"
}