Skip to content

Commit

Permalink
Fixing some logging issues.
Browse files Browse the repository at this point in the history
Added debugging every time we execute an external program.
  • Loading branch information
maxpiva committed Nov 29, 2023
1 parent 4a647ae commit 999611d
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 10 deletions.
6 changes: 3 additions & 3 deletions Sushi.Net.Library/Sushi.Net.Library.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Version>1.0.0</Version>
<Version>1.0.1</Version>
<Authors>Máximo Piva</Authors>
<Company />
<Product />
Expand All @@ -17,8 +17,8 @@ Or it can shift in chunks a foreign/original audio stream to match another forei
<PackageIcon>sushi.png</PackageIcon>
<RepositoryUrl>https://github.com/maxpiva/Sushi.Net</RepositoryUrl>
<PackageTags>.net sushi subtitle audio shifter</PackageTags>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<AssemblyVersion>1.0.1.0</AssemblyVersion>
<FileVersion>1.0.1.0</FileVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down
8 changes: 5 additions & 3 deletions Sushi.Net.Library/Tools/FFMpeg.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public async Task ShiftAudioAsync(Decoding.AudioMedia stream, string path, List<
catch(Exception e)

{
_logger.LogDebug("Exception Error: "+e.ToString(),e);
_logger.LogError("Exception Error: "+e.ToString(),e);
throw new SushiException("Couldn't invoke ffmpeg, check that it's installed");
}
}
Expand Down Expand Up @@ -252,9 +252,10 @@ public async Task ShiftAudioAsync(AudioMedia stream, string path, List<Split> sp
Command cmd = Command.WithArguments(arguments);
await ExecuteAsync(cmd,true,new FFMpegPercentageProcessor()).ConfigureAwait(false);
}
catch
catch(Exception e)

{
_logger.LogError("Exception Error: " + e.ToString(), e);
throw new SushiException("Couldn't invoke ffmpeg, check that it's installed");
}
}
Expand Down Expand Up @@ -372,8 +373,9 @@ public async Task DeMux(Mux mux)
}

}
catch
catch(Exception e)
{
_logger.LogError("Exception Error: " + e.ToString(), e);
throw new SushiException("Couldn't invoke ffmpeg, check that it's installed");
}
}
Expand Down
2 changes: 1 addition & 1 deletion Sushi.Net.Library/Tools/FFProbe.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public async Task PopulateMediaInfoAsync(Mux r, string file)
}
catch (Exception e)
{
Console.WriteLine(e);
_logger.LogError("Error getting media information. Exception: "+e);
throw;
}
if (b.chapters != null && b.chapters.Count > 0)
Expand Down
1 change: 1 addition & 0 deletions Sushi.Net.Library/Tools/SCXviD.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public async Task MakeKeyframes(string video_path, string log_path)
_ffmpeg.CheckIfRequired(false);
_logger.LogInformation($"Generating keyframes for {video_path}...");
Command ffmpeg = _ffmpeg.Command.WithArguments("-i " + video_path.Quote() + " -f yuv4mpegpipe -vf scale=640:360 -pix_fmt yuv420p -vsync drop -").WithStandardErrorPipe(PipeTarget.ToStringBuilder(bld));
_logger.LogDebug("CMD: " + ffmpeg.ToString());
IPercentageProcessor p = new FFMpeg.FFMpegPercentageProcessor();
IProgress<int> pro = CreateProgress(p);
ffmpeg = AddStandardErrorLogging(ffmpeg, p,pro);
Expand Down
1 change: 1 addition & 0 deletions Sushi.Net.Library/Tools/Tool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public async Task<string> ExecuteAsync(Command cmd, bool useStdError=true, IPerc
{
try
{
_logger.LogDebug("CMD: "+cmd.ToString());
IProgress<int> pro = CreateProgress(percentageProcessor);
return await cmd.WithLogger(_logger, _cancellation.GetToken(), useStdError,percentageProcessor, pro, enc).ConfigureAwait(false);
}
Expand Down
2 changes: 2 additions & 0 deletions Sushi.Net/ConsoleFormatter/SushiFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public override void Write<TState>(in LogEntry<TState> logEntry, IExternalScopeP
return;
}

if (string.IsNullOrEmpty(message))
return;
string nline = firstwrite ? "" : "\n";
if (message == nline)
{
Expand Down
6 changes: 3 additions & 3 deletions Sushi.Net/Sushi.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
<PackageProjectUrl>https://github.com/maxpiva/Sushi.Net</PackageProjectUrl>
<RepositoryUrl>https://github.com/maxpiva/Sushi.Net</RepositoryUrl>
<PackageTags>.net sushi subtitle audio shifter</PackageTags>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<AssemblyVersion>1.0.1.0</AssemblyVersion>
<FileVersion>1.0.1.0</FileVersion>
<Description>Sushi.Net Library
Automatic Subtitle &amp; Audio Shifter
It can shift subtitles based on two different audio streams using pattern matching.
Or it can shift in chunks a foreign/original audio stream to match another foreign/original audio stream using the ambience sound pattern matching.</Description>
<Copyright>Copyright © 2023 Máximo Piva</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<Version>1.0.0</Version>
<Version>1.0.1</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
Expand Down

0 comments on commit 999611d

Please sign in to comment.