A package for reading and writing World of Warcraft addon TOC files.
Project description
pytoc
A Python package for reading and writing World of Warcraft addon TOC files.
Installation
You can install this package via pip.
pip install wow-pytoc
Usage
Reading a TOC file:
from pytoc import *
file_path: str = "X:/path/to/my/addon.toc"
toc = TOCFile(file_path)
print(toc.Interface)
print(toc.Title)
print(toc.LocalizedTitle["frFR"])
print(toc.AdditionalFields["X-Website"])
for file in toc.Files:
file: TOCFileEntry
print(file)
if file.Conditions:
for condition in file.Conditions:
print(condition.export())
for dep in toc.Dependencies
dep: TOCDependency
print(f"Dependency Name: {dep.Name} Required: {dep.Required}")
Writing a TOC file:
from pytoc import TOCFile
toc = TOCFile()
toc.Interface = 110000
toc.Author = "Ghost"
toc.Title = "My Addon"
toc.LocalizedTitle = {
"frFR": "Mon Addon",
}
toc.Files = [
TOCFileEntry("file1.lua"),
TOCFileEntry("file2.xml"),
TOCFileEntry("MainlineOnly.lua", [
TOCAllowLoadGameType({TOCGameType.Mainline})
]),
TOCFileEntry("PlunderstormGlueOnly.lua", [
TOCAllowLoadGameType({TOCGameType.Plunderstorm}),
TOCAllowLoadEnvironment({TOCEnvironment.Glue})
])
]
required = True
toc.add_dependency("totalRP3", required)
output = "path/to/dest.toc"
overwrite = True
toc.export(output, overwrite)
For some examples, take a look at the test_toc.py file.
Notes/Quirks
[!NOTE]
- All dependency fields will be added to the
TOCFile.Dependencieslist.- Non-standard directives (that don't start with
X-) will be added directly to theTOCFileobject, but will not be exported.- Fields will overwrite eachother if more than one of that directive is present in the TOC file, taking the last found value.
- For certain fields that accept comma-delimited input, the attribute may end up being either a
listor astr|int, depending on if there are multiple values or just a single one.- Comments and empty lines will be ignored in the current parser and will not be preserved when exporting.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wow_pytoc-0.7.0.tar.gz
(8.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
wow_pytoc-0.7.0-py3-none-any.whl
(10.3 kB
view details)
File details
Details for the file wow_pytoc-0.7.0.tar.gz.
File metadata
- Download URL: wow_pytoc-0.7.0.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
353e4ac3560dc8fecab0b9fdb109de304400c2a73c62e753e682e616a0debf02
|
|
| MD5 |
7e1590ba74a1aefddee39c89008409ca
|
|
| BLAKE2b-256 |
7789cbfa50e2ef56e1d7b263e96bb621c6128b60e30c7d4a46b75acd8a9d7720
|
File details
Details for the file wow_pytoc-0.7.0-py3-none-any.whl.
File metadata
- Download URL: wow_pytoc-0.7.0-py3-none-any.whl
- Upload date:
- Size: 10.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fc2857b51bc0a38e8f07fdd4fca8c7e33ff58a0617de3d08392f0d75d0e5f8f
|
|
| MD5 |
90b43e2d7fdd7c4e19e271d88df350fe
|
|
| BLAKE2b-256 |
d73fe370052f3cef3104fedc857f5fdefa99c0cc90f2b28f0ccb79c1204b106e
|