Skip to main content

VIV/BIG decoder/encoder

Project description

unvivtool - Python extension module

unvivtool is a VIV/BIG decoder/encoder for uncompressed BIGF, BIGH, and BIG4 archives.

Purported VIV/BIG archives sometimes contain faulty or manipulated header information. unvivtool is designed to validate and recover data as much as possible.

This file describes installation and usage of unvivtool as Python extension module.

Usage

A ready to use decoder/encoder script can be found here: https://github.com/bfut/unvivtool/blob/main/scripts/unvivtool_script.py

Installation

Requires Python 3.9+

   python -m pip install unvivtool

Documentation

Help on module unvivtool:

NAME
    unvivtool - VIV/BIG decoding/encoding

DESCRIPTION
    Functions
    ---------
    unviv() -- decode and extract VIV/BIG archive
    viv() -- encode files in new VIV/BIG archive

    unvivtool 1.19 Copyright (C) 2020-2024 Benjamin Futasz (GPLv3+)

FUNCTIONS
    unviv(...)
        |  unviv(viv, dir, direnlen=0, fileidx=None, filename=None, fnhex=False, dry=False, verbose=False, overwrite=0)
        |      Decode and extract archive. Accepts BIGF, BIGH, and BIG4.
        |
        |      Parameters
        |      ----------
        |      viv : str, os.PathLike object
        |          Absolute or relative, path/to/archive.viv
        |      dir : str, os.PathLike object
        |          Absolute or relative, path/to/existing/output/directory
        |      direnlen : int, optional
        |          If >= 10, set as fixed archive directory entry length.
        |      fileidx : int, optional
        |          Extract file at given 1-based index.
        |      filename : str, optional
        |          Extract file 'filename' (cAse-sEnsitivE) from archive.
        |          Overrides the fileidx parameter.
        |      fnhex : bool, optional
        |          If True, encode filenames to Base16/hexadecimal.
        |          Use for non-printable filenames in archive. Keeps
        |          leading/embedding null bytes.
        |      dry : bool, optional
        |          If True, perform dry run: run all format checks and print
        |          archive contents, do not write to disk.
        |      verbose : bool, optional
        |          Verbose output.
        |      overwrite : int, optional
        |          If == 0, warns and attempts overwriting existing files. (default)
        |          If == 1, attempts renaming existing files, skips on failure.
        |
        |      Returns
        |      -------
        |      {0, 1}
        |          1 on success.
        |
        |      Raises
        |      ------
        |      FileNotFoundError
        |          When 'viv' cannot be opened.
        |
        |      Examples
        |      --------
        |      Extract all files in "car.viv" in the current working directory
        |      to existing subdirectory "car_viv".
        |
        |      >>> unvivtool.unviv("car.viv", "car_viv")
        |      ...
        |      1
        |
        |      Before extracting, check the archive contents and whether it
        |      passes format checks.
        |
        |      >>> unvivtool.unviv("car.viv", "car_viv", dry=True)
        |      Begin dry run
        |      ...
        |
        |      Now that archive contents have been printed, extract file at
        |      1-based index 2. Again print archive contents while extracting.
        |
        |      >>> unvivtool.unviv("car.viv", "car_viv", fileidx=2, verbose=True)
        |      ...
        |
        |      Next, extract file "car00.tga" from another archive. File
        |      "bar.viv" sits in subdirectory "foo" of the current working
        |      directory. This time, contents should be extracted to the current
        |      working directory.
        |
        |      >>> unvivtool.unviv("foo/bar.viv", ".", filename="car00.tga")
        |      ...
        |      Strict Format warning (Viv directory filesizes do not match archive size)
        |      ...
        |      Decoder successful.
        |      1
        |
        |      Some archives may have broken headers. When detected, unvivtool
        |      will print warnings. Up to a certain point, such archives can
        |      still be extracted.

    viv(...)
        |  viv(viv, infiles, dry=False, verbose=False, format="BIGF", direnlen=0, fnhex=False)
        |      Encode files to new archive in BIGF, BIGH or BIG4 format.
        |      Skips given input paths that cannot be opened.
        |
        |      Parameters
        |      ----------
        |      viv : str, os.PathLike object
        |          Absolute or relative, path/to/output.viv
        |      infiles : list of str, list of os.PathLike objects
        |          List of absolute or relative, paths/to/input/files.ext
        |      dry : bool
        |          If True, perform dry run: run all format checks and print
        |          archive contents, do not write to disk.
        |      verbose : bool
        |          If True, print archive contents.
        |      format : str, optional
        |          Expects "BIGF", "BIGH" or "BIG4".
        |      direnlen : int, optional
        |          If >= 10, set as fixed archive directory entry length.
        |      fnhex : bool, optional
        |          If True, decode input filenames from Base16/hexadecimal.
        |          Use for non-printable filenames in archive. Keeps
        |          leading/embedding null bytes.
        |
        |      Returns
        |      -------
        |      {0, 1}
        |          1 on success.
        |
        |      Raises
        |      ------
        |      FileNotFoundError
        |          When 'viv' cannot be created.
        |
        |      Examples
        |      --------
        |      Encode all files in the list 'infiles_paths' in a new archive
        |      "out.viv". The archive is to be created in a subdirectory
        |      "foo", relative to the current working directory. Both input
        |      files are in the current parent directory.
        |
        |      >>> viv = "foo/out.viv"
        |      >>> infiles_paths = ["../LICENSE", "../README.md"]
        |      >>> unvivtool.viv(viv, infiles_paths)
        |      ...
        |      Encoder successful.
        |      1
        |
        |      The dry run functionality may be used to test parameters without
        |      writing to disk.
        |
        |      >>> unvivtool.viv(viv, infiles_paths, dry=True)
        |      Begin dry run
        |      ...
        |
        |      Supposing, the dry run has been successful. Encode the listed
        |      files, again printing archive contents.
        |
        |      >>> unvivtool.viv(viv, infiles_paths, verbose=True)
        |      ...

