Skip to content

Commit

Permalink
RE_LIVE_PIPE_OPTIONS #162 #182
Browse files Browse the repository at this point in the history
  • Loading branch information
nilaoda committed Jun 14, 2023
1 parent 2e6d10d commit ca5757b
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions src/N_m3u8DL-RE/Util/PipeUtil.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System;
using N_m3u8DL_RE.Common.Log;
using N_m3u8DL_RE.Common.Resource;
using Spectre.Console;
using System;
using System.Collections.Generic;
using System.CommandLine;
using System.Diagnostics;
Expand Down Expand Up @@ -51,6 +54,13 @@ public static bool StartPipeMux(string binary, string[] pipeNames, string output
string dateString = DateTime.Now.ToString("o");
StringBuilder command = new StringBuilder("-y -fflags +genpts -loglevel quiet ");

string? customDest = Environment.GetEnvironmentVariable("RE_LIVE_PIPE_OPTIONS");

if (!string.IsNullOrEmpty(customDest))
{
command.Append(" -re ");
}

foreach (var item in pipeNames)
{
if (OperatingSystem.IsWindows())
Expand All @@ -68,7 +78,20 @@ public static bool StartPipeMux(string binary, string[] pipeNames, string output
command.Append(" -strict unofficial -c copy ");
command.Append($" -metadata date=\"{dateString}\" ");
command.Append($" -ignore_unknown -copy_unknown ");
command.Append($" -f mpegts -shortest \"{outputPath}\"");


if (!string.IsNullOrEmpty(customDest))
{
if (customDest.Trim().StartsWith("-"))
command.Append(customDest);
else
command.Append($" -f mpegts -shortest \"{customDest}\"");
Logger.WarnMarkUp($"[deepskyblue1]{command.ToString().EscapeMarkup()}[/]");
}
else
{
command.Append($" -f mpegts -shortest \"{outputPath}\"");
}

using var p = new Process();
p.StartInfo = new ProcessStartInfo()
Expand Down

0 comments on commit ca5757b

Please sign in to comment.