Skip to content

Commit e3dcb20

Browse files
authored
Fix chat trim and timestamp format not being applied when enqueuing from chat page (#1166)
* Fix chat trimming and timestamp format not being applied when enqueuing * Remove unused property * Fix clip chats
1 parent 4c65eb8 commit e3dcb20

File tree

3 files changed

+26
-32
lines changed

3 files changed

+26
-32
lines changed

TwitchDownloaderCore/TwitchObjects/ChatRoot.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,6 @@ public class LegacyEmbedChatBadge
242242
{
243243
public string name { get; set; }
244244
public Dictionary<string, byte[]> versions { get; set; }
245-
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
246-
public Dictionary<string, string> urls { get; set; }
247245
}
248246

249247
[DebuggerDisplay("{prefix}")]

TwitchDownloaderWPF/PageChatDownload.xaml.cs

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,32 @@ public ChatDownloadOptions GetOptions(string filename)
268268
else if (radioCompressionGzip.IsChecked == true)
269269
options.Compression = ChatCompression.Gzip;
270270

271+
// TODO: Enable trimming clip chats
272+
if (downloadType is DownloadType.Video)
273+
{
274+
if (CheckTrimStart.IsChecked == true)
275+
{
276+
options.TrimBeginning = true;
277+
TimeSpan start = new TimeSpan((int)numStartHour.Value, (int)numStartMinute.Value, (int)numStartSecond.Value);
278+
options.TrimBeginningTime = (int)start.TotalSeconds;
279+
}
280+
281+
if (CheckTrimEnd.IsChecked == true)
282+
{
283+
options.TrimEnding = true;
284+
TimeSpan end = new TimeSpan((int)numEndHour.Value, (int)numEndMinute.Value, (int)numEndSecond.Value);
285+
options.TrimEndingTime = (int)end.TotalSeconds;
286+
}
287+
}
288+
289+
if (radioTimestampUTC.IsChecked == true)
290+
options.TimeFormat = TimestampFormat.Utc;
291+
else if (radioTimestampRelative.IsChecked == true)
292+
options.TimeFormat = TimestampFormat.Relative;
293+
else if (radioTimestampNone.IsChecked == true)
294+
options.TimeFormat = TimestampFormat.None;
295+
296+
options.Id = downloadId;
271297
options.EmbedData = checkEmbed.IsChecked.GetValueOrDefault();
272298
options.BttvEmotes = checkBttvEmbed.IsChecked.GetValueOrDefault();
273299
options.FfzEmotes = checkFfzEmbed.IsChecked.GetValueOrDefault();
@@ -501,35 +527,6 @@ private async void SplitBtnDownload_Click(object sender, RoutedEventArgs e)
501527
try
502528
{
503529
ChatDownloadOptions downloadOptions = GetOptions(saveFileDialog.FileName);
504-
if (downloadType == DownloadType.Video)
505-
{
506-
if (CheckTrimStart.IsChecked == true)
507-
{
508-
downloadOptions.TrimBeginning = true;
509-
TimeSpan start = new TimeSpan((int)numStartHour.Value, (int)numStartMinute.Value, (int)numStartSecond.Value);
510-
downloadOptions.TrimBeginningTime = (int)start.TotalSeconds;
511-
}
512-
513-
if (CheckTrimEnd.IsChecked == true)
514-
{
515-
downloadOptions.TrimEnding = true;
516-
TimeSpan end = new TimeSpan((int)numEndHour.Value, (int)numEndMinute.Value, (int)numEndSecond.Value);
517-
downloadOptions.TrimEndingTime = (int)end.TotalSeconds;
518-
}
519-
520-
downloadOptions.Id = downloadId;
521-
}
522-
else
523-
{
524-
downloadOptions.Id = downloadId;
525-
}
526-
527-
if (radioTimestampUTC.IsChecked == true)
528-
downloadOptions.TimeFormat = TimestampFormat.Utc;
529-
else if (radioTimestampRelative.IsChecked == true)
530-
downloadOptions.TimeFormat = TimestampFormat.Relative;
531-
else if (radioTimestampNone.IsChecked == true)
532-
downloadOptions.TimeFormat = TimestampFormat.None;
533530

534531
var downloadProgress = new WpfTaskProgress((LogLevel)Settings.Default.LogLevels, SetPercent, SetStatus, AppendLog);
535532
var currentDownload = new ChatDownloader(downloadOptions, downloadProgress);

TwitchDownloaderWPF/WindowQueueOptions.xaml.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,6 @@ private void btnQueue_Click(object sender, RoutedEventArgs e)
344344
}
345345

346346
ChatDownloadOptions chatOptions = MainWindow.pageChatDownload.GetOptions(null);
347-
chatOptions.Id = chatDownloadPage.downloadId;
348347
chatOptions.Filename = Path.Combine(folderPath, FilenameService.GetFilename(Settings.Default.TemplateChat, chatDownloadPage.textTitle.Text, chatOptions.Id,chatDownloadPage.currentVideoTime, chatDownloadPage.textStreamer.Text,
349348
chatOptions.TrimBeginning ? TimeSpan.FromSeconds(chatOptions.TrimBeginningTime) : TimeSpan.Zero,
350349
chatOptions.TrimEnding ? TimeSpan.FromSeconds(chatOptions.TrimEndingTime) : chatDownloadPage.vodLength,

0 commit comments

Comments
 (0)