From 8d84a6721668daaaa5da136d39946a5f0e6662d3 Mon Sep 17 00:00:00 2001 From: MBR#0001 Date: Sun, 23 Jul 2023 20:53:53 +0200 Subject: [PATCH] Add support for displaying more sub info --- .../subtitleeditor/subtitleeditor.js | 40 ++++++++++++++++--- src/strings/en-us.json | 6 ++- 2 files changed, 40 insertions(+), 6 deletions(-) diff --git a/src/components/subtitleeditor/subtitleeditor.js b/src/components/subtitleeditor/subtitleeditor.js index 572cccc1fad4..56d138de96ac 100644 --- a/src/components/subtitleeditor/subtitleeditor.js +++ b/src/components/subtitleeditor/subtitleeditor.js @@ -194,7 +194,8 @@ function renderSearchResults(context, results) { html += ''; - const bodyClass = result.Comment || result.IsHashMatch ? 'three-line' : 'two-line'; + const hasAnyFlags = result.IsHashMatch || result.AiTranslated || result.MachineTranslated || result.Forced || result.HearingImpaired; + const bodyClass = result.Comment || hasAnyFlags ? 'three-line' : 'two-line'; html += '
'; @@ -206,16 +207,45 @@ function renderSearchResults(context, results) { } if (result.DownloadCount != null) { - html += '' + globalize.translate('DownloadsValue', result.DownloadCount) + ''; + html += '' + globalize.translate('DownloadsValue', result.DownloadCount) + ''; } + + if (result.FrameRate) { + html += '' + globalize.translate('Framerate') + ': ' + result.FrameRate + ''; + } + html += '
'; if (result.Comment) { - html += '
' + escapeHtml(result.Comment) + '
'; + html += '
' + escapeHtml(result.Comment) + '
'; } - if (result.IsHashMatch) { - html += '
' + globalize.translate('PerfectMatch') + '
'; + if (hasAnyFlags) { + html += '
'; + + const spanOpen = ''; + + if (result.IsHashMatch) { + html += spanOpen + globalize.translate('PerfectMatch') + ''; + } + + if (result.AiTranslated) { + html += spanOpen + globalize.translate('AiTranslated') + ''; + } + + if (result.MachineTranslated) { + html += spanOpen + globalize.translate('MachineTranslated') + ''; + } + + if (result.Forced) { + html += spanOpen + globalize.translate('ForeignPartsOnly') + ''; + } + + if (result.HearingImpaired) { + html += spanOpen.replace('margin-right:0.25em;', '') + globalize.translate('HearingImpairedShort') + ''; + } + + html += '
'; } html += ''; diff --git a/src/strings/en-us.json b/src/strings/en-us.json index 983b7c8f8d8b..048a47af7bb3 100644 --- a/src/strings/en-us.json +++ b/src/strings/en-us.json @@ -1713,5 +1713,9 @@ "Unreleased": "Not yet released", "LabelTonemappingMode": "Tone mapping mode", "TonemappingModeHelp": "Select the tone mapping mode. If you experience blown out highlights try switching to the RGB mode.", - "Unknown": "Unknown" + "Unknown": "Unknown", + "AiTranslated": "AI Translated", + "MachineTranslated": "Machine Translated", + "ForeignPartsOnly": "Forced/Foreign parts only", + "HearingImpairedShort": "HI/SDH" }