Skip to content

Commit a06d372

Browse files
committed
Fix #53
1 parent df216e1 commit a06d372

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

TwitchDownloaderCLI/Program.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,14 @@ private static void DownloadChat(Options inputOptions)
126126
downloadOptions.IsJson = true;
127127
}
128128

129+
downloadOptions.Id = inputOptions.Id;
129130
downloadOptions.CropBeginning = inputOptions.CropBeginningTime == 0.0 ? false : true;
130131
downloadOptions.CropBeginningTime = inputOptions.CropBeginningTime;
131132
downloadOptions.CropEnding = inputOptions.CropEndingTime == 0.0 ? false : true;
132133
downloadOptions.CropEndingTime = inputOptions.CropEndingTime;
133134
downloadOptions.Timestamp = inputOptions.Timestamp;
134135
downloadOptions.EmbedEmotes = inputOptions.EmbedEmotes;
136+
downloadOptions.Filename = inputOptions.OutputFile;
135137

136138
ChatDownloader chatDownloader = new ChatDownloader(downloadOptions);
137139
Progress<ProgressReport> progress = new Progress<ProgressReport>();

TwitchDownloaderCLI/TwitchDownloaderCLI.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>

TwitchDownloaderCore/ChatRenderer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ public static SKBitmap DrawMessage(SKBitmap sectionImage, List<SKBitmap> imageLi
540540
sectionImage = AddImageSection(sectionImage, imageList, renderOptions, currentGifEmotes, canvasSize, ref drawPos, default_x);
541541

542542
float emojiLeft = (float)drawPos.X;
543-
float emojiTop = (float)Math.Floor((renderOptions.EmoteScale - emojiSize) / 2.0);
543+
float emojiTop = (float)Math.Floor((renderOptions.SectionHeight - emojiSize) / 2.0);
544544
SKRect emojiRect = new SKRect(emojiLeft, emojiTop, emojiLeft + emojiSize, emojiTop + emojiSize);
545545
sectionImageCanvas.DrawBitmap(emojiBitmap, emojiRect, imagePaint);
546546
drawPos.X += (int)Math.Floor(emojiSize + (int)Math.Floor(3 * renderOptions.EmoteScale));

TwitchDownloaderCore/TwitchHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,14 @@ public static Dictionary<string, SKBitmap> GetEmotes(List<Comment> comments, str
286286
{
287287
string filePath = Path.Combine(emoteFolder, id + "_1x.png");
288288
byte[] bytes = client.DownloadData(response["archived_snapshots"]["closest"]["url"].ToString().Replace("/https://static-cdn.jtvnw.net", "if_/https://static-cdn.jtvnw.net"));
289-
File.WriteAllBytes(filePath, bytes);
290289
MemoryStream ms = new MemoryStream(bytes);
291290
SKBitmap emoteImage = SKBitmap.Decode(ms);
292291
SKBitmap emoteImageScaled = new SKBitmap(28, 28);
293292
emoteImage.ScalePixels(emoteImageScaled, SKFilterQuality.High);
294293
alreadyAdded.Add(id);
295294
returnDictionary.Add(id, emoteImageScaled);
296295
emoteImage.Dispose();
296+
emoteImageScaled.Encode(SKEncodedImageFormat.Png, 100).SaveTo(new FileStream(filePath, FileMode.Create));
297297
foundEmote = true;
298298
break;
299299
}

0 commit comments

Comments
 (0)