VERSION
    1.19

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

unvivtool-1.19.tar.gz (28.1 kB view hashes)

Uploaded Source

Built Distributions

unvivtool-1.19-cp312-cp312-win_amd64.whl (35.4 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

unvivtool-1.19-cp312-cp312-win32.whl (32.8 kB view hashes)

Uploaded CPython 3.12 Windows x86

unvivtool-1.19-cp312-cp312-musllinux_1_1_x86_64.whl (72.7 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ x86-64

unvivtool-1.19-cp312-cp312-musllinux_1_1_i686.whl (69.7 kB view hashes)

Uploaded CPython 3.12 musllinux: musl 1.1+ i686

unvivtool-1.19-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (72.4 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

unvivtool-1.19-cp312-cp312-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl (68.7 kB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.12+ i686 manylinux: glibc 2.17+ i686

unvivtool-1.19-cp312-cp312-macosx_11_0_arm64.whl (31.8 kB view hashes)

Uploaded CPython 3.12 macOS 11.0+ ARM64

unvivtool-1.19-cp312-cp312-macosx_10_9_x86_64.whl (32.1 kB view hashes)

Uploaded CPython 3.12 macOS 10.9+ x86-64

unvivtool-1.19-cp311-cp311-win_amd64.whl (35.3 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

unvivtool-1.19-cp311-cp311-win32.whl (32.8 kB view hashes)

Uploaded CPython 3.11 Windows x86

unvivtool-1.19-cp311-cp311-musllinux_1_1_x86_64.whl (72.4 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ x86-64

unvivtool-1.19-cp311-cp311-musllinux_1_1_i686.whl (69.7 kB view hashes)

Uploaded CPython 3.11 musllinux: musl 1.1+ i686

unvivtool-1.19-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (71.7 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

unvivtool-1.19-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl (68.1 kB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.12+ i686 manylinux: glibc 2.17+ i686

unvivtool-1.19-cp311-cp311-macosx_11_0_arm64.whl (31.8 kB view hashes)

Uploaded CPython 3.11 macOS 11.0+ ARM64

unvivtool-1.19-cp311-cp311-macosx_10_9_x86_64.whl (32.0 kB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

unvivtool-1.19-cp310-cp310-win_amd64.whl (35.3 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

unvivtool-1.19-cp310-cp310-win32.whl (32.8 kB view hashes)

Uploaded CPython 3.10 Windows x86

unvivtool-1.19-cp310-cp310-musllinux_1_1_x86_64.whl (71.6 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ x86-64

unvivtool-1.19-cp310-cp310-musllinux_1_1_i686.whl (68.8 kB view hashes)

Uploaded CPython 3.10 musllinux: musl 1.1+ i686

unvivtool-1.19-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (71.6 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

unvivtool-1.19-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl (68.1 kB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.12+ i686 manylinux: glibc 2.17+ i686

unvivtool-1.19-cp310-cp310-macosx_11_0_arm64.whl (31.8 kB view hashes)

Uploaded CPython 3.10 macOS 11.0+ ARM64

unvivtool-1.19-cp310-cp310-macosx_10_9_x86_64.whl (32.0 kB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

unvivtool-1.19-cp39-cp39-win_amd64.whl (35.3 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

unvivtool-1.19-cp39-cp39-win32.whl (32.8 kB view hashes)

Uploaded CPython 3.9 Windows x86

unvivtool-1.19-cp39-cp39-musllinux_1_1_x86_64.whl (71.4 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ x86-64

unvivtool-1.19-cp39-cp39-musllinux_1_1_i686.whl (68.6 kB view hashes)

Uploaded CPython 3.9 musllinux: musl 1.1+ i686

unvivtool-1.19-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (71.5 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

unvivtool-1.19-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl (67.9 kB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.12+ i686 manylinux: glibc 2.17+ i686

unvivtool-1.19-cp39-cp39-macosx_11_0_arm64.whl (31.8 kB view hashes)

Uploaded CPython 3.9 macOS 11.0+ ARM64

unvivtool-1.19-cp39-cp39-macosx_10_9_x86_64.whl (32.0 kB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

Supported by

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