Skip to main content

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 .log log 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", computer="avidmac", user="aviduser")

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 access
  • computer [str]: Typically the hostname of the Avid that accessed the bin
  • user [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

pybinhistory-0.3.0.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pybinhistory-0.3.0-py3-none-any.whl (18.7 kB view details)

Uploaded Python 3

File details

Details for the file pybinhistory-0.3.0.tar.gz.

File metadata

  • Download URL: pybinhistory-0.3.0.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

Hashes for pybinhistory-0.3.0.tar.gz
Algorithm Hash digest
SHA256 675af24de9b379c4d425914fb49cea2e92c5af11d42fc39bf7e1f7db677cfbe3
MD5 2a1b63f6e6bcbd8366a066a033310e34
BLAKE2b-256 6107bcdd3ee22db3bf127206128b746c221222f61cba332c930bd568a08c900a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybinhistory-0.3.0.tar.gz:

Publisher: pypi-publish.yml on mjiggidy/pybinhistory

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pybinhistory-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pybinhistory-0.3.0-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

Hashes for pybinhistory-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c587787be4e61659e36121b823d97c1d731e1f30e00e88a5e70ae58042334ce5
MD5 6e4fa7a6885abb708d9474e41962ce5f
BLAKE2b-256 8c5eb91cd11277d80e97ab8687fb50ef1c04e783ce77f3168c981a9c28b08355

See more details on using hashes here.

Provenance

The following attestation bundles were made for pybinhistory-0.3.0-py3-none-any.whl:

Publisher: pypi-publish.yml on mjiggidy/pybinhistory

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page