Skip to content

Commit

Permalink
Update NuGet packages
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyrrrz committed Dec 27, 2023
1 parent c0b705a commit 33e10dd
Show file tree
Hide file tree
Showing 30 changed files with 141 additions and 188 deletions.
56 changes: 24 additions & 32 deletions YoutubeExplode.Converter.Tests/GeneralSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,10 @@ public async Task I_can_download_a_video_as_a_single_mp4_file_with_multiple_stre
.Take(3)
.ToArray();

await youtube
.Videos
.DownloadAsync(
videoStreamInfos.Concat<IStreamInfo>(audioStreamInfos).ToArray(),
new ConversionRequestBuilder(filePath).Build()
);
await youtube.Videos.DownloadAsync(
videoStreamInfos.Concat<IStreamInfo>(audioStreamInfos).ToArray(),
new ConversionRequestBuilder(filePath).Build()
);

// Assert
MediaFormat.IsMp4File(filePath).Should().BeTrue();
Expand Down Expand Up @@ -155,12 +153,10 @@ public async Task I_can_download_a_video_as_a_single_webm_file_with_multiple_str
.Take(3)
.ToArray();

await youtube
.Videos
.DownloadAsync(
videoStreamInfos.Concat<IStreamInfo>(audioStreamInfos).ToArray(),
new ConversionRequestBuilder(filePath).Build()
);
await youtube.Videos.DownloadAsync(
videoStreamInfos.Concat<IStreamInfo>(audioStreamInfos).ToArray(),
new ConversionRequestBuilder(filePath).Build()
);

// Assert
MediaFormat.IsWebMFile(filePath).Should().BeTrue();
Expand All @@ -184,16 +180,14 @@ public async Task I_can_download_a_video_using_custom_conversion_settings()
var filePath = Path.Combine(dir.Path, "video.mp3");

// Act
await youtube
.Videos
.DownloadAsync(
"9bZkp7q19f0",
filePath,
o =>
o.SetFFmpegPath(FFmpeg.FilePath)
.SetContainer("mp4")
.SetPreset(ConversionPreset.UltraFast)
);
await youtube.Videos.DownloadAsync(
"9bZkp7q19f0",
filePath,
o =>
o.SetFFmpegPath(FFmpeg.FilePath)
.SetContainer("mp4")
.SetPreset(ConversionPreset.UltraFast)
);

// Assert
MediaFormat.IsMp4File(filePath).Should().BeTrue();
Expand All @@ -211,16 +205,14 @@ public async Task I_can_try_to_download_a_video_and_get_an_error_if_the_conversi
// Act & assert
var ex = await Assert.ThrowsAnyAsync<Exception>(
async () =>
await youtube
.Videos
.DownloadAsync(
"9bZkp7q19f0",
filePath,
o =>
o.SetFFmpegPath(FFmpeg.FilePath)
.SetContainer("invalid_format")
.SetPreset(ConversionPreset.UltraFast)
)
await youtube.Videos.DownloadAsync(
"9bZkp7q19f0",
filePath,
o =>
o.SetFFmpegPath(FFmpeg.FilePath)
.SetContainer("invalid_format")
.SetPreset(ConversionPreset.UltraFast)
)
);

Directory.EnumerateFiles(dir.Path, "*", SearchOption.AllDirectories).Should().BeEmpty();
Expand Down
16 changes: 10 additions & 6 deletions YoutubeExplode.Converter.Tests/SubtitleSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ public async Task I_can_download_a_video_as_a_single_mp4_file_with_subtitles()
var trackInfos = trackManifest.Tracks;

// Act
await youtube
.Videos
.DownloadAsync(streamInfos, trackInfos, new ConversionRequestBuilder(filePath).Build());
await youtube.Videos.DownloadAsync(
streamInfos,
trackInfos,
new ConversionRequestBuilder(filePath).Build()
);

// Assert
MediaFormat.IsMp4File(filePath).Should().BeTrue();
Expand Down Expand Up @@ -73,9 +75,11 @@ public async Task I_can_download_a_video_as_a_single_webm_file_with_subtitles()
var trackInfos = trackManifest.Tracks;

// Act
await youtube
.Videos
.DownloadAsync(streamInfos, trackInfos, new ConversionRequestBuilder(filePath).Build());
await youtube.Videos.DownloadAsync(
streamInfos,
trackInfos,
new ConversionRequestBuilder(filePath).Build()
);

