diff --git a/Assets/Testing Video/Testing Video.mp4 b/Assets/Testing Video/Testing Video.mp4 new file mode 100644 index 0000000..c6483f9 Binary files /dev/null and b/Assets/Testing Video/Testing Video.mp4 differ diff --git a/ConsoleApp/Program.cs b/ConsoleApp/Program.cs index 1a1769e..a10a60a 100644 --- a/ConsoleApp/Program.cs +++ b/ConsoleApp/Program.cs @@ -103,11 +103,12 @@ private static GatherVideoResult GatherVideosToConvert() Console.WriteLine("Leave empty to save the subtitles in the ./Subtitles folder"); var subtitleOutputPath = Console.ReadLine() ?? string.Empty; + subtitleOutputPath = PathUtil.FormatPath(subtitleOutputPath); Console.WriteLine("Enter the video path or the folder path that contains the videos you want to process..."); var inputPath = Console.ReadLine() ?? string.Empty; //if path starts and ends with ", remove - inputPath = VideoPathFormatter.formatVideoPath(inputPath); + inputPath = PathUtil.FormatPath(inputPath); var videos = VideoFinder.FindVideosBasedOnPath(inputPath); diff --git a/Utility/PathUtil.cs b/Utility/PathUtil.cs new file mode 100644 index 0000000..7c5bc25 --- /dev/null +++ b/Utility/PathUtil.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Utility +{ + public static class PathUtil + { + + public static string FormatPath(string path) + { + //strip first and last " if exists + if (path.StartsWith("\"")) + path = path.Substring(1); + if (path.EndsWith("\"")) + path = path.Substring(0, path.Length - 1); + //strip last \ if exists + if (path.EndsWith("\\")) + path = path.Substring(0, path.Length - 1); + return path; + } + } +} diff --git a/Utility/VideoPathFormatter.cs b/Utility/VideoPathFormatter.cs deleted file mode 100644 index be96a33..0000000 --- a/Utility/VideoPathFormatter.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Utility; - -public static class VideoPathFormatter -{ - public static string formatVideoPath(string rawVideoPath) - { - if (rawVideoPath.StartsWith("\"") && rawVideoPath.EndsWith("\"")) - { - return rawVideoPath[1..^1]; - } - - return rawVideoPath; - } -} \ No newline at end of file