Skip to content

Commit

Permalink
Fix #53
Browse files Browse the repository at this point in the history
  • Loading branch information
lay295 committed Aug 16, 2020
1 parent df216e1 commit a06d372
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions TwitchDownloaderCLI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,14 @@ private static void DownloadChat(Options inputOptions)
downloadOptions.IsJson = true;
}

downloadOptions.Id = inputOptions.Id;
downloadOptions.CropBeginning = inputOptions.CropBeginningTime == 0.0 ? false : true;
downloadOptions.CropBeginningTime = inputOptions.CropBeginningTime;
downloadOptions.CropEnding = inputOptions.CropEndingTime == 0.0 ? false : true;
downloadOptions.CropEndingTime = inputOptions.CropEndingTime;
downloadOptions.Timestamp = inputOptions.Timestamp;
downloadOptions.EmbedEmotes = inputOptions.EmbedEmotes;
downloadOptions.Filename = inputOptions.OutputFile;

ChatDownloader chatDownloader = new ChatDownloader(downloadOptions);
Progress<ProgressReport> progress = new Progress<ProgressReport>();
Expand Down
2 changes: 1 addition & 1 deletion TwitchDownloaderCLI/TwitchDownloaderCLI.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand Down
2 changes: 1 addition & 1 deletion TwitchDownloaderCore/ChatRenderer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ public static SKBitmap DrawMessage(SKBitmap sectionImage, List<SKBitmap> imageLi
sectionImage = AddImageSection(sectionImage, imageList, renderOptions, currentGifEmotes, canvasSize, ref drawPos, default_x);

float emojiLeft = (float)drawPos.X;
float emojiTop = (float)Math.Floor((renderOptions.EmoteScale - emojiSize) / 2.0);
float emojiTop = (float)Math.Floor((renderOptions.SectionHeight - emojiSize) / 2.0);
SKRect emojiRect = new SKRect(emojiLeft, emojiTop, emojiLeft + emojiSize, emojiTop + emojiSize);
sectionImageCanvas.DrawBitmap(emojiBitmap, emojiRect, imagePaint);
drawPos.X += (int)Math.Floor(emojiSize + (int)Math.Floor(3 * renderOptions.EmoteScale));
Expand Down
2 changes: 1 addition & 1 deletion TwitchDownloaderCore/TwitchHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,14 @@ public static Dictionary<string, SKBitmap> GetEmotes(List<Comment> comments, str
{
string filePath = Path.Combine(emoteFolder, id + "_1x.png");
byte[] bytes = client.DownloadData(response["archived_snapshots"]["closest"]["url"].ToString().Replace("/https://static-cdn.jtvnw.net", "if_/https://static-cdn.jtvnw.net"));
File.WriteAllBytes(filePath, bytes);
MemoryStream ms = new MemoryStream(bytes);
SKBitmap emoteImage = SKBitmap.Decode(ms);
SKBitmap emoteImageScaled = new SKBitmap(28, 28);
emoteImage.ScalePixels(emoteImageScaled, SKFilterQuality.High);
alreadyAdded.Add(id);
returnDictionary.Add(id, emoteImageScaled);
emoteImage.Dispose();
emoteImageScaled.Encode(SKEncodedImageFormat.Png, 100).SaveTo(new FileStream(filePath, FileMode.Create));
foundEmote = true;
break;
}
Expand Down

0 comments on commit a06d372

Please sign in to comment.