Skip to content
This repository was archived by the owner on May 10, 2024. It is now read-only.

Commit 65e65dd

Browse files
Feature/docs (sheldonkwoodward#51)
* Updated module docstrings. * Updated README.md with roadmap. * Updated docs index.rst. * Improved bug-report issue template.
1 parent 402a5c0 commit 65e65dd

File tree

6 files changed

+607
-154
lines changed

6 files changed

+607
-154
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@ assignees: ''
1111
A clear and concise description of what the bug is.
1212

1313
**To Reproduce**
14-
Steps to reproduce the behavior:
14+
Steps to reproduce the behavior. Please link to relevant MKV or track files to reproduce the issue.
1515

1616
**Expected behavior**
1717
A clear and concise description of what you expected to happen.
1818

1919
**Screenshots**
2020
If applicable, add screenshots to help explain your problem.
2121

22-
**Desktop (please complete the following information):**
23-
- OS: [e.g. macOS]
24-
- Version: [e.g. 10.14]
22+
**Software (please complete the following information):**
23+
- OS: [e.g. macOS 10.14]
24+
- MKVToolNix version [e.g. v44.0.0]
2525

2626
**Additional context**
2727
Add any other context about the problem here.

README.md

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,52 @@
33
[![License](https://img.shields.io/github/license/sheldonkwoodward/pymkv.svg)](https://github.com/sheldonkwoodward/pymkv/LICENSE.txt)
44
[![Code Quality](https://api.codacy.com/project/badge/Grade/e1fe077d95f74a5886c557024777c26c)](https://api.codacy.com/project/badge/Grade/e1fe077d95f74a5886c557024777c26c)
55

6-
pymkv is a Python wrapper for mkvmerge. It provides support for muxing, splitting, linking, chapters, tags, and attachments through the use of mkvmerge.
6+
pymkv is a Python wrapper for mkvmerge and other tools in the MKVToolNix suite. It provides support for muxing,
7+
splitting, linking, chapters, tags, and attachments through the use of mkvmerge.
78

89
## About pymkv
9-
pymkv is a Python 3 library for manipulating MKV files with mkvmerge. Previously, I was constructing mkvmerge commands manually. They were becoming overly complex and unmanageable. To remedy this, I decided to write this library to make mkvmerge more scriptable and easier to use. Please open new issues for any bugs you find, support is greatly appreciated!
10+
pymkv is a Python 3 library for manipulating MKV files with mkvmerge. Constructing mkvmerge commands manually can
11+
quickly become confusing and complex. To remedy this, I decided to write this library to make mkvmerge more
12+
scriptable and easier to use. Please open new issues for any bugs you find, support is greatly appreciated!
1013

1114
## Installation
12-
mkvmerge must be installed on your computer. It is recommended to add it to your \$PATH variable but a different path can be manually specified. mkvmerge can be found and downloaded from [here] or in most package managers.
15+
mkvmerge must be installed on your computer, it is needed to process files when creating MKV objects. It is also
16+
recommended to add it to your $PATH variable but a different path can be manually specified. mkvmerge can be found
17+
and downloaded from [here](https://mkvtoolnix.download/downloads.html) or from most package managers.
1318

1419
To install pymkv from PyPI, use the following command:
1520

1621
$ pip install pymkv
1722

18-
You can also clone the repo and run the following command in the project root to edit the source code:
23+
You can also clone the repo and run the following command in the project root to install the source code as editable:
1924

2025
$ pip install -e .
2126

2227
## Documentation
23-
The documentation for pymkv can be found [here](https://pymkv.shel.dev) or in the docstrings.
28+
The documentation for pymkv can be found [here](https://pymkv.shel.dev) or in the project's docstrings.
29+
30+
## Roadmap
31+
pymkv was a project started a few years ago when I was first learning Python. There were a number of things that I
32+
did that could use improvement. The planned changes and future features are outlined below. Keep an eye on the [Github
33+
Projects page](https://github.com/sheldonkwoodward/pymkv/projects) for the current roadmap status.
34+
35+
### ~~Documentation~~
36+
The current documentation for pymkv is lacking. Instead of manually managing a GitHub Wiki, Sphinx will be setup to
37+
automatically generate documentation from docstrings. The docstrings will also need to be updated and improved to
38+
ensure this documentation is complete.
39+
40+
### Tests
41+
After completing documentation for the existing features, unit tests need to be written to "lock in" the existing
42+
functionality. Generating mkvmerge commands can be complex and it is easy to subtly modify an existing feature when
43+
adding a new one. Unit tests will ensure that features remain the same and help prevent bugs in the future.
44+
45+
### Cleanup
46+
The existing code base could use some tidying, better commenting, debugging, and a general styling overhaul. Setting up
47+
[pre-commit](https://pre-commit.com/) and the [Black code formatter](https://github.com/psf/black) will help keep the
48+
code base more readable and maintainable.
49+
50+
### Features
51+
Once these first three steps are complete, pymkv will be ready to start adding new features. The goal is for pymkv to
52+
implement the functionality of mkvmerge and other MKVToolNix tools as closely as possible. New features and bugs will
53+
be added to the [GitHub issues page](https://github.com/sheldonkwoodward/pymkv/issues). As pymkv progresses through
54+
the previous steps, this roadmap will be expanded to outline new features.

docs/source/index.rst

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1-
Home
2-
====
1+
pymkv
2+
=====
33

4-
Welcome the pymkv documentation!
4+
Welcome to the pymkv documentation! Here you will find links to the core modules and examples of how to use each.
55

66
Modules
77
-------
88

9+
The three primary modules of pymkv are :class:`~pymkv.MKVFile`, :class:`~pymkv.MKVTrack`, and
10+
:class:`~pymkv.MKVAttachment`. The :class:`~pymkv.MKVFile` class is used to import existing or create new MKV files.
11+
The :class:`~pymkv.MKVTrack` class is used to add individual tracks to an :class:`~pymkv.MKVFile`. The
12+
:class:`~pymkv.MKVAttachment` class is used to add attachments to an :class:`~pymkv.MKVFile`.
13+
14+
Each module supports or mimics many of the same operations as mkvmerge but are not necessarily complete. If there is
15+
functionality that is missing or an error in the docs, please open a new issue `here <https://github
16+
.com/sheldonkwoodward/pymkv/issues>`_.
17+
918
.. toctree::
1019
:maxdepth: 1
1120

pymkv/MKVAttachment.py

Lines changed: 57 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,61 @@
1-
# sheldon woodward
2-
# 3/28/18
1+
""":class:`~pymkv.MKVAttachment` classes are used to represent attachment files within an MKV or to be used in an
2+
MKV.
33
4-
"""MKVAttachment Class"""
4+
Examples
5+
--------
6+
Below are some basic examples of how the :class:`~pymkv.MKVAttachment` objects can be used.
7+
8+
Create a new :class:`~pymkv.MKVAttachment` and add it to an :class:`~pymkv.MKVFile`.
9+
10+
>>> from pymkv import MKVAttachment
11+
>>> attachment = MKVAttachment('path/to/attachment.jpg', name='NAME')
12+
>>> attachment.description = 'DESCRIPTION'
13+
14+
Attachments can also be added directly to an :class:`~pymkv.MKVFile`.
15+
16+
>>> from pymkv import MKVFile
17+
>>> mkv = MKVFile('path/to/file.mkv')
18+
>>> mkv.add_attachment('path/to/other/attachment.png')
19+
20+
Now, the MKV can be muxed with both attachments.
21+
22+
>>> mkv.add_attachment(attachment)
23+
>>> mkv.mux('path/to/output.mkv')
24+
"""
525

626
from os.path import expanduser, isfile
727
from mimetypes import guess_type
828

929

1030
class MKVAttachment:
31+
"""A class that represents an MKV attachment for an :class:`~pymkv.MKVFile` object.
32+
33+
Parameters
34+
----------
35+
file_path : str
36+
The path to the attachment file.
37+
name : str, optional
38+
The name that will be given to the attachment when muxed into a file.
39+
description : str, optional
40+
The description that will be given to the attachment when muxed into a file.
41+
attach_once : bool, optional
42+
Determines if the attachment should be added to all split files or only the first. Default is False,
43+
which will attach to all files.
44+
45+
Attributes
46+
----------
47+
mime_type : str
48+
The attachment's MIME type. The type will be guessed when :attr:`~pymkv.MKVAttachment.file_path` is set.
49+
name : str
50+
The name that will be given to the attachment when muxed into a file.
51+
description : str
52+
The description that will be given to the attachment when muxed into a file.
53+
attach_once : bool
54+
Determines if the attachment should be added to all split files or only the first. Default is False,
55+
which will attach to all files.
56+
"""
57+
1158
def __init__(self, file_path, name=None, description=None, attach_once=False):
12-
"""A class that represents an MKV attachment.
13-
14-
file_path (str):
15-
Path to a an attachment.
16-
name (str):
17-
The name of the attachment.
18-
description (str):
19-
The description of the attachment.
20-
attach_once (bool):
21-
Determines if the attachment should be added to all split files or only the first. Attach to all files is
22-
default with the option as false.
23-
"""
2459
self.mime_type = None
2560
self._file_path = None
2661
self.file_path = file_path
@@ -33,6 +68,13 @@ def __repr__(self):
3368

3469
@property
3570
def file_path(self):
71+
"""str: The path to the attachment file.
72+
73+
Raises
74+
------
75+
FileNotFoundError
76+
Raised if `file_path` does not exist.
77+
"""
3678
return self._file_path
3779

3880
@file_path.setter

0 commit comments

Comments
 (0)