@@ -6,70 +6,76 @@ draft: false
66
77# Export Templates
88
9- mpvQC allows for customizing report exports using the [ Jinja template] ( https://jinja.palletsprojects.com/en/3.1.x/ )
10- engine. To begin, follow these steps:
9+ mpvQC uses the [ Jinja template] ( https://jinja.palletsprojects.com/en/3.1.x/ ) engine to customize how QC reports are
10+ exported. This allows you to control the format and structure of your exported documents.
1111
12- 1 . Create a new file in the ` export-template ` directory with the ** .jinja** extension (e.g., ` MyTemplate.jinja ` ). The
13- location of the ` export-template ` directory varies depending on your operating system:
14- * On Windows: ` appdata/export-templates `
15- * On Linux: ` ~/.var/app/io.github.mpvqc.mpvQC/config/mpvQC/export-templates `
16- 1 . Edit the template
17- 1 . Restart mpvQC
12+ ## Getting Started
1813
19- Afterward, the file menu will include a new option to export reports using the newly customized template.
14+ 1 . Create a new file with the ** .jinja** extension (e.g., ` MyTemplate.jinja ` ) in the appropriate directory:
15+ * ** Windows** : ` appdata/export-templates `
16+ * ** Linux** : ` ~/.var/app/io.github.mpvqc.mpvQC/config/mpvQC/export-templates `
17+ 2 . Edit the template file using any text editor
18+ 3 . Restart mpvQC to load the new template
2019
21- # Documentation
20+ Once loaded, your custom template will appear as a new export option in the File menu.
2221
23- Alongside default Jinja expressions, mpvQC introduces the following ** Properties ** and ** Filters ** :
22+ ## Template Reference
2423
25- ## Properties
24+ In addition to standard Jinja expressions, mpvQC provides the following properties and filters:
2625
27- | Name | Type | Description |
28- | --------------------| ----------------| ----------------------------------------------------------------------------------------------------|
29- | | |   ; |
30- | ` write_date ` | ` bool ` | Indicates whether the current date and time should be included in reports. |
31- | ` date ` | ` str ` | Date and time formatted according to the user's selected language (QLocale.FormatType.LongFormat). |
32- | | |   ; |
33- | ` write_generator ` | ` bool ` | Indicates whether the report should include the generator name and version (e.g., "mpvQC 0.9.0"). |
34- | ` generator ` | ` str ` | The name and version of mpvQC being used. |
35- | | |   ; |
36- | ` write_video_path ` | ` bool ` | Indicates whether the path of the video should be included in reports. |
37- | ` video_path ` | ` str ` | The absolute path of the video file, or an empty string if no video is present. |
38- | ` video_name ` | ` str ` | The name and extension of the video file, or an empty string if no video is present. |
39- | | |   ; |
40- | ` write_nickname ` | ` bool ` | Indicates whether the user's nickname should be included in reports. |
41- | ` nickname ` | ` str ` | The nickname of the person creating the report. |
42- | | |   ; |
43- | ` comments ` | ` list[object] ` | A list of comment objects, each with the following properties: |
44- | | | ` time: int ` : Time in seconds. |
45- | | | ` commentType: str ` Type of comment. |
46- | | | ` comment: str ` The actual comment. |
26+ ### Properties
4727
48- ## Filters
28+ | | | |
29+ | --------------------------| --------------| ---------------------------------------------------------------------|
30+ | ** Report Metadata** | | |
31+ | ` write_date ` | ` bool ` | Whether to include the export date/time |
32+ | ` date ` | ` str ` | Current date/time formatted according to user's locale (LongFormat) |
33+ | ` write_generator ` | ` bool ` | Whether to include the generator information |
34+ | ` generator ` | ` str ` | mpvQC version string (e.g., "mpvQC 0.9.0") |
35+ |   ; | | |
36+ | ** Video Information** | | |
37+ | ` write_video_path ` | ` bool ` | Whether to include the video file path |
38+ | ` video_path ` | ` str ` | Absolute path to the video file (empty if no video loaded) |
39+ | ` video_name ` | ` str ` | Video filename with extension (empty if no video loaded) |
40+ |   ; | | |
41+ | ** User Information** | | |
42+ | ` write_nickname ` | ` bool ` | Whether to include the user's nickname |
43+ | ` nickname ` | ` str ` | User's nickname for report attribution |
44+ |   ; | | |
45+ | ** Subtitle Information** | | |
46+ | ` write_subtitle_paths ` | ` bool ` | Whether to include manually imported subtitle paths |
47+ | ` subtitles ` | ` list[str] ` | List of subtitle file paths |
48+ |   ; | | |
49+ | ** Comments** | | |
50+ | ` comments ` | ` list[dict] ` | List of comment dictionaries containing: |
51+ | | | • ` time ` (int): Time in seconds |
52+ | | | • ` commentType ` (str): Type of comment |
53+ | | | • ` comment ` (str): The comment text |
4954
50- | Name | Description |
51- | -------------------| --------------------------------------------------------------------------------------------------------------------------------------------------------------|
52- | |   ; |
53- | ` as_time ` | Converts an ` int ` representing time in seconds into an ` HH:mm:ss ` formatted string. |
54- | | Example: ` [{{ comment['time'] \| as_time }}] ` will output ` [00:00:00] ` for a time value of ` 0 ` while iterating over comments. |
55- | ` as_comment_type ` | Translates the comment type into the user's currently selected language. |
56- | | Example: ` [{{ comment['commentType'] \| as_comment_type }}] ` will output ` [Ausdruck] ` for a ` commentType ` value of ` Phrasing ` while iterating over comments. |
55+ ### Filters
5756
58- # Example Template
57+ | Filter | Purpose | Usage |
58+ | -------------------| --------------------------------------------| -------------------------------------------------------------------------|
59+ | ` as_time ` | Converts seconds to ` HH:mm:ss ` format | ` {{ comment['time'] \| as_time }} ` → ` 00:00:00 ` |
60+ | ` as_comment_type ` | Translates comment type to user's language | ` {{ comment['commentType'] \| as_comment_type }} ` → Localized type name |
5961
60- Internally, mpvQC utilizes the following template to save Quality Control (QC) documents:
62+ ## Default Template
63+
64+ mpvQC uses this template internally for saving QC documents:
6165
6266```
6367[FILE]
64- {{ 'date : ' + date + '\n' if write_date else '' -}}
65- {{ 'generator : ' + generator + '\n' if write_generator else '' -}}
66- {{ 'nick : ' + nickname + '\n' if write_nickname else '' -}}
68+ {{ 'date : ' + date + '\n' if write_date else '' -}}
69+ {{ 'generator : ' + generator + '\n' if write_generator else '' -}}
70+ {{ 'nick : ' + nickname + '\n' if write_nickname else '' -}}
6771{{ 'path : ' + video_path + '\n' if write_video_path else '' -}}
72+ {% for subtitle in subtitles if write_subtitle_paths -%}
73+ subtitle : {{ subtitle }}
74+ {% endfor -%}
6875
6976{{ '\n' }}[DATA]
7077{% for comment in comments -%}
7178[{{ comment['time'] | as_time }}] [{{ comment['commentType'] | as_comment_type }}] {{ comment['comment'] | trim }}
7279{% endfor -%}
73-
7480# total lines: {{ comments | count }}
7581```
0 commit comments