fixed some bugs

This commit is contained in:
Mike Nolan 2022-02-24 15:35:38 -06:00
parent 5f3690b34d
commit 17868d9708
1 changed files with 20 additions and 16 deletions

View File

@ -472,23 +472,27 @@ namespace TYTD
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
foreach (var v in plitem.Videos) foreach (var v in plitem.Videos)
{ {
try
{
var item = JsonConvert.DeserializeObject<SavedVideo>(File.ReadAllText(Path.Combine("Info", $"{v}.json")));
Dictionary<string, string> videos = new Dictionary<string, string>();
videos.AddEscapedHtml("Title", item.Title);
videos.AddEscapedHtml("Id", item.Id);
videos.AddEscapedHtml("AuthorTitle", item.AuthorTitle);
videos.AddEscapedHtml("AuthorChannelId", item.AuthorChannelId);
videos.AddEscapedHtml("DurationStringLong", TimeSpan.FromSeconds(item.Duration).ToString());
videos.AddEscapedHtml("DurationNumber", item.Duration.ToString());
videos.AddEscapedHtml("Likes", item.Likes.ToString());
videos.AddEscapedHtml("Dislikes", item.Dislikes.ToString());
videos.AddEscapedHtml("Views", item.Views.ToString());
var item = JsonConvert.DeserializeObject<SavedVideo>(File.ReadAllText(Path.Combine("Info", $"{v}.json"))); videos.AddEscapedHtml("Description", item.Description);
Dictionary<string, string> videos = new Dictionary<string, string>(); videos.AddEscapedHtml("UploadDate", DateTime.Parse(item.UploadDate).ToShortDateString());
videos.AddEscapedHtml("Title", item.Title); builder.Append(Templating.RenderString(htmlBeforeProcessed, videos));
videos.AddEscapedHtml("Id", item.Id); }catch(Exception ex)
videos.AddEscapedHtml("AuthorTitle", item.AuthorTitle); {
videos.AddEscapedHtml("AuthorChannelId", item.AuthorChannelId); _ = ex;
videos.AddEscapedHtml("DurationStringLong", TimeSpan.FromSeconds(item.Duration).ToString()); }
videos.AddEscapedHtml("DurationNumber", item.Duration.ToString());
videos.AddEscapedHtml("Likes", item.Likes.ToString());
videos.AddEscapedHtml("Dislikes", item.Dislikes.ToString());
videos.AddEscapedHtml("Views", item.Views.ToString());
videos.AddEscapedHtml("Description", item.Description);
videos.AddEscapedHtml("UploadDate", DateTime.Parse(item.UploadDate).ToShortDateString());
builder.Append(Templating.RenderString(htmlBeforeProcessed, videos));
} }
Dictionary<string, string> playlist = new Dictionary<string, string>(); Dictionary<string, string> playlist = new Dictionary<string, string>();