// Assert
MediaFormat.IsWebMFile(filePath).Should().BeTrue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" PrivateAssets="all" />
<PackageReference Include="CSharpier.MsBuild" Version="0.26.5" PrivateAssets="all" />
<PackageReference Include="CSharpier.MsBuild" Version="0.26.7" PrivateAssets="all" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" PrivateAssets="all" />
<PackageReference Include="Gress" Version="2.1.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5" PrivateAssets="all" />
<PackageReference Include="xunit" Version="2.6.4" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
18 changes: 12 additions & 6 deletions YoutubeExplode.Converter/Converter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,12 @@ internal partial class Converter(VideoClient videoClient, FFmpeg ffmpeg, Convers

streamInputs.Add(streamInput);

await videoClient
.Streams
.DownloadAsync(streamInfo, streamInput.FilePath, streamProgress, cancellationToken);
await videoClient.Streams.DownloadAsync(
streamInfo,
streamInput.FilePath,
streamProgress,
cancellationToken
);
}

progress?.Report(1);
Expand Down Expand Up @@ -225,9 +228,12 @@ await videoClient

subtitleInputs.Add(subtitleInput);

await videoClient
.ClosedCaptions
.DownloadAsync(trackInfo, subtitleInput.FilePath, trackProgress, cancellationToken);
await videoClient.ClosedCaptions.DownloadAsync(
trackInfo,
subtitleInput.FilePath,
trackProgress,
cancellationToken
);
}

