models

Data models for parsing mkvmerge JSON output using msgspec.

This module defines structures that map to the JSON output of mkvmerge -J.

Examples

>>> from pymkv.models import MkvMergeOutput
>>> # data = msgspec.json.decode(json_bytes, type=MkvMergeOutput)
class pymkv.models.AttachmentInfo(id: int, file_name: str | None = None, content_type: str | None = None, description: str | None = None, size: int = 0, properties: ~pymkv.models.AttachmentProperties = <factory>)

Bases: Struct

Information about an attachment.

id

The ID of the attachment.

Type:

int

properties

The properties of the attachment.

Type:

AttachmentProperties

content_type : str | None
description : str | None
file_name : str | None
id : int
properties : AttachmentProperties
size : int
class pymkv.models.AttachmentProperties(name: str | None = None, description: str | None = None, mime_type: str | None = None)

Bases: Struct

Properties of an attachment.

name

The name of the attachment.

Type:

str | None

description

The description of the attachment.

Type:

str | None

mime_type

The MIME type of the attachment.

Type:

str | None

description : str | None
mime_type : str | None
name : str | None
class pymkv.models.ContainerInfo(properties: ~pymkv.models.ContainerProperties = <factory>, supported: bool = True, recognized: bool = True, type: str | None = None)

Bases: Struct

Information about the container.

properties

The properties of the container.

Type:

ContainerProperties

supported

Whether the container is supported.

Type:

bool

recognized

Whether the container is recognized.

Type:

bool

type

The type of the container.

Type:

str | None

properties : ContainerProperties
recognized : bool
supported : bool
type : str | None
class pymkv.models.ContainerProperties(title: str | None = None)

Bases: Struct

Properties of the container.

title

The title of the container.

Type:

str | None

title : str | None
class pymkv.models.MkvMergeOutput(container: ~pymkv.models.ContainerInfo, file_name: str | None = None, tracks: list[~pymkv.models.TrackInfo] = <factory>, global_tags: list[~pymkv.models.TagEntry] = <factory>, track_tags: list[~pymkv.models.TagEntry] = <factory>, attachments: list[~pymkv.models.AttachmentInfo] = <factory>)

Bases: Struct

Root structure of mkvmerge -J output.

container

Information about the container.

Type:

ContainerInfo

tracks

List of tracks in the file.

Type:

list[TrackInfo]

global_tags

List of global tags.

Type:

list[TagEntry]

track_tags

List of track tags.

Type:

list[TagEntry]

attachments

List of attachments.

Type:

list[AttachmentInfo]

file_name

The file name.

Type:

str | None

attachments : list[AttachmentInfo]
container : ContainerInfo
file_name : str | None
global_tags : list[TagEntry]
track_tags : list[TagEntry]
tracks : list[TrackInfo]
class pymkv.models.TagEntry(num_entries: int = 0, track_id: int | None = None)

Bases: Struct

Tag entry information.

num_entries

The number of entries in the tag.

Type:

int

track_id

The ID of the track associated with the tag.

Type:

int | None

num_entries : int
track_id : int | None
class pymkv.models.TrackInfo(id: int, type: str, codec: str, properties: ~pymkv.models.TrackProperties = <factory>, num_entries: int | None = None, start_pts: int = 0)

Bases: Struct

Information about a track.

id

The ID of the track.

Type:

int

type

The type of the track (e.g., ‘video’, ‘audio’).

Type:

str

codec

The codec used by the track.

Type:

str

properties

The properties of the track.

Type:

TrackProperties

num_entries

The number of tag entries, if available.

Type:

int | None

start_pts

The starting timestamp of the track.

Type:

int

codec : str
id : int
num_entries : int | None
properties : TrackProperties
start_pts : int
type : str
class pymkv.models.TrackProperties(*, track_name: str | None = None, language: str | None = None, language_ietf: str | None = None, default_track: bool = False, forced_track: bool = False, flag_commentary: bool = False, flag_hearing_impaired: bool = False, flag_visual_impaired: bool = False, flag_original: bool = False)

Bases: Struct

Properties of a track as returned by mkvmerge -J.

track_name

The name of the track.

Type:

str | None

language

The language of the track (ISO 639-2).

Type:

str | None

language_ietf

The language of the track (BCP 47).

Type:

str | None

default_track

Whether the track is the default track of its type.

Type:

bool

forced_track

Whether the track is forced.

Type:

bool

flag_commentary

Whether the track is a commentary track.

Type:

bool

flag_hearing_impaired

Whether the track is for the hearing impaired.

Type:

bool

flag_visual_impaired

Whether the track is for the visually impaired.

Type:

bool

flag_original

Whether the track is the original language.

Type:

bool

default_track : bool
flag_commentary : bool
flag_hearing_impaired : bool
flag_original : bool
flag_visual_impaired : bool
forced_track : bool
language : str | None
language_ietf : str | None
track_name : str | None