Filenames cause bugs and Add support for deep folder directories.
Problem Description
Hello
1- The filenames if it looks like "abc~1.mp4"
it will be converted, but when the software tries to save it it can't , you can remove the "~" or "~1" from the name.
Add it to source name cleanup (this may be a fix for the second bug)
2- Adding support for deep folder directories
There is manipulation you can do
Is to get the first letter of each word in the title of the file as to make it fit the maximum length support.
When you save the file, save it with the best fitting title.(you can make it first 3 lettere)
I hope my approach helps you.
My best regards,
What version of VidCoder are you running?
11.3
Encode Log
No response
@RandomEngy I hop you can fix the The filenames bugs
@RandomEngy
@RandomEngy
I hope you take this bug seriously, it makes productivity low, especially on large projects.
Please stop pinging me. I see this, but I have other higher-priority things to work on right now. If you really need this and cannot move your processing to a shorter length directory, you can submit a pull request to fix it.
Hello RandomEngy;
I apologise for the inconvenience. I understand that you have higher priority tasks at the moment. I see your message, and if it's crucial and you're unable to move your processing to a shorter length directory
I am trying to write a snipite to fix this problem, feel free to check it.
Best regards
VidCoder/Services/ProcessingService.cs
try
{
string directory = Path.GetDirectoryName(finalOutputPath);
string outputBaseName = Path.GetFileNameWithoutExtension(finalOutputPath);
string extension = Path.GetExtension(finalOutputPath);
// Calculate the maximum length for the reason
int maxReasonLength = 256 - directory.Length - outputBaseName.Length - extension.Length - 2; // 2 for separators
// Ensure maxReasonLength is at least 1
maxReasonLength = Math.Max(1, maxReasonLength);
// Truncate the reason if it's too long, ensuring it's not empty
string truncatedReason = reason.Length > maxReasonLength ? reason.Substring(0, maxReasonLength) : reason;
truncatedReason = string.IsNullOrEmpty(truncatedReason) ? "X" : truncatedReason;
string destinationPath = Path.Combine(directory, outputBaseName + "." + truncatedReason + extension);
destinationPath = FileUtilities.CreateUniqueFileName(destinationPath, new HashSet<string>());
// Double-check the final path length
if (destinationPath.Length > 256)
{
int excess = destinationPath.Length - 256;
truncatedReason = truncatedReason.Substring(0, Math.Max(1, truncatedReason.Length - excess));
destinationPath = Path.Combine(directory, outputBaseName + "." + truncatedReason + extension);
destinationPath = FileUtilities.CreateUniqueFileName(destinationPath, new HashSet<string>());
}
directOutputFileInfo.MoveTo(destinationPath);
return destinationPath;
}
catch (Exception exception)
{
encodeLogger.Log($"Could not rename failed file '{directOutputFileInfo.FullName}'." + Environment.NewLine + exception);
}
This code assumes that the path can be made to fit within the max just by truncating the file name. What if the output folder is already longer than the max? Also this does not support input of long file names.
Is the only problem you're running into with output file paths that are too long? If so, something along these lines would probably be safe enough.
Also ideally you would test the code as well, and submit a pull request to it on GitHub. Code very rarely works on the first try.