New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chat Updater Rewrite + GUI frontend, QOL changes #442
Conversation
…ons, shorten chatupdate file/class names
…when embeddedData is null, made embed fetching async
…ore progress reporters
I just learned something. With CommandLineParser, nullable bools cannot be assigned when the short char is used. I opted to make embed-missing default false and rather than removing its short char |
…report, ensure temp file is deleted, cleanup
I think it would be fine to remove the short char if we need to. I have not tested this PR, but it is very promising (a much better implementation of trying to update chat information, instead of redownloading). The problem with updating the comments/ crop is that the vod still needs to be up. I think you are checking for that already. The emotes and badges shouldn't require this check since it only depends on what has already been downloaded. |
Could you explain where this bug was?
|
Using List<TwitchEmote> firstPartyEmoteList = await TwitchHelper.GetEmotes(chatRoot.comments, _updateOptions.TempFolder, chatRoot.embeddedData);
...
if (chatRoot.embeddedData.firstParty == null || updateOptions.ReplaceEmbeds)
{
chatRoot.embeddedData.firstParty = new List<EmbedEmoteData>();
}
foreach (TwitchEmote emote in firstPartyEmoteList)
{
EmbedEmoteData newEmote = new EmbedEmoteData();
newEmote.id = emote.Id;
newEmote.imageScale = emote.ImageScale;
newEmote.data = emote.ImageData;
newEmote.width = emote.Width / emote.ImageScale;
newEmote.height = emote.Height / emote.ImageScale;
chatRoot.embeddedData.firstParty.Add(newEmote);
} The easy solution to this is to check the the ids of all the emotes already in the list against the id of the emote about to be appended. ...
foreach (TwitchEmote emote in firstPartyEmoteList)
{
if (chatRoot.embeddedData.firstParty.Any(x => x.id.Equals(emote.Id)))
continue;
EmbedEmoteData newEmote = new EmbedEmoteData();
... |
Given that all of the other update options have short chars, I would rather leave the short char and make it default to false for the consistency
Yep, and I already have checks for that. I swapped out some Anyways doing this allows me to catch for only NREs which also means in the same block I can safely assume try
{
// Only download missing comments if new end crop is greater than old end crop
if (_updateOptions.CropEndingTime > chatRoot.video.end)
{
ChatDownloadOptions downloadOptions = GetCropDownloadOptions(/*chatRoot.video.id,*/null, tempFile, _updateOptions.FileFormat, chatRoot.video.end, _updateOptions.CropEndingTime);
await AppendCommentSection(downloadOptions, tempFile, cancellationToken);
}
}
catch (NullReferenceException)
{
progress.Report(new ProgressReport() { reportType = ReportType.Log, data = "Unable to fetch possible missing comments: source VOD is expired or embedded ID is corrupt" });
} Though you will see I have |
…ed emotes, fix emoji count check for Linux
…nsupported chatupdate formats
I love when git inflates my line count and blames me by counting replacing spaces with tabs |
Oh I thought that the functions would internally handle the duplicates by checking if they exists in the passed emote vector:
The important functionality, is that the old emotes should NOT be replaced with newer version, just ones that are missing should be added (example is holiday emotes). |
Edit: I misread the first time, though I'll leave it anyways. TwitchDownloader/TwitchDownloaderCore/TwitchHelper.cs Lines 242 to 247 in bac2dcf
No, a standard list allows for duplicate entries. You could get around this by using a SortedSet<> and overriding the Comparer functionality to act predictably for your object type but by then you're overcomplicating the solution and doing an 0N2 bubble sort every time you add an object. By then we may as well use the magic of LINQ to compare values before we even instantiate the new emote object, which the SortedSet<> solution would not be able to do |
I realize that may seem hypocritical given we use a SortedSet<> for handling comment additions, however in that case we are using it to sort the comments by their offsets. That's more what SortedSet<> is for rather than using it to only remove duplicate elements |
…rcent reports to chatupdate
…rseChatJsonInfo, cleanup
…k, other README improvements
Move json, html, txt chat operations to dedicated classes, Fix sample text height being computed every render tick as it is expensive, Rewrite SubstringToTextWidth() to use spans, Cleanup
…t emoji check from LINQ to foreach (faster), use arrays instead of lists, stringbuilders instead of strings where possible, combine some Rtl and non-Rtl functions, cleanup
Changes, Fixes, and Additions:
CLI
PreParseArgs.ConvertFromOldSyntax()
to be more readable and flexibleCore
--embed-missing
embeddedData
property isnull
comments
andembeddedData
properties from chat jsons to reduce useless memory usageChatRender
after copying to embed lists to further reduce memory usageReportType.Message[Info]
toReportType.Status[Info]
for better claritytimestamp-format = None
has the same functionalitySubstringToTextWidth()
to use spansWPF
Other
Notes: