Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ default_language_version:

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -22,7 +22,7 @@ repos:

# Run the Ruff linter.
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.7
rev: v0.7.2
hooks:
# Linter
- id: ruff
Expand All @@ -31,7 +31,7 @@ repos:
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.12.0'
rev: v1.13.0
hooks:
- id: mypy

Expand Down
13 changes: 7 additions & 6 deletions pymkv/MKVAttachment.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
from __future__ import annotations

from mimetypes import guess_type
from pathlib import Path

""":class:`~pymkv.MKVAttachment` classes are used to represent attachment files within an MKV or to be used in an
"""
:class:`~pymkv.MKVAttachment` classes are used to represent attachment files within an MKV or to be used in an
MKV.

Examples
Expand All @@ -28,6 +24,11 @@
>>> mkv.mux('path/to/output.mkv')
"""

from __future__ import annotations

from mimetypes import guess_type
from pathlib import Path


class MKVAttachment:
"""A class that represents an MKV attachment for an :class:`~pymkv.MKVFile` object.
Expand Down
30 changes: 15 additions & 15 deletions pymkv/MKVFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,33 @@

Create and mux a new MKV. This example takes an standalone video and audio track and combines them into an MKV file.

>> from pymkv import MKVFile
>> mkv = MKVFile()
>> mkv.add_track('/path/to/track.h264')
>> mkv.add_track(MKVTrack('/path/to/another/track.aac'))
>>> from pymkv import MKVFile
>>> mkv = MKVFile()
>>> mkv.add_track('/path/to/track.h264')
>>> mkv.add_track(MKVTrack('/path/to/another/track.aac'))
>> mkv.mux('/path/to/output.mkv')

Generate the mkvmerge command to mux an MKV. This is example is identical to the first example except the command is
only generated, not executed.

>> mkv = MKVFile()
>> mkv.add_track('/path/to/track.h264')
>> mkv.add_track(MKVTrack('/path/to/another/track.aac'))
>> mkv.command('/path/to/output.mkv')
>>> mkv = MKVFile()
>>> mkv.add_track('/path/to/track.h264')
>>> mkv.add_track(MKVTrack('/path/to/another/track.aac'))
>>> mkv.command('/path/to/output.mkv')

Import an existing MKV and remove a track. This example will import an MKV that already exists on your filesystem,
remove a track and allow you to mux that change into a new file.

>> mkv = MKVFile('/path/to/file.mkv')
>> mkv.remove_track(0)
>> mkv.mux('/path/to/output.mkv')
>>> mkv = MKVFile('/path/to/file.mkv')
>>> mkv.remove_track(0)
>>> mkv.mux('/path/to/output.mkv')

Combine two MKVs. This example takes two existing MKVs and combines their tracks into a single MKV file.

>> mkv1 = MKVFile('/path/to/file1.mkv')
>> mkv2 = MKVFile('/path/to/file2.mkv')
>> mkv1.add_file(mkv2)
>> mkv1.mux('/path/to/output.mkv')
>>> mkv1 = MKVFile('/path/to/file1.mkv')
>>> mkv2 = MKVFile('/path/to/file2.mkv')
>>> mkv1.add_file(mkv2)
>>> mkv1.mux('/path/to/output.mkv')
"""

from __future__ import annotations
Expand Down