Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncate FPS values in CLI info table #1169

Merged
merged 2 commits into from
Aug 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions TwitchDownloaderCLI/Modes/InfoHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@
private static void HandleVodRaw(GqlVideoResponse videoInfo, GqlVideoChapterResponse chapters, string playlistString)
{
var stdOut = Console.OpenStandardOutput();
JsonSerializer.Serialize(stdOut, videoInfo);

Check warning on line 101 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 101 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 101 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 101 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 101 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 101 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli-mac

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 101 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli-mac

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.
Console.WriteLine();
JsonSerializer.Serialize(stdOut, chapters);

Check warning on line 103 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 103 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 103 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 103 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 103 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 103 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli-mac

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 103 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli-mac

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.
Console.WriteLine();
Console.Write(playlistString);
}
Expand Down Expand Up @@ -141,23 +141,23 @@
if (hasBitrate)
{
streamTable
.AddColumn(new TableColumn("File size").RightAligned())
.AddColumn(new TableColumn("Bitrate").RightAligned());
.AddColumn(new TableColumn("Bitrate").RightAligned())
.AddColumn(new TableColumn("File size").RightAligned());
}

foreach (var stream in m3u8.Streams)
{
var name = stream.GetResolutionFramerateString();
var resolution = stream.StreamInfo.Resolution.StringifyOrDefault(x => x.ToString(), DEFAULT_STRING);
var fps = stream.StreamInfo.Framerate.StringifyOrDefault(x => x.ToString(CultureInfo.CurrentCulture), DEFAULT_STRING);
var fps = stream.StreamInfo.Framerate.StringifyOrDefault(x => $"{x:F0}", DEFAULT_STRING);
var codecs = stream.StreamInfo.Codecs.StringifyOrDefault(x => x, DEFAULT_STRING);

if (hasBitrate)
{
var videoLength = TimeSpan.FromSeconds(videoInfo.data.video.lengthSeconds);
var fileSize = stream.StreamInfo.Bandwidth.StringifyOrDefault(x => $"~{VideoSizeEstimator.StringifyByteCount(VideoSizeEstimator.EstimateVideoSize(x, TimeSpan.Zero, videoLength))}", DEFAULT_STRING);
var bitrate = stream.StreamInfo.Bandwidth.StringifyOrDefault(x => $"{x / 1000}kbps", DEFAULT_STRING);
streamTable.AddRow(name, resolution, fps, codecs, fileSize, bitrate);
var fileSize = stream.StreamInfo.Bandwidth.StringifyOrDefault(x => $"~{VideoSizeEstimator.StringifyByteCount(VideoSizeEstimator.EstimateVideoSize(x, TimeSpan.Zero, videoLength))}", DEFAULT_STRING);
streamTable.AddRow(name, resolution, fps, codecs, bitrate, fileSize);
}
else
{
Expand Down Expand Up @@ -259,9 +259,9 @@
private static void HandleClipRaw(GqlClipResponse clipInfo, GqlClipTokenResponse clipQualities)
{
var stdOut = Console.OpenStandardOutput();
JsonSerializer.Serialize(stdOut, clipInfo);

Check warning on line 262 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 262 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 262 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 262 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 262 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 262 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli-mac

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 262 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli-mac

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.
Console.WriteLine();
JsonSerializer.Serialize(stdOut, clipQualities);

Check warning on line 264 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 264 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 264 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 264 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 264 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 264 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli-mac

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.

Check warning on line 264 in TwitchDownloaderCLI/Modes/InfoHandler.cs

View workflow job for this annotation

GitHub Actions / build-cli-mac

Using member 'System.Text.Json.JsonSerializer.Serialize<TValue>(Stream, TValue, JsonSerializerOptions)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.
}

private static void HandleClipTable(GqlClipResponse clipInfo, GqlClipTokenResponse clipQualities)
Expand Down Expand Up @@ -303,7 +303,7 @@
{
var name = string.Create(CultureInfo.CurrentCulture, $"{quality.quality}p{quality.frameRate:F0}");
var height = quality.quality;
var fps = quality.frameRate.StringifyOrDefault(x => string.Create(CultureInfo.CurrentCulture, $"{x:F2}"), DEFAULT_STRING);
var fps = quality.frameRate.StringifyOrDefault(x => $"{x:F0}", DEFAULT_STRING);
qualityTable.AddRow(name, height, fps);
}

Expand Down
Loading