polytaxis-python
is a reference python library for interacting with files with a polytaxis header. It also provides the command line utility ptmod
for manipulate polytaxis headers.
Requires Python 3.
Run pip install git+https://github.com/Rendaw/polytaxis-python
.
Run ptmod -h
.
Note: All tags are specified in the format {tagname: set([value or None])}
. The set
contains all values, and None
for value-less tags.
Example: author=rendaw
would be specified by {'author': set(['rendaw'])}
.
Example 2: top_secret
would be specified by {'top_secret': set([None])}
.
Encodes an individual tag. value
may be None.
Encodes multiple tags, as in the tag block in the header. tags
must be a dict with string keys of string/None sets.
Decodes a string, as in the tag block in the header. Returns a dict of tags (see encode_tags
for the structure).
Adds a polytaxis header to opened file
at the current cursor location (make sure the cursor is at the beginning of the file), with the tags tags
(or raw_tags
if you've already encoded your tags).
If unsized
, writes the tags in an unsized header. If not unsized
, minimize
will only allocate enough header space for the specified tags
/raw_tags
.
tags
must be in the format described in encode_tags
.
Returns a dict (see encode_tags
) of tags in filename
if it has a polytaxis header, otherwise None
.
Removes the polytaxis header from filename
.
Adds a polytaxis header if missing, or updates the polytaxis header otherwise. See write_tags
for an explanation of the parameters.
This can convert between unsized and sized headers if unsized
is specified.
Seeks file
to the beginning of the polytaxis header.
Seeks file
to the end of the polytaxis header.
A template script to modify file tags
Ask questions and raise issues on the GitHub issue tracker.
See Contributing below for information about prioritizing issues.
-
Develop and submit pull requests.
-
Fund development via https://www.bountysource.com/