Skip to content

Commit

Permalink
Fix path formatting + add testing video
Browse files Browse the repository at this point in the history
  • Loading branch information
GewoonJaap committed Nov 10, 2023
1 parent ac17b6a commit 7520729
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
Binary file added Assets/Testing Video/Testing Video.mp4
Binary file not shown.
3 changes: 2 additions & 1 deletion ConsoleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
25 changes: 25 additions & 0 deletions Utility/PathUtil.cs
Original file line number Diff line number Diff line change
@@ -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;
}
}
}
14 changes: 0 additions & 14 deletions Utility/VideoPathFormatter.cs

This file was deleted.

0 comments on commit 7520729

Please sign in to comment.