mirror of
https://github.com/rosenbjerg/FFMpegCore.git
synced 2025-01-18 12:36:44 +00:00
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".
This commit is contained in:
parent
72eddfca6d
commit
ff42378834
1 changed files with 4 additions and 1 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue