Compare commits

..

2 commits

Author SHA1 Message Date
Brett Baker
1c66b3f21f
Merge ff42378834 into eb221c3e49 2024-11-13 13:45:07 +00:00
Brett Baker
ff42378834 null check on title to not fail Media Analysis
If the title is missing from the analysis metadata, the analysis fails.  Added null check and default value of "TitleValueNotSet".
2024-11-13 08:45:00 -05:00

View file

@ -30,9 +30,12 @@ private MediaFormat ParseFormat(Format analysisFormat)
};
}
private string GetValue(string tagName, Dictionary<string, string>? tags, string defaultValue) =>
tags == null ? defaultValue : tags.TryGetValue(tagName, out var value) ? value : defaultValue;
private ChapterData ParseChapter(Chapter analysisChapter)
{
var title = analysisChapter.Tags.FirstOrDefault(t => t.Key == "title").Value;
var title = GetValue("title", analysisChapter.Tags, "TitleValueNotSet");
var start = MediaAnalysisUtils.ParseDuration(analysisChapter.StartTime);
var end = MediaAnalysisUtils.ParseDuration(analysisChapter.EndTime);