❔ Avisynth script maker thing
Im trying to make a script that creates AVS files for every file in a Directory based on a template. Here’s what i have so far:
string[] lines = Directory.GetFiles(@"H:\Cartoons, Anime und co\Jim der Regenwurm");
string text = File.ReadAllText("Template.avs");
foreach(string name in lines)
text = text.Replace("[CLIP]", (name));
File.WriteAllText ("JimNew.avs", text);
I can’t figure out how to make it write every path to a new file that it creates automatically. I tried using foreach but it didn’t work.11 Replies
Well, using
foreach
was a good call
You simply need to include that File.WriteAllText()
inside of the loop
is the equivalent to
not
Protip: always use braces and remember that whitespace in C# doesn't define the scope, it's not PythonThx for the help but i actually got my buddy to help, he made a nice thing
use
EnumerateFiles
instead of GetFiles
var finalFile = Path.Combine(outputPath, $"{fileName}.mkv");
Console.WriteLine("Merging the files");
ExecuteCmd(ffmpegPath, @$"-i ""{videoFile}"" -i ""{audioFile}"" -c copy ""{fileName}""");
void ExecuteCmd(string ffmpegPath, string v)
{
throw new NotImplementedException();
}
trying to mux files using ffmpeg
gives me an error saying not implemented
var ffmpegPath = @"C:\Program Files\FFmpeg\ffmpeg.exe";
var outputPath = @"c:\Temp";
var inputPath = @"C:\EarthwormJimCartoonDVD1\VIDEO_TS\audio";
var audioFile = Path.Combine(inputPath, "$.ac3");
var videoFile = Path.Combine(inputPath, "$.mkv");
var fileName = Path.GetFileNameWithoutExtension(inputPath);
var finalFile = Path.Combine(outputPath, $"{fileName}.mkv");
Console.WriteLine("Merging the files");
ExecuteCmd(ffmpegPath, @$"-i ""{videoFile}"" -i ""{audioFile}"" -c copy ""{fileName}""");
void ExecuteCmd(string cmd, string arguments)
{
var processInfo = new ProcessStartInfo
{
FileName = cmd,
Arguments = arguments,
CreateNoWindow = true,
UseShellExecute = false
};
var process = Process.Start(processInfo);
process?.WaitForExit();
}
full code rnUse the library CliWrap
GitHub
GitHub - Tyrrrz/CliWrap: Library for running command-line processes
Library for running command-line processes. Contribute to Tyrrrz/CliWrap development by creating an account on GitHub.
I mean, it's fine without it, but this thing is more convenient and can escape arguments
Will give that a go
Thx
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.Never got around to trying
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.