https://github.com/krwclassic/ptpl-cli-transcoder
PTPL File content viewer, see the insights of PTPL files created by MCreator
https://github.com/krwclassic/ptpl-cli-transcoder
cli decoder file mcreator mcree minecraft ptpl python python3 tool xml
Last synced: over 1 year ago
JSON representation
PTPL File content viewer, see the insights of PTPL files created by MCreator
- Host: GitHub
- URL: https://github.com/krwclassic/ptpl-cli-transcoder
- Owner: KRWCLASSIC
- Created: 2025-01-04T01:00:02.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-04T16:41:31.000Z (over 1 year ago)
- Last Synced: 2025-02-11T02:03:11.582Z (over 1 year ago)
- Topics: cli, decoder, file, mcreator, mcree, minecraft, ptpl, python, python3, tool, xml
- Language: Python
- Homepage: https://pypi.org/project/ptpl-transcoder/
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# `PTPL` CLI Transcoder
## Overview
The `PTPL` CLI Transcoder is a command-line tool designed to decode `.ptpl` files into `.xml` and encode `.xml` files back into `.ptpl` format. This tool is designed for working with PTPL files generated by the MCreator program.
## How it Works
### Decoding
When decoding, the tool:
1. Reads the `.ptpl` file as a gzip-compressed archive.
2. Extracts and decodes the base64-encoded XML content.
3. Formats the XML for readability.
4. Outputs the result to the console or saves it to a specified file.
### Encoding
When encoding, the tool:
1. Reads the XML file.
2. Encodes the content into base64.
3. Compresses the encoded data using gzip.
4. Outputs the result to a `.ptpl` file.
## Usage
Run the `transcoder.py` script with the following syntax:
```bash
python transcoder.py [-d | -e] [--output ] [--verbose]
```
Or download `ptpl-transcoder` package from PyPI!
```bash
pip install ptpl-transcoder
```
And replace `python transcoder.py` in commands with `ptpl-transcoder`!
### Arguments
- `-d`, `--decode`: Decode a `.ptpl` file into XML.
- `-e`, `--encode`: Encode an XML file into `.ptpl` format.
- ``: The path to the input file. Use a `.ptpl` file for decoding or an XML file for encoding.
- `--output`, `-o`: (Optional for decoding) Specify the path to save the output file. If not provided, decoded XML content is printed to the console.
- `--verbose`, `-v`: (Optional) Enable verbose output for detailed processing information.
## Examples
### Decode a `.ptpl` File
To decode a `.ptpl` file and print the result:
```bash
python transcoder.py -d example.ptpl
```
To decode a `.ptpl` file and save the XML to `output.xml`:
```bash
python transcoder.py -d example.ptpl -o output.xml
```
### Encode an XML File
To encode an XML file and save the `.ptpl` to `output.ptpl`:
```bash
python transcoder.py -e example.xml -o output.ptpl
```
## Notice
> **This tool is intended for use in the PTPL Editor project. PTPL files are generated by the MCreator program.**
## Requirements
- Python 3.x
- Required libraries:
- `argparse`
- `base64`
- `gzip`
- `lxml`