Skip to main content

A command line utility and library for converting DOCX and TXT files to Avid Script Files (.avc)

Project description

pyavc

pyavc is a Python library that allows you to convert DOCX or TXT files into Avid Script (.avc) files. It can be used both as a command-line tool and as a library within your Python scripts.

This project is not affiliated with Avid or Avid Media Composer, it is simply an open source helper library to make fellow AEs' lives a bit easier.

Installation

To install pyavc, you can use pip3:

pip3 install pyavc

Import Syntax

Use the following syntax to import the functionality into your Python script:

from avc.core import convert

Usage

As a Python Library

The main (and only) method provided is convert. It allows you to convert a DOCX or TXT file and save the result to a specified output directory.

convert(filepath, output_dir, output_name=None, text_width=80, font_size=12)

Parameters

  • filepath (os.Path): The path to the input DOCX or TXT file. If using a TXT file, it must be encoded as UTF-8.
  • output_dir (os.Path): The path to the output directory where the converted file will be saved.
  • output_name (str, optional): The name of the output file (without extension). If not provided, the output file will be named based on the input file name. Whether this argument is provided or not, pyavc will never overwrite existing files, but will append consecutive numbers to the end of the file name.
  • text_width (int, optional): The maximum length, in characters, before a line break is inserted. By default, it is set to 80 characters. This is done to avoid the classic issue of entire paragraphs being read as a single line.
  • font_size (int, optional): Desired display font size, in pixels. Maximum text size is 255 (not that I imagine you'll need more, but it definitely won't work if you try to make it bigger.)

Example Usage

from avc.core import convert

# Convert a TXT file and save the output
convert('/path/to/input.txt', '/path/to/output/dir')

# Convert a DOCX file and specify a custom output name
convert('/path/to/input.docx', '/path/to/output/dir', output_name='custom_name')

Command-Line Usage

pyavc can also be used from the command line to quickly convert files.

Syntax

pyavc -i <path-to-input-file> -o <path-to-output-dir> [-n <output-name>] [-t <text-width>] [-f <font-size>]

Parameters

  • -i, --input: Path to the input DOCX or TXT file.
  • -o, --output_dir: Path to the output directory where the converted file will be saved.
  • -n, --output_name: (Optional) Name of the output file (without extension). If not provided, the output file will be named based on the input file name.
  • text_width (int, optional): The maximum length, in characters, before a line break is inserted. By default, it is set to 80 characters.

Example Commands

# Convert a TXT file and save the output
pyavc -i /path/to/input.txt -o /path/to/output/dir

# Convert a DOCX file and specify a custom output name
pyavc -i /path/to/input.docx -o /path/to/output/dir -n custom_name

# Convert a DOCX file and specify a custom output name plus custom text width and font size
pyavc -i /path/to/input.docx -o /path/to/output/dir -n custom_name -t text-width -f font-size

License

This project is licensed under the GPL 3.0 License. See the LICENSE file for more details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request with any improvements or suggestions. I am but a humble assistant editor and programming is more a hobby than a profession, so I'm always open to feedback.

Some Notes

This library is still in the 'finishing touches' phase, and as always, there may be undiscovered bugs.

Acknowledgments

pyavc would not be possible without the pyavb library by markreidvfx, which provided so many useful hints. As it turns out, AVC files are constructed much like AVB files. Who would have thought?

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

pyavc-1.0.20.tar.gz (23.5 kB view details)

Uploaded Source

Built Distribution

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

pyavc-1.0.20-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file pyavc-1.0.20.tar.gz.

File metadata

  • Download URL: pyavc-1.0.20.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pyavc-1.0.20.tar.gz
Algorithm Hash digest
SHA256 0c99d610e44a4b9c8caa1f45edd7f29713fd83a14ca4d6b780e160df8e949c69
MD5 22c5e2d6279eb4f28a0cc4eef2da07bd
BLAKE2b-256 b40984f0b7985ec6edc99bd110724d40dc0a52f32c666f23afa5eb803eb3a1c1

See more details on using hashes here.

File details

Details for the file pyavc-1.0.20-py3-none-any.whl.

File metadata

  • Download URL: pyavc-1.0.20-py3-none-any.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for pyavc-1.0.20-py3-none-any.whl
Algorithm Hash digest
SHA256 243c07f1c512a4aa4d7d74135d289205a546a708d3d0606d59cb3ac1a737dc6a
MD5 d7f5a3273a1032db3db09d43f38b47fe
BLAKE2b-256 dc5d6f883afa8db1153155e64aa1e44d72ca1538591f6244fcc3743a789ee5a7

See more details on using hashes here.

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