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

Model rework #21

Merged
merged 10 commits into from
Apr 21, 2017
Merged
Changes from 1 commit
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
Prev Previous commit
Fix console project
  • Loading branch information
Tyrrrz committed Apr 21, 2017
commit a8b8b32eddddfd4a334fd4a0a0ac30d1028096d6
7 changes: 3 additions & 4 deletions DemoConsole/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,20 +54,19 @@ private static async Task MainAsync()
Console.WriteLine('-'.Repeat(100));

// Print metadata
Console.WriteLine($"Id: {videoInfo.Id} | Title: {videoInfo.Title} | Author: {videoInfo.Author}");
Console.WriteLine($"Id: {videoInfo.Id} | Title: {videoInfo.Title} | Author: {videoInfo.Author.DisplayName}");

// Get the most preferable stream
Console.WriteLine("Looking for the best mixed stream...");
var streamInfo = videoInfo.MixedStreams
.OrderBy(s => s.VideoQuality)
.Last();
string normalizedFileSize = NormalizeFileSize(streamInfo.ContentLength);
string qualityLabel = streamInfo.VideoQuality.GetLabel();
Console.WriteLine($"Quality: {qualityLabel} | Container: {streamInfo.Container} | Size: {normalizedFileSize}");
Console.WriteLine($"Quality: {streamInfo.VideoQualityLabel} | Container: {streamInfo.Container} | Size: {normalizedFileSize}");

// Compose file name, based on metadata
string fileExtension = streamInfo.Container.GetFileExtension();
string fileName = $"{videoInfo.Title}.{qualityLabel}.{fileExtension}";
string fileName = $"{videoInfo.Title}.{fileExtension}";

// Remove illegal characters from file name
fileName = fileName.Except(Path.GetInvalidFileNameChars());
Expand Down