Skip to content

Commit

Permalink
Truncate FPS values in CLI info table (#1169)
Browse files Browse the repository at this point in the history
* Swap bitrate and file size columns

* Truncate values in FPS table columns
  • Loading branch information
ScrubN authored Aug 2, 2024
1 parent a5ad886 commit b688026
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions TwitchDownloaderCLI/Modes/InfoHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,23 +141,23 @@ private static void HandleVodTable(GqlVideoResponse videoInfo, GqlVideoChapterRe
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 @@ -303,7 +303,7 @@ private static void HandleClipTable(GqlClipResponse clipInfo, GqlClipTokenRespon
{
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

0 comments on commit b688026

Please sign in to comment.