Skip to content

Commit

Permalink
SortedCommentComparer -> CommentOffsetComparer and fix a temporary va…
Browse files Browse the repository at this point in the history
…riable name that snuck in
  • Loading branch information
ScrubN committed Dec 19, 2023
1 parent e384cd6 commit 68eb301
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion TwitchDownloaderCore/ChatDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ public async Task DownloadAsync(IProgress<ProgressReport> progress, Cancellation
sortedComments.AddRange(commentTask.Result);
}

sortedComments.Sort(new SortedCommentComparer());
sortedComments.Sort(new CommentOffsetComparer());

chatRoot.comments = sortedComments.DistinctBy(x => x._id).ToList();

Expand Down
2 changes: 1 addition & 1 deletion TwitchDownloaderCore/ChatUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ private async Task ChatEndingCropTask(IProgress<ProgressReport> progress, Cancel
ChatRoot newChatRoot = await ChatJson.DeserializeAsync(inputFile, getComments: true, onlyFirstAndLastComments: false, getEmbeds: false, cancellationToken);

// Append the new comment section
SortedSet<Comment> commentsSet = new SortedSet<Comment>(new SortedCommentComparer());
SortedSet<Comment> commentsSet = new SortedSet<Comment>(new CommentOffsetComparer());
foreach (var comment in newChatRoot.comments)
{
if (comment.content_offset_seconds < downloadOptions.CropEndingTime && comment.content_offset_seconds >= downloadOptions.CropBeginningTime)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace TwitchDownloaderCore.Tools
{
internal class SortedCommentComparer : IComparer<Comment>
internal class CommentOffsetComparer : IComparer<Comment>
{
// Modified from double.CompareTo
// ReSharper disable once CompareOfFloatsByEqualityOperator
Expand Down
6 changes: 3 additions & 3 deletions TwitchDownloaderCore/Tools/TimeSpanHFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,9 @@ private static void AppendBigHFormat(StringBuilder sb, TimeSpan timeSpan, int co
}
else
{
var foo = ((uint)timeSpan.TotalHours).ToString();
sb.Append('0', Math.Max(0, count - foo.Length));
sb.Append(foo);
var hourString = ((uint)timeSpan.TotalHours).ToString();
sb.Append('0', Math.Max(0, count - hourString.Length));
sb.Append(hourString);
}
}

Expand Down

0 comments on commit 68eb301

Please sign in to comment.