Skip to content

Commit

Permalink
Update NuGet packages
Browse files Browse the repository at this point in the history
Closes #405
  • Loading branch information
Tyrrrz committed Dec 27, 2023
1 parent 74aa85d commit 8383ff2
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 39 deletions.
41 changes: 20 additions & 21 deletions YoutubeDownloader.Core/Downloading/VideoDownloader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,31 +49,30 @@ public class VideoDownloader(IReadOnlyList<Cookie>? initialCookies = null)
)
{
// Include subtitles in the output container
var trackInfos =
includeSubtitles && !downloadOption.Container.IsAudioOnly
? (
await _youtube
.Videos
.ClosedCaptions
.GetManifestAsync(video.Id, cancellationToken)
).Tracks
: Array.Empty<ClosedCaptionTrackInfo>();
var trackInfos = new List<ClosedCaptionTrackInfo>();
if (includeSubtitles && !downloadOption.Container.IsAudioOnly)
{
var manifest = await _youtube.Videos.ClosedCaptions.GetManifestAsync(
video.Id,
cancellationToken
);

trackInfos.AddRange(manifest.Tracks);
}

var dirPath = Path.GetDirectoryName(filePath);
if (!string.IsNullOrWhiteSpace(dirPath))
Directory.CreateDirectory(dirPath);

await _youtube
.Videos
.DownloadAsync(
downloadOption.StreamInfos,
trackInfos,
new ConversionRequestBuilder(filePath)
.SetContainer(downloadOption.Container)
.SetPreset(ConversionPreset.Medium)
.Build(),
progress?.ToDoubleBased(),
cancellationToken
);
await _youtube.Videos.DownloadAsync(
downloadOption.StreamInfos,
trackInfos,
new ConversionRequestBuilder(filePath)
.SetContainer(downloadOption.Container)
.SetPreset(ConversionPreset.Medium)
.Build(),
progress?.ToDoubleBased(),
cancellationToken
);
}
}
10 changes: 5 additions & 5 deletions YoutubeDownloader.Core/Resolving/QueryResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ public class QueryResolver(IReadOnlyList<Cookie>? initialCookies = null)
// Channel (by handle)
if (isUrl && ChannelHandle.TryParse(query) is { } channelHandle)
{
var channel = await _youtube
.Channels
.GetByHandleAsync(channelHandle, cancellationToken);
var channel = await _youtube.Channels.GetByHandleAsync(
channelHandle,
cancellationToken
);

var videos = await _youtube.Channels.GetUploadsAsync(channel.Id, cancellationToken);
return new QueryResult(QueryResultKind.Channel, $"Channel: {channel.Title}", videos);
Expand All @@ -81,8 +82,7 @@ public class QueryResolver(IReadOnlyList<Cookie>? initialCookies = null)
// Search
{
var videos = await _youtube
.Search
.GetVideosAsync(query, cancellationToken)
.Search.GetVideosAsync(query, cancellationToken)
.CollectAsync(20);

return new QueryResult(QueryResultKind.Search, $"Search: {query}", videos);
Expand Down
11 changes: 5 additions & 6 deletions YoutubeDownloader.Core/Tagging/MediaTagInjector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ private void InjectMiscMetadata(MediaFile mediaFile, IVideo video)
video.Title.Contains(r.Title, StringComparison.OrdinalIgnoreCase)
&& (
video.Title.Contains(r.Artist, StringComparison.OrdinalIgnoreCase)
|| video
.Author
.ChannelTitle
.Contains(r.Artist, StringComparison.OrdinalIgnoreCase)
|| video.Author.ChannelTitle.Contains(
r.Artist,
StringComparison.OrdinalIgnoreCase
)
)
);

Expand All @@ -72,8 +72,7 @@ private void InjectMiscMetadata(MediaFile mediaFile, IVideo video)
{
var thumbnailUrl =
video
.Thumbnails
.Where(
.Thumbnails.Where(
t =>
string.Equals(
t.TryGetImageFormat(),
Expand Down
6 changes: 3 additions & 3 deletions YoutubeDownloader.Core/YoutubeDownloader.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<PackageReference Include="CSharpier.MsBuild" Version="0.26.5" PrivateAssets="all" />
<PackageReference Include="CSharpier.MsBuild" Version="0.26.7" PrivateAssets="all" />
<PackageReference Include="Gress" Version="2.1.1" />
<PackageReference Include="JsonExtensions" Version="1.2.0" />
<PackageReference Include="Lazy.Fody" Version="1.11.0" PrivateAssets="all" />
<PackageReference Include="TagLibSharp" Version="2.3.0" />
<PackageReference Include="YoutubeExplode" Version="6.3.9" />
<PackageReference Include="YoutubeExplode.Converter" Version="6.3.9" />
<PackageReference Include="YoutubeExplode" Version="6.3.10" />
<PackageReference Include="YoutubeExplode.Converter" Version="6.3.10" />
</ItemGroup>

</Project>
3 changes: 1 addition & 2 deletions YoutubeDownloader/Services/SettingsService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,7 @@ private static bool IsDarkModeEnabledByDefault()
try
{
return Registry
.CurrentUser
.OpenSubKey(
.CurrentUser.OpenSubKey(
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize",
false
)
Expand Down
4 changes: 2 additions & 2 deletions YoutubeDownloader/YoutubeDownloader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@

<ItemGroup>
<PackageReference Include="Cogwheel" Version="2.0.4" />
<PackageReference Include="CSharpier.MsBuild" Version="0.26.5" PrivateAssets="all" />
<PackageReference Include="CSharpier.MsBuild" Version="0.26.7" PrivateAssets="all" />
<PackageReference Include="Deorcify" Version="1.0.2" PrivateAssets="all" />
<PackageReference Include="DotnetRuntimeBootstrapper" Version="2.5.1" PrivateAssets="all" />
<PackageReference Include="Gress" Version="2.1.1" />
<PackageReference Include="MaterialDesignColors" Version="2.1.4" />
<PackageReference Include="MaterialDesignThemes" Version="4.9.0" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2151.40" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2210.55" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.77" />
<PackageReference Include="Onova" Version="2.6.10" />
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" PrivateAssets="all" />
Expand Down

0 comments on commit 8383ff2

Please sign in to comment.