Fix - Issue with description when the mp4 option is enabled https://github.com/Crunchy-DL/Crunchy-Downloader/issues/73

This commit is contained in:
Elwador 2024-08-13 16:03:39 +02:00
parent 52369e84dc
commit 29376c59a6
1 changed files with 8 additions and 2 deletions

View File

@ -61,6 +61,7 @@ public class Merger{
} else{ } else{
metaData.Add($"-disposition:a:{audioIndex} 0"); metaData.Add($"-disposition:a:{audioIndex} 0");
} }
index++; index++;
audioIndex++; audioIndex++;
} }
@ -86,9 +87,10 @@ public class Merger{
} else{ } else{
metaData.Add($"-disposition:s:{sub.i} 0"); metaData.Add($"-disposition:s:{sub.i} 0");
} }
index++; index++;
} }
args.AddRange(metaData); args.AddRange(metaData);
// args.AddRange(options.Subtitles.Select((sub, subIndex) => $"-map {subIndex + index}")); // args.AddRange(options.Subtitles.Select((sub, subIndex) => $"-map {subIndex + index}"));
args.Add("-c:v copy"); args.Add("-c:v copy");
@ -106,7 +108,11 @@ public class Merger{
XmlDocument doc = new XmlDocument(); XmlDocument doc = new XmlDocument();
doc.Load(options.Description[0].Path); doc.Load(options.Description[0].Path);
XmlNode? node = doc.SelectSingleNode("//Tag/Simple[Name='DESCRIPTION']/String"); XmlNode? node = doc.SelectSingleNode("//Tag/Simple[Name='DESCRIPTION']/String");
args.Add($"-metadata comment=\"{node?.InnerText ?? string.Empty}\""); string description = node?.InnerText
.Replace("\\", "\\\\") // Escape backslashes
.Replace("\"", "\\\"") // Escape double quotes
?? string.Empty;
args.Add($"-metadata comment=\"{description}\"");
} }
if (options.Options.ffmpeg?.Count > 0){ if (options.Options.ffmpeg?.Count > 0){