Skip to content

Commit

Permalink
Notify user how many errors have been detected + translations
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkl58 committed Oct 27, 2022
1 parent 7c80b69 commit 299fc52
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 7 deletions.
1 change: 1 addition & 0 deletions NotEnoughAV1Encodes/Audio/EncodeAudio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ public void Encode(Queue.QueueElement queueElement, CancellationToken _token)
else
{
queueElement.Error = true;
queueElement.ErrorCount += 1;
Global.Logger("FATAL - EncodeAudio.Encode() => ExitCode: " + processAudio.ExitCode, queueElement.Output + ".log");
Global.Logger("==========================================================" + stderr, queueElement.Output + ".log");
Global.Logger("==========================================================", queueElement.Output + ".log");
Expand Down
18 changes: 12 additions & 6 deletions NotEnoughAV1Encodes/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1353,33 +1353,39 @@ private void Shutdown()

private void DeleteTempFiles(Queue.QueueElement queueElement, DateTime startTime)
{
string errorText = "";
if (queueElement.Error)
{
errorText = " - " + queueElement.ErrorCount.ToString() + " " + LocalizedStrings.Instance["ErrorsDetected"];
}

if (!File.Exists(queueElement.VideoDB.OutputPath)) {
queueElement.Status = "Error: No Output detected";
queueElement.Status = LocalizedStrings.Instance["OutputErrorDetected"] + errorText;
return;
}

FileInfo videoOutput = new(queueElement.VideoDB.OutputPath);
if (videoOutput.Length <= 50000) {
queueElement.Status = "Possible Muxing Error";
queueElement.Status = LocalizedStrings.Instance["MuxingErrorDetected"] + errorText;
return;
}

TimeSpan timespent = DateTime.Now - startTime;
try {
queueElement.Status = "Finished Encoding - Elapsed Time " + timespent.ToString("hh\\:mm\\:ss") + " - avg " + Math.Round(queueElement.FrameCount / timespent.TotalSeconds, 2) + "fps";
queueElement.Status = LocalizedStrings.Instance["FinishedEncoding"] + " " + timespent.ToString("hh\\:mm\\:ss") + " - avg " + Math.Round(queueElement.FrameCount / timespent.TotalSeconds, 2) + "fps" + errorText;
}
catch
{
queueElement.Status = "Finished Encoding - Elapsed Time " + timespent.ToString("hh\\:mm\\:ss") + " - Error calculating average FPS";
queueElement.Status = LocalizedStrings.Instance["FinishedEncoding"] + " " + timespent.ToString("hh\\:mm\\:ss") + " - Error calculating average FPS" + errorText;
}


if (settingsDB.DeleteTempFiles) {
if (settingsDB.DeleteTempFiles && queueElement.Error == false) {
try {
DirectoryInfo tmp = new(Path.Combine(Global.Temp, "NEAV1E", queueElement.UniqueIdentifier));
tmp.Delete(true);
} catch {
queueElement.Status = "Error Deleting Temp Files";
queueElement.Status = LocalizedStrings.Instance["DeleteErrorDetected"] + errorText;
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions NotEnoughAV1Encodes/Queue/QueueElement.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public string Status
public bool VFR { get; set; }
/// <summary>If true, then there was some Error during the process.</summary>
public bool Error { get; set; }
/// <summary>Amount of Errors</summary>
public int ErrorCount { get; set; } = 0;
/// <summary>PySceneDetect Threshold (after Decimal).</summary>
public float PySceneDetectThreshold { get; set; }
/// <summary>Framecount of Source Video.</summary>
Expand Down
1 change: 1 addition & 0 deletions NotEnoughAV1Encodes/Video/VideoEncode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ public void Encode(int _workerCount, List<string> VideoChunks, Queue.QueueElemen
else
{
queueElement.Error = true;
queueElement.ErrorCount += 1;
Global.Logger("FATAL - VideoEncode.Encode() => Exit Code: " + processVideo.ExitCode + " Chunk: " + chunk, queueElement.Output + ".log");
}
}
Expand Down
1 change: 1 addition & 0 deletions NotEnoughAV1Encodes/Video/VideoMuxer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ private static void MuxMKVMerge(bool mux, Queue.QueueElement queueElement, strin
if (processMKVMerge.ExitCode != 0)
{
queueElement.Error = true;
queueElement.ErrorCount += 1;
Global.Logger("FATAL - VideoMuxer.Concat() => Exit Code: " + processMKVMerge.ExitCode, queueElement.Output + ".log");
Global.Logger("FATAL - VideoMuxer.Concat() => STDOUT: " + _output, queueElement.Output + ".log");
}
Expand Down
1 change: 1 addition & 0 deletions NotEnoughAV1Encodes/Video/VideoSplitter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ private void FFmpegChunking(CancellationToken _token)
else
{
queueElement.Error = true;
queueElement.ErrorCount += 1;
Global.Logger("FATAL - VideoSplitter.Split() => FFmpegChunking() => FFmpeg Exit Code: " + exit_code, queueElement.Output + ".log");
Global.Logger("==========================================================" + stderr, queueElement.Output + ".log");
Global.Logger("==========================================================", queueElement.Output + ".log");
Expand Down
15 changes: 15 additions & 0 deletions NotEnoughAV1Encodes/resources/lang/Strings.de.resx
Original file line number Diff line number Diff line change
Expand Up @@ -518,4 +518,19 @@ Please download and extract 7-zip to the following path:

</value>
</data>
<data name="DeleteErrorDetected" xml:space="preserve">
<value>Fehler beim Löschen von Temp-Dateien</value>
</data>
<data name="ErrorsDetected" xml:space="preserve">
<value>Fehler entdeckt. Bitte überprüfe die Logdatei! Die Temp-Dateien wurden nicht gelöscht!</value>
</data>
<data name="FinishedEncoding" xml:space="preserve">
<value>Encode fertig - Verstrichene Zeit</value>
</data>
<data name="MuxingErrorDetected" xml:space="preserve">
<value>Möglicher Muxing-Fehler</value>
</data>
<data name="OutputErrorDetected" xml:space="preserve">
<value>Fehler: Keine Ausgabedatei erkannt</value>
</data>
</root>
17 changes: 16 additions & 1 deletion NotEnoughAV1Encodes/resources/lang/Strings.fr-FR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -518,4 +518,19 @@ Please download and extract 7-zip to the following path:

</value>
</data>
</root>
<data name="DeleteErrorDetected" xml:space="preserve">
<value>Erreur de suppression des fichiers temporaires</value>
</data>
<data name="ErrorsDetected" xml:space="preserve">
<value>Erreur(s) détectée(s). Veuillez vérifier le fichier journal ! Les fichiers temporaires n'ont pas été supprimés!</value>
</data>
<data name="FinishedEncoding" xml:space="preserve">
<value>Encodage terminé - Temps écoulé</value>
</data>
<data name="MuxingErrorDetected" xml:space="preserve">
<value>Erreur de multiplexage possible</value>
</data>
<data name="OutputErrorDetected" xml:space="preserve">
<value>Erreur : Aucune sortie de fichier détectée</value>
</data>
</root>
15 changes: 15 additions & 0 deletions NotEnoughAV1Encodes/resources/lang/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -521,4 +521,19 @@ Please download and extract 7-zip to the following path:

</value>
</data>
<data name="ErrorsDetected" xml:space="preserve">
<value>Error(s) detected. Please check log file! Temp Files have not been deleted!</value>
</data>
<data name="OutputErrorDetected" xml:space="preserve">
<value>Error: No Output detected</value>
</data>
<data name="MuxingErrorDetected" xml:space="preserve">
<value>Possible Muxing Error</value>
</data>
<data name="DeleteErrorDetected" xml:space="preserve">
<value>Error Deleting Temp Files</value>
</data>
<data name="FinishedEncoding" xml:space="preserve">
<value>Finished Encoding - Elapsed Time</value>
</data>
</root>

0 comments on commit 299fc52

Please sign in to comment.