Skip to content
Open
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
95 changes: 63 additions & 32 deletions content/export-templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,12 @@ draft: false
# Export Templates

mpvQC uses the [Jinja template](https://jinja.palletsprojects.com/en/3.1.x/) engine to customize how QC reports are
exported. This allows you to control the format and structure of your exported documents.
exported: templates control the format and structure of the documents written by the export menu.

Templates are made for human-readable output. If you want to feed QC data into scripts or other tooling, you don't
need a template: mpvQC saves QC documents in a
[versioned JSON format](https://github.com/mpvqc/mpvQC/tree/main/docs/document-format) with a JSON Schema per
version, designed exactly for that.

## Getting Started

Expand All @@ -16,51 +21,77 @@ exported. This allows you to control the format and structure of your exported d
3. Edit the template file using any text editor
4. Restart mpvQC to load the new template

Once loaded, your custom template will appear as a new export option in the File menu.
Once loaded, your custom template appears as a new entry under **File → Export QC Document**.

## Template Reference

In addition to standard Jinja expressions, mpvQC provides the following properties and filters:

### Properties

| | | |
|--------------------------|--------------|---------------------------------------------------------------------|
| **Report Metadata** | | |
| `write_date` | `bool` | Whether to include the export date/time |
| `date` | `str` | Current date/time formatted according to user's locale (LongFormat) |
| `write_generator` | `bool` | Whether to include the generator information |
| `generator` | `str` | mpvQC version string (e.g., "mpvQC 0.9.0") |
|   | | |
| **Video Information** | | |
| `write_video_path` | `bool` | Whether to include the video file path |
| `video_path` | `str` | Absolute path to the video file (empty if no video loaded) |
| `video_name` | `str` | Video filename with extension (empty if no video loaded) |
|   | | |
| **User Information** | | |
| `write_nickname` | `bool` | Whether to include the user's nickname |
| `nickname` | `str` | User's nickname for report attribution |
|   | | |
| **Subtitle Information** | | |
| `write_subtitle_paths` | `bool` | Whether to include manually imported subtitle paths |
| `subtitles` | `list[str]` | List of subtitle file paths |
|   | | |
| **Comments** | | |
| `comments` | `list[dict]` | List of comment dictionaries containing: |
| | | • `time` (int): Time in seconds |
| | | • `commentType` (str): Type of comment |
| | | • `comment` (str): The comment text |
{{< card >}}
### Report Metadata

| Property | Type | Description |
|-------------------|--------|----------------------------------------------|
| `write_date` | `bool` | Whether to include the export date/time |
| `date` | `str` | Current date/time as `yyyy-MM-dd HH:mm` |
| `write_generator` | `bool` | Whether to include the generator information |
| `generator` | `str` | mpvQC version string (e.g., "mpvQC 0.9.0") |
{{< /card >}}

{{< card >}}
### Video

| Property | Type | Description |
|--------------------|--------|------------------------------------------------------------|
| `write_video_path` | `bool` | Whether to include the video file path |
| `video_path` | `str` | Absolute path to the video file (empty if no video loaded) |
| `video_name` | `str` | Video filename with extension (empty if no video loaded) |
{{< /card >}}

{{< card >}}
### User

| Property | Type | Description |
|------------------|--------|----------------------------------------|
| `write_nickname` | `bool` | Whether to include the user's nickname |
| `nickname` | `str` | User's nickname for report attribution |
{{< /card >}}

{{< card >}}
### Subtitles

| Property | Type | Description |
|------------------------|-------------|------------------------------------------------------|
| `write_subtitle_paths` | `bool` | Whether to include manually imported subtitle paths |
| `subtitles` | `list[str]` | List of subtitle file paths |
{{< /card >}}

{{< card >}}
### Comments

`comments` is a list of dictionaries, one per comment:

| Key | Type | Description |
|---------------|-------|----------------------|
| `time` | `int` | Time in seconds |
| `time_ms` | `int` | Time in milliseconds |
| `commentType` | `str` | Type of comment |
| `comment` | `str` | The comment text |
{{< /card >}}

{{< card >}}
### Filters

| Filter | Purpose | Usage |
|-------------------|--------------------------------------------|-------------------------------------------------------------------------|
| `as_time` | Converts seconds to `HH:mm:ss` format | `{{ comment['time'] \| as_time }}` → `00:00:00` |
| `as_time_ms` | Converts milliseconds to `HH:mm:ss.zzz` | `{{ comment['time_ms'] \| as_time_ms }}` → `00:15:29.340` |
| `as_comment_type` | Translates comment type to user's language | `{{ comment['commentType'] \| as_comment_type }}` → Localized type name |
{{< /card >}}

## Default Template
## Example: The Classic Template

mpvQC uses this template internally for saving QC documents:
mpvQC uses this template internally for the built-in **mpvQC Classic** export:

```
[FILE]
Expand Down
19 changes: 19 additions & 0 deletions layouts/partials/style.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
--code-text-color: #222;
--blockquote-border-color: #666;
--blockquote-text-color: #666;
--card-border-color: #ddd;
}

@media (prefers-color-scheme: dark) {
Expand All @@ -37,6 +38,7 @@
--code-text-color: #ddd;
--blockquote-border-color: #ccc;
--blockquote-text-color: #ccc;
--card-border-color: #999;
}
}

Expand Down Expand Up @@ -158,4 +160,21 @@
list-style-type: none;
margin-left: -25.5px;
}

.card {
box-sizing: border-box;
border: 1px solid var(--card-border-color);
border-radius: 12px;
padding: 0.25rem 1.25rem 1rem;
}

.content-card + .content-card {
margin-top: 1rem;
}

.card th,
.card td {
padding: 6px 16px 6px 0;
text-align: left;
}
</style>
3 changes: 3 additions & 0 deletions layouts/shortcodes/card.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<div class="card content-card">
{{ .Page.RenderString (dict "display" "block") (strings.TrimSpace .Inner) }}
</div>
15 changes: 2 additions & 13 deletions layouts/shortcodes/install-instructions.html
Original file line number Diff line number Diff line change
@@ -1,23 +1,12 @@
<style>
.install-container {
--card-border-color: #ddd;
display: flex;
flex-wrap: wrap;
gap: 1rem;
}

@media (prefers-color-scheme: dark) {
.install-container {
--card-border-color: #999;
}
}

.install-card {
flex: 1 1 260px;
box-sizing: border-box;
border: 1px solid var(--card-border-color);
border-radius: 8px;
padding: 0.25rem 1.25rem 1rem;
}

.install-card h3 {
Expand All @@ -40,7 +29,7 @@
}
</style>
<div class="install-container">
<div class="install-card">
<div class="install-card card">
<h3>
<picture>
<!-- https://www.svgrepo.com/svg/232490/windows-operating-system -->
Expand All @@ -61,7 +50,7 @@ <h3>
<li>Double-click on <b>mpvQC.exe</b> to run it.</li>
</ol>
</div>
<div class="install-card">
<div class="install-card card">
<h3>
<picture>
<!-- https://www.svgrepo.com/svg/232488/linux-->
Expand Down
2 changes: 1 addition & 1 deletion static/api/v1/public/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"latest": "0.9.0-beta4"}
{"latest": "0.9.0-beta5"}