Allow 33 mb text subtitles + unlimeted .ass files in cmd line convert - thx JeWe37 :)

Fix #7244
This commit is contained in:
niksedk 2023-08-17 11:09:00 +02:00
parent 83eb4b9667
commit b86e4a9e4a

View File

@ -776,7 +776,7 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert
}
}
if (!done && fileInfo.Length < 10 * 1024 * 1024) // max 10 mb
if (!done && IsFileLengthOkForTextSubtitle(fileName, fileInfo)) // max 10 mb
{
format = sub.LoadSubtitle(fileName, out _, null, true, frameRate);
@ -842,7 +842,7 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert
if (!done && format == null)
{
if (fileInfo.Length < 1024 * 1024) // max 1 mb
if (IsFileLengthOkForTextSubtitle(fileName, fileInfo))
{
_stdOutWriter.WriteLine($"{fileName}: {targetFormat} - input file format unknown!");
}
@ -888,6 +888,16 @@ namespace Nikse.SubtitleEdit.Logic.CommandLineConvert
return (count == converted && errors == 0) ? 0 : 1;
}
private static bool IsFileLengthOkForTextSubtitle(string fileName, FileInfo fileInfo)
{
if (fileName.EndsWith(".ass", StringComparison.OrdinalIgnoreCase))
{
return true;
}
return fileInfo.Length < 33 * 1024 * 1024; // max 33 mb
}
private static void LoadProfile(string profileName)
{
var profile = Configuration.Settings.General.Profiles.FirstOrDefault(p => p.Name.Equals(profileName, StringComparison.OrdinalIgnoreCase));