A python package for programmatically reading, writing, and managing Avid Media Composer bin access history logs (`.log` files).
Project description
pybinhistory
Because pybinlog was taken™
pybinhistory reads and writes .log access log files, which accompany .avb Avid bins. It includes data validation and convenience methods, such as the ability to "touch" a bin in one command.
[!WARNING] While the
.loglog file format is a very simple one, it is officially undocumented. Use this library at your own risk -- I assume no responsibility for any damage to your project, loss of data, or reshoots being blatantly obvious in the final cut.
Convenience Methods
Touching A Bin
You can easily add an entry to the bin log with the BinLog.touch() convenience method.
from binlog import BinLog
BinLog.touch("/path/to/bin.log")
Getting The Most Recent Entry
You can obtain the most recent bin log entry with the BinLog.last_entry() convenience method.
from binlog import BinLog
print(BinLog.last_entry("/path/to/bin.log"))
This returns the most recent BinLogEntry item in the log:
BinLogEntry(timestamp=datetime.datetime(2023, 9, 22, 14, 8, 4), computer='zMichael', user='mj4u')
BinLog
A BinLog represents a... uh... bin log. It handles reading and writing to log files, and essentially encapsulates a list of BinLogEntrys.
Reading Bin Logs
A bin log can be read from a given file path with the class method BinLog.from_path()
from binlog import BinLog
log = BinLog.from_path("/path/to/bin.log")
Or, you can pass a text stream directly with the class method BinLog.from_path(). This can be helpful if you're dealing with a weird text encoding, or outputting to something other than a typical file.
from binlog import BinLog
with open("/path/to/bin.log", encoding="mac_roman", errors="replace") as log_handle:
log = BinLog.from_stream(log_handle)
Writing Bin Logs
Similar to reading, BinLog can be written to a bin log with BinLog.to_path("/path/to/bin.log") or BinLog.to_stream(textio_stream).
Creating Bin Logs
Aside from reading a bin log from a file, a new BinLog can be created directly with BinLog(), optionally passing it a list of BinLogEntrys.
Accessing BinLogEntrys
To access the BinLogEntrys in a BinLog, the BinLog object can be directly iterated over; or a list of BinLogEntrys can be retrieved via the BinLog.entries property.
BinLogEntry
A BinLog contains a list of BinLogEntry objects. BinLogEntry is really just a python dataclass with the following fields:
timestamp[datetime]: Timestamp of accesscomputer[str]: Typically the hostname of the Avid that accessed the binuser[str]: The Avid user who accessed the bin
Formatting
Although BinLog typically handles reading and writing BinLogEntrys internally, BinLogEntry can be formatted as a typical log entry string with .to_string(), or read in from a log entry string with .from_string(str).
See Also
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
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
File details
Details for the file pybinhistory-0.3.1.tar.gz.
File metadata
- Download URL: pybinhistory-0.3.1.tar.gz
- Upload date:
- Size: 17.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b88f6da3e52941cbebfc8247e5e400d737fa09348a0b8c04744225d89405567d
|
|
| MD5 |
e1d4c822d5aa66d179d9be54a6518cca
|
|
| BLAKE2b-256 |
7ad95e0cf03fe93444de24a9cfdf0e19c4cbf9caaa40c68e8157fca4c7b77459
|
Provenance
The following attestation bundles were made for pybinhistory-0.3.1.tar.gz:
Publisher:
pypi-publish.yml on mjiggidy/pybinhistory
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pybinhistory-0.3.1.tar.gz -
Subject digest:
b88f6da3e52941cbebfc8247e5e400d737fa09348a0b8c04744225d89405567d - Sigstore transparency entry: 173679161
- Sigstore integration time:
-
Permalink:
mjiggidy/pybinhistory@596affa94aa14696bf2524cebc27a4520c3e0948 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/mjiggidy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@596affa94aa14696bf2524cebc27a4520c3e0948 -
Trigger Event:
release
-
Statement type:
File details
Details for the file pybinhistory-0.3.1-py3-none-any.whl.
File metadata
- Download URL: pybinhistory-0.3.1-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8dac48fb803c0c03e1d0236683ea338e707e3030ae8467ef2c4d6021fc8e8294
|
|
| MD5 |
8afac85765e900aedbec40603e973ca6
|
|
| BLAKE2b-256 |
fd9b0bbb18578dea674bbb91dcab221f59dc7df3b2d72374b050afac5487a3c3
|
Provenance
The following attestation bundles were made for pybinhistory-0.3.1-py3-none-any.whl:
Publisher:
pypi-publish.yml on mjiggidy/pybinhistory
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pybinhistory-0.3.1-py3-none-any.whl -
Subject digest:
8dac48fb803c0c03e1d0236683ea338e707e3030ae8467ef2c4d6021fc8e8294 - Sigstore transparency entry: 173679162
- Sigstore integration time:
-
Permalink:
mjiggidy/pybinhistory@596affa94aa14696bf2524cebc27a4520c3e0948 -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/mjiggidy
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@596affa94aa14696bf2524cebc27a4520c3e0948 -
Trigger Event:
release
-
Statement type: