From 78693a06f8adeccbebc985b8da0e4c03bc917e44 Mon Sep 17 00:00:00 2001 From: Frank Skare Date: Wed, 30 Dec 2020 22:28:37 +0100 Subject: [PATCH] New option using the source file folder for temp files --- Changelog.md | 1 + Forms/CommandLineForm.vb | 2 +- Forms/MainForm.vb | 23 +++++++++++++++++- General/GlobalClass.vb | 52 +++++++++++++++++++++------------------- General/Project.vb | 1 + 5 files changed, 53 insertions(+), 26 deletions(-) diff --git a/Changelog.md b/Changelog.md index c2f8d431..030c39eb 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,7 @@ - aomenc bugfixes and UI improvements (Dendraspis, 44vince44, [#375](/../../issues/375)) - x265 by default no longer uses a pipe tool. - aomenc moved cq-level option to "Rate Control 1" for better usage (Dendraspis, Neltulz, [#411](/../../issues/411)) +- New option using the source file folder for temp files. (stax76) 2.1.5.5 Beta (2020-12-30) diff --git a/Forms/CommandLineForm.vb b/Forms/CommandLineForm.vb index 5af8e43f..ed56615c 100644 --- a/Forms/CommandLineForm.vb +++ b/Forms/CommandLineForm.vb @@ -190,7 +190,7 @@ Public Class CommandLineForm Dim max = oParam.Options.Select(Function(txt) txt.Length).Max - If max > 25 Then + If max > 23 Then menuBlock.Button.Expand = True End If diff --git a/Forms/MainForm.vb b/Forms/MainForm.vb index 6ec30cd0..21ddbeff 100644 --- a/Forms/MainForm.vb +++ b/Forms/MainForm.vb @@ -2990,6 +2990,22 @@ Public Class MainForm End If End If + If p.Script.IsAviSynth AndAlso TypeOf p.VideoEncoder Is x264Enc AndAlso + p.Script.Info.ColorSpace <> ColorSpace.YUV420P8 AndAlso + p.Script.Info.ColorSpace <> ColorSpace.YUV422P8 AndAlso + p.Script.Info.ColorSpace <> ColorSpace.YUV444P8 AndAlso + p.Script.Info.ColorSpace <> ColorSpace.BGR32 AndAlso + Not g.ContainsPipeTool(p.VideoEncoder.GetCommandLine(True, True)) Then + + If ProcessTip("x264 AviSynth input supports only YUV420P8, YUV422P8, YUV444P8 and BGR32 " + + $"as input colorspace.{BR}Consider to use a pipe tool: " + + "x264 Options > Input/Output > Pipe > avs2pipemod y4m") Then + gbAssistant.Text = "Incompatible colorspace" + CanIgnoreTip = False + Return False + End If + End If + If p.Script.Info.Width Mod p.ForcedOutputMod <> 0 Then If ProcessTip("Change output width to be divisible by " & p.ForcedOutputMod & " or customize:" + BR + "Options > Image > Output Mod") Then @@ -3901,7 +3917,7 @@ Public Class MainForm Optional position As Integer = -1) If Not CanIgnoreTip Then - MsgWarn("The current assistant warning cannot be skipped.") + MsgWarn("Assistant warning cannot be skipped.") Exit Sub End If @@ -4403,6 +4419,11 @@ Public Class MainForm b.Checked = p.ExtractTimestamps b.SaveAction = Sub(value) p.ExtractTimestamps = value + b = ui.AddBool(miscPage) + b.Text = "Use source file folder for temp files" + b.Checked = p.NoTempDir + b.SaveAction = Sub(value) p.NoTempDir = value + ui.AddLine(miscPage, "Compressibility Check") b = ui.AddBool(miscPage) diff --git a/General/GlobalClass.vb b/General/GlobalClass.vb index 49847380..b655c7c5 100644 --- a/General/GlobalClass.vb +++ b/General/GlobalClass.vb @@ -808,37 +808,41 @@ Public Class GlobalClass Sub SetTempDir() If p.SourceFile <> "" Then - p.TempDir = Macro.Expand(p.TempDir) + If p.NoTempDir Then + p.TempDir = p.SourceFile.Dir + Else + p.TempDir = Macro.Expand(p.TempDir) - If p.TempDir = "" Then - If p.SourceFile.Dir.EndsWith("_temp\") Then - p.TempDir = p.SourceFile.Dir - Else - p.TempDir = p.SourceFile.Dir + p.SourceFile.Base + "_temp\" + If p.TempDir = "" Then + If p.SourceFile.Dir.EndsWith("_temp\") Then + p.TempDir = p.SourceFile.Dir + Else + p.TempDir = p.SourceFile.Dir + p.SourceFile.Base + "_temp\" + End If End If - End If - p.TempDir = p.TempDir.FixDir + p.TempDir = p.TempDir.FixDir - If Not Directory.Exists(p.TempDir) Then - Try - Directory.CreateDirectory(p.TempDir) - Catch + If Not Directory.Exists(p.TempDir) Then Try - p.TempDir = p.SourceFile.DirAndBase + "_temp\" - - If Not Directory.Exists(p.TempDir) Then - Directory.CreateDirectory(p.TempDir) - End If + Directory.CreateDirectory(p.TempDir) Catch - MsgWarn("Failed to create a temp directory. By default it's created " + - "in the directory of the source file so it's not possible " + - "to open files directly from a optical drive unless a temp directory " + - "is defined in the options. Usually discs are copied to the hard drive " + - "first using a application like MakeMKV, DVDFab or AnyDVD.") - Throw New AbortException + Try + p.TempDir = p.SourceFile.DirAndBase + "_temp\" + + If Not Directory.Exists(p.TempDir) Then + Directory.CreateDirectory(p.TempDir) + End If + Catch + MsgWarn("Failed to create a temp directory. By default it's created " + + "in the directory of the source file so it's not possible " + + "to open files directly from a optical drive unless a temp directory " + + "is defined in the options. Usually discs are copied to the hard drive " + + "first using a application like MakeMKV, DVDFab or AnyDVD.") + Throw New AbortException + End Try End Try - End Try + End If End If Folder.Current = p.TempDir diff --git a/General/Project.vb b/General/Project.vb index 667e4515..e0f90b90 100644 --- a/General/Project.vb +++ b/General/Project.vb @@ -54,6 +54,7 @@ Public Class Project Public MKVHDR As Boolean Public MTN As Boolean Public NoDialogs As Boolean + Public NoTempDir As Boolean Public PreferredAudio As String Public PreferredSubtitles As String Public Ranges As List(Of Range)