progress?.Report(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ internal static class LanguageExtensions
{
// YouTube provides either a two-letter or a three-letter language code,
// which may or may not also contain a region identifier.
var regionNeutralLanguageCode = language
.Code
.SubstringUntil("-", StringComparison.OrdinalIgnoreCase);
var regionNeutralLanguageCode = language.Code.SubstringUntil(
"-",
StringComparison.OrdinalIgnoreCase
);

// Already a three-letter code
if (regionNeutralLanguageCode.Length == 3)
Expand Down
2 changes: 1 addition & 1 deletion YoutubeExplode.Converter/YoutubeExplode.Converter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<ItemGroup>
<PackageReference Include="CliWrap" Version="3.6.4" />
<PackageReference Include="CSharpier.MsBuild" Version="0.26.5" PrivateAssets="all" />
<PackageReference Include="CSharpier.MsBuild" Version="0.26.7" PrivateAssets="all" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="all" />
<PackageReference Include="PolyShim" Version="1.8.0" PrivateAssets="all" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion YoutubeExplode.Demo.Cli/YoutubeExplode.Demo.Cli.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CSharpier.MsBuild" Version="0.26.5" PrivateAssets="all" />
<PackageReference Include="CSharpier.MsBuild" Version="0.26.7" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
9 changes: 5 additions & 4 deletions YoutubeExplode.Demo.Gui/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -316,10 +316,11 @@ private async Task DownloadClosedCaptionTrackAsync(ClosedCaptionTrackInfo trackI
var progressHandler = new Progress<double>(p => Progress = p);

// Download to file
await _youtube
.Videos
.ClosedCaptions
.DownloadAsync(trackInfo, filePath, progressHandler);
await _youtube.Videos.ClosedCaptions.DownloadAsync(
trackInfo,
filePath,
progressHandler
);
}
finally
{
Expand Down
2 changes: 1 addition & 1 deletion YoutubeExplode.Demo.Gui/YoutubeExplode.Demo.Gui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="CSharpier.MsBuild" Version="0.26.5" PrivateAssets="all" />
<PackageReference Include="CSharpier.MsBuild" Version="0.26.7" PrivateAssets="all" />
<PackageReference Include="MaterialDesignColors" Version="2.1.4" />
<PackageReference Include="MaterialDesignThemes" Version="4.9.0" />
</ItemGroup>
Expand Down
51 changes: 21 additions & 30 deletions YoutubeExplode.Tests/ClosedCaptionSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@ public async Task I_can_get_the_list_of_available_closed_caption_tracks_on_a_vid
var youtube = new YoutubeClient();

// Act
var manifest = await youtube
.Videos
.ClosedCaptions
.GetManifestAsync(VideoIds.WithClosedCaptions);
var manifest = await youtube.Videos.ClosedCaptions.GetManifestAsync(
VideoIds.WithClosedCaptions
);

// Assert
manifest.Tracks.Should().HaveCountGreaterOrEqualTo(3);

manifest
.Tracks
.Should()
.Tracks.Should()
.Contain(
t =>
t.Language.Code == "en"
Expand All @@ -36,8 +34,7 @@ public async Task I_can_get_the_list_of_available_closed_caption_tracks_on_a_vid
);

manifest
.Tracks
.Should()
.Tracks.Should()
.Contain(
t =>
t.Language.Code == "en-US"
Expand All @@ -46,8 +43,7 @@ public async Task I_can_get_the_list_of_available_closed_caption_tracks_on_a_vid
);

manifest
.Tracks
.Should()
.Tracks.Should()
.Contain(
t =>
t.Language.Code == "es-419"
Expand All @@ -63,10 +59,9 @@ public async Task I_can_get_a_specific_closed_caption_track_from_a_video()
var youtube = new YoutubeClient();

// Act
var manifest = await youtube
.Videos
.ClosedCaptions
.GetManifestAsync(VideoIds.WithClosedCaptions);
var manifest = await youtube.Videos.ClosedCaptions.GetManifestAsync(
VideoIds.WithClosedCaptions
);
var trackInfo = manifest.GetByLanguage("en-US");

var track = await youtube.Videos.ClosedCaptions.GetAsync(trackInfo);
Expand All @@ -82,10 +77,9 @@ public async Task I_can_get_a_specific_closed_caption_track_from_a_video_that_ha
var youtube = new YoutubeClient();

// Act
var manifest = await youtube
.Videos
.ClosedCaptions
.GetManifestAsync(VideoIds.WithBrokenClosedCaptions);
var manifest = await youtube.Videos.ClosedCaptions.GetManifestAsync(
VideoIds.WithBrokenClosedCaptions
);
var trackInfo = manifest.GetByLanguage("en");

var track = await youtube.Videos.ClosedCaptions.GetAsync(trackInfo);
Expand All @@ -101,10 +95,9 @@ public async Task I_can_get_an_individual_closed_caption_from_a_video()
var youtube = new YoutubeClient();

// Act
var manifest = await youtube
.Videos
.ClosedCaptions
.GetManifestAsync(VideoIds.WithClosedCaptions);
var manifest = await youtube.Videos.ClosedCaptions.GetManifestAsync(
VideoIds.WithClosedCaptions
);
var trackInfo = manifest.GetByLanguage("en-US");

var track = await youtube.Videos.ClosedCaptions.GetAsync(trackInfo);
Expand All @@ -122,10 +115,9 @@ public async Task I_can_get_an_individual_closed_caption_part_from_a_video()
var youtube = new YoutubeClient();

// Act
var manifest = await youtube
.Videos
.ClosedCaptions
.GetManifestAsync(VideoIds.WithClosedCaptions);
var manifest = await youtube.Videos.ClosedCaptions.GetManifestAsync(
VideoIds.WithClosedCaptions
);
var trackInfo = manifest.GetByLanguage("en");

var track = await youtube.Videos.ClosedCaptions.GetAsync(trackInfo);
Expand All @@ -146,10 +138,9 @@ public async Task I_can_download_a_specific_closed_caption_track_from_a_video()
var youtube = new YoutubeClient();

// Act
var manifest = await youtube
.Videos
.ClosedCaptions
.GetManifestAsync(VideoIds.WithClosedCaptions);
var manifest = await youtube.Videos.ClosedCaptions.GetManifestAsync(
VideoIds.WithClosedCaptions
);
var trackInfo = manifest.GetByLanguage("en-US");

await youtube.Videos.ClosedCaptions.DownloadAsync(trackInfo, file.Path);
Expand Down
3 changes: 1 addition & 2 deletions YoutubeExplode.Tests/PlaylistSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ public async Task I_can_get_the_metadata_of_a_playlist()
playlist.Author?.ChannelUrl.Should().NotBeNullOrWhiteSpace();
playlist.Author?.ChannelTitle.Should().Be("Google Analytics");
playlist
.Description
.Should()
.Description.Should()
.Contain("Digital Analytics Fundamentals course on Analytics Academy");
playlist.Thumbnails.Should().NotBeEmpty();
}
Expand Down
7 changes: 3 additions & 4 deletions YoutubeExplode.Tests/StreamSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ public async Task I_can_get_the_list_of_available_streams_of_a_video()
var youtube = new YoutubeClient();

// Act
var manifest = await youtube
.Videos
.Streams
.GetManifestAsync(VideoIds.WithHighQualityStreams);
var manifest = await youtube.Videos.Streams.GetManifestAsync(
VideoIds.WithHighQualityStreams
);

// Assert
manifest.Streams.Should().NotBeEmpty();
Expand Down
3 changes: 1 addition & 2 deletions YoutubeExplode.Tests/VideoSpecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ public async Task I_can_get_the_metadata_of_a_video()
video.Duration.Should().BeCloseTo(TimeSpan.FromSeconds(252), TimeSpan.FromSeconds(1));
video.Thumbnails.Should().NotBeEmpty();
video
.Keywords
.Should()
.Keywords.Should()
.BeEquivalentTo(
"PSY",
"싸이",
Expand Down
6 changes: 3 additions & 3 deletions YoutubeExplode.Tests/YoutubeExplode.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" PrivateAssets="all" />
<PackageReference Include="CSharpier.MsBuild" Version="0.26.5" PrivateAssets="all" />
<PackageReference Include="CSharpier.MsBuild" Version="0.26.7" PrivateAssets="all" />
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.3.3" PrivateAssets="all" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="PolyShim" Version="1.8.0" PrivateAssets="all" />
<PackageReference Include="xunit" Version="2.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.5" PrivateAssets="all" />
<PackageReference Include="xunit" Version="2.6.4" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 33e10dd

Please sign in to comment.