Skip to content

Commit

Permalink
Fix broken webm videos
Browse files Browse the repository at this point in the history
  • Loading branch information
ImoutoChan committed Apr 18, 2024
1 parent 144ad20 commit 18efc22
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ private async Task PostNextForActress(Actress actress, params int[] skipIds)
}
}

if (loadedPost.Post.FileSize > 50_000_000)
if (ShouldSkip(loadedPost))
{
var newSkipIds = skipIds.Append(loadedPost.Post.PostHeader.Id).ToArray();
await PostNextForActress(actress, newSkipIds);
Expand All @@ -149,6 +149,8 @@ await _postedMediaRepository.Add(
await post.File.DisposeAsync();
}

private static bool ShouldSkip(LoadedPost loadedPost) => loadedPost.Post.FileSize > 50_000_000;

private async Task<(Message sentPost, string fileId, MediaType fileType)> SentPostToTelegram(
Actress actress,
Post post)
Expand Down
5 changes: 4 additions & 1 deletion Source/WetPicsRebirth/Infrastructure/Engines/BooruEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ async Task<LoadedPost> LoadPostCore()
}

private static string GetMediaUrl(Imouto.BooruParser.Post post)
=> post.OriginalUrl?.EndsWith(".zip") == true ? post.SampleUrl! : post.OriginalUrl!;
=> post.OriginalUrl?.EndsWith(".zip") == true
|| post.OriginalUrl?.EndsWith(".webm") == true
? post.SampleUrl!
: post.OriginalUrl!;

public string CreateCaption(ImageSource source, string options, Post post)
{
Expand Down

0 comments on commit 18efc22

Please sign in to comment.