subtitle style overwrite work

This commit is contained in:
ThaUnknown 2020-12-25 21:46:34 +01:00
parent d5ad78f58a
commit 4152d70495
3 changed files with 16 additions and 3 deletions

View file

@ -339,6 +339,18 @@
<h1 class="content-title font-size-22">
Subtitle Settings
</h1>
<div class="input-group mb-10 w-200" data-toggle="tooltip" data-placement="top"
data-title="Overwrites Default SSA Styles For Dialogue, Allows For Custom Subtitle Styles">
<div class="input-group-prepend">
<span class="input-group-text">Style Overwrite</span>
</div>
<input id="subtitle1" type="text" list="subtitle1list" class="form-control"
autocomplete="off" value="SubsPlease">
<datalist id="subtitle1list">
<option value="SubsPlease">Roboto Medium,26,&H00FFFFFF,&H000000FF,&H00020713,&H00000000,0,0,0,0,100,100,0,0,1,1.3,0,2,20,20,23,1</option>
<option value="Erai-raws">Open Sans Semibold,45,&H00FFFFFF,&H000000FF,&H00020713,&H00000000,-1,0,0,0,100,100,0,0,1,1.7,0,2,10,10,25,1</option>
</datalist>
</div>
<div class="custom-switch mb-10" data-toggle="tooltip" data-placement="top"
data-title="Greatly Improves Performance, Might Cause Desync On Very Low-End Devices">
<input type="checkbox" id="subtitle2" checked>
@ -414,7 +426,7 @@
</div>
<div class="custom-switch mb-20" data-toggle="tooltip" data-placement="top"
data-title="Tries To Find Batches For Finished Shows Instead Of Downloading 1 Episode At A Time">
<input type="checkbox" id="torrent9" checked>
<input type="checkbox" id="torrent9">
<label for="torrent9">Batch Lookup</label>
</div>
</div>

View file

@ -1,5 +1,5 @@
const settingsElements = [
volume, player2, player3, player4, player5, player6, player7, player8, player10, subtitle2, subtitle3, torrent1, torrent2, torrent3, torrent4, torrent5, torrent6, torrent7, torrent8, torrent9, other1, other2
volume, player2, player3, player4, player5, player6, player7, player8, player10, subtitle1, subtitle2, subtitle3, torrent1, torrent2, torrent3, torrent4, torrent5, torrent6, torrent7, torrent8, torrent9, other1, other2
]
setRes.addEventListener("click", restoreDefaults)
settingsTab.addEventListener("click", applySettingsTimeout)

View file

@ -23,7 +23,7 @@ PlayResY: 360
[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Default,Roboto Medium,26,&H00FFFFFF,&H000000FF,&H00020713,&H00000000,0,0,0,0,100,100,0,0,1,1.3,0,2,20,20,23,1
Style: Default,${Object.values(subtitle1list.options).filter(item => item.value == settings.subtitle1)[0].innerText}
[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
@ -98,6 +98,7 @@ function postDownload(file) { // parse subtitles fully after a download is finis
})
parser.on('subtitle', (subtitle, trackNumber) => {
if (playerData.headers) {
if (playerData.headers[trackNumber].type == "webvtt") convertSub(subtitle)
subtitles[trackNumber].add("Dialogue: " + (subtitle.layer || 0) + "," + new Date(subtitle.time).toISOString().slice(12, -1).slice(0, -1) + "," + new Date(subtitle.time + subtitle.duration).toISOString().slice(12, -1).slice(0, -1) + "," + (subtitle.style || "Default") + "," + (subtitle.name || "") + "," + (subtitle.marginL || "0") + "," + (subtitle.marginR || "0") + "," + (subtitle.marginV || "0") + "," + (subtitle.effect || "") + "," + subtitle.text)
}
})