Skip to content

Commit

Permalink
v1.16: Bug fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
moisespr123 committed May 4, 2020
1 parent cb9c1d6 commit 08ce6d0
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 38 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -258,4 +258,5 @@ paket-files/

# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
*.pyc
/Screenshots
2 changes: 1 addition & 1 deletion opus_gui/Form1.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 32 additions & 18 deletions opus_gui/Form1.vb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Imports System.IO.Pipes

Public Class Form1
Private AudioFormats As New List(Of String)
Private opusenc_version As String = String.Empty
Private ffmpeg_version As String = String.Empty
Public Running As Boolean = False
Expand Down Expand Up @@ -52,7 +53,7 @@ Public Class Form1
End Sub

Private Function GetOutputPath(OutputFolder As String, Item As String) As String
Dim outputPath As String = String.Empty
Dim outputPath As String
If Not String.IsNullOrEmpty(OutputFolder) Then
outputPath = OutputTxt.Text + "\" + IO.Path.GetFileNameWithoutExtension(Item) + ".opus"
Else
Expand Down Expand Up @@ -81,7 +82,8 @@ Public Class Form1
For Each File In Items
If Not String.IsNullOrEmpty(OutputTxt.Text) Then
If Not IO.File.Exists(OutputTxt.Text + "\" + My.Computer.FileSystem.GetName(File)) Then
If Not IgnoreFilesWithExtensions.Contains(IO.Path.GetExtension(File)) Then
Dim FileFormat As String = IO.Path.GetExtension(File)
If Not IgnoreFilesWithExtensions.Contains(FileFormat) And AudioFormats.Contains(FileFormat) Then
ItemsToProcess.Add(File)
Else
If Item_Type = 0 Then
Expand Down Expand Up @@ -109,7 +111,7 @@ Public Class Form1
Else
args = {ItemsToProcess(Counter), 0, GetOutputPath(OutputTxt.Text, ItemsToProcess(Counter)), IO.Path.GetExtension(ItemsToProcess(Counter)), My.Settings.Bitrate}
End If
If Not IO.File.Exists(args(1)) Then
If Not IO.File.Exists(args(2)) Then
If EncOpusenc.Checked Then
tasks.Add(Function() Run_opus(args, "opusenc", "opusenc"))
ElseIf EncFfmpeg1.Checked Then
Expand All @@ -118,14 +120,19 @@ Public Class Form1
tasks.Add(Function() Run_opus(args, "ffmpeg2", "ffmpeg"))
End If
Else
FileAlreadyExist.Add(args(1))
FileAlreadyExist.Add(args(2))
End If
Next
Parallel.Invoke(New ParallelOptions With {.MaxDegreeOfParallelism = CPUThreads.Value}, tasks.ToArray())
Else
For Counter As Integer = 0 To ItemsToProcess.Count - 1
Dim args As Array = {ItemsToProcess(Counter), GetOutputPath(OutputTxt.Text, ItemsToProcess(Counter)), My.Settings.Bitrate}
If Not IO.File.Exists(args(1)) Then
Dim args As Array
If GoogleDrive Then
args = {GDriveItemIDs(Counter), 1, GetOutputPath(OutputTxt.Text, ItemsToProcess(Counter)), My.Settings.Bitrate}
Else
args = {ItemsToProcess(Counter), 0, GetOutputPath(OutputTxt.Text, ItemsToProcess(Counter)), My.Settings.Bitrate}
End If
If Not IO.File.Exists(args(2)) Then
If EncOpusenc.Checked Then
Run_opus(args, "opusenc", "opusenc")
ElseIf EncFfmpeg1.Checked Then
Expand All @@ -134,7 +141,7 @@ Public Class Form1
Run_opus(args, "ffmpeg2", "ffmpeg")
End If
Else
FileAlreadyExist.Add(args(1))
FileAlreadyExist.Add(args(2))
End If
Next
End If
Expand Down Expand Up @@ -262,11 +269,26 @@ Public Class Form1
Catch
End Try
Next

InputPipe.Flush()
InputPipe.Dispose()
Try
InputPipe.Flush()
InputPipe.Dispose()
Catch
End Try
End Sub
Private Sub TrimAudioFormats(AudioFormatsList As IEnumerable(Of String))
For Each Format As String In AudioFormatsList
AudioFormats(AudioFormats.IndexOf(Format)) = Format.Trim
Next
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If IO.File.Exists("audioformats.txt") Then
AudioFormats.AddRange(IO.File.ReadAllText("audioformats.txt").Trim.Split(Environment.NewLine))
For item As Integer = 0 To AudioFormats.Count - 1
AudioFormats(item) = AudioFormats(item).Trim
Next
Else
AudioFormats.AddRange({".flac", ".wav", ".mp3", ".mp4", ".m4a", ".ogg", ".opus", ".wma"})
End If
CPUThreads.Maximum = Environment.ProcessorCount
If My.Settings.CPUThreads = 0 Then CPUThreads.Value = CPUThreads.Maximum Else CPUThreads.Value = My.Settings.CPUThreads
BitrateNumberBox.Value = My.Settings.Bitrate
Expand Down Expand Up @@ -323,14 +345,6 @@ Public Class Form1
End Try
End Sub

Private Function OpusEncExists() As Boolean 'Currently not used
If IO.File.Exists("opusenc.exe") Then
Return True
Else
Return False
End If
End Function

Private Sub NumericUpDown1_ValueChanged(sender As Object, e As EventArgs) Handles BitrateNumberBox.ValueChanged
My.Settings.Bitrate = BitrateNumberBox.Value
My.Settings.Save()
Expand Down
4 changes: 2 additions & 2 deletions opus_gui/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("1.15.0.0")>
<Assembly: AssemblyFileVersion("1.15.0.0")>
<Assembly: AssemblyVersion("1.16.0.0")>
<Assembly: AssemblyFileVersion("1.16.0.0")>
24 changes: 12 additions & 12 deletions opus_gui/opus_gui.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,23 @@
<NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="Google.Apis, Version=1.43.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Apis.1.43.0\lib\net45\Google.Apis.dll</HintPath>
<Reference Include="Google.Apis, Version=1.45.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Apis.1.45.0\lib\net45\Google.Apis.dll</HintPath>
</Reference>
<Reference Include="Google.Apis.Auth, Version=1.43.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Apis.Auth.1.43.0\lib\net45\Google.Apis.Auth.dll</HintPath>
<Reference Include="Google.Apis.Auth, Version=1.45.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Apis.Auth.1.45.0\lib\net45\Google.Apis.Auth.dll</HintPath>
</Reference>
<Reference Include="Google.Apis.Auth.PlatformServices, Version=1.43.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Apis.Auth.1.43.0\lib\net45\Google.Apis.Auth.PlatformServices.dll</HintPath>
<Reference Include="Google.Apis.Auth.PlatformServices, Version=1.45.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Apis.Auth.1.45.0\lib\net45\Google.Apis.Auth.PlatformServices.dll</HintPath>
</Reference>
<Reference Include="Google.Apis.Core, Version=1.43.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Apis.Core.1.43.0\lib\net45\Google.Apis.Core.dll</HintPath>
<Reference Include="Google.Apis.Core, Version=1.45.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Apis.Core.1.45.0\lib\net45\Google.Apis.Core.dll</HintPath>
</Reference>
<Reference Include="Google.Apis.Drive.v3, Version=1.43.0.1807, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Apis.Drive.v3.1.43.0.1807\lib\net45\Google.Apis.Drive.v3.dll</HintPath>
<Reference Include="Google.Apis.Drive.v3, Version=1.45.0.1922, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Apis.Drive.v3.1.45.0.1922\lib\net45\Google.Apis.Drive.v3.dll</HintPath>
</Reference>
<Reference Include="Google.Apis.PlatformServices, Version=1.43.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Apis.1.43.0\lib\net45\Google.Apis.PlatformServices.dll</HintPath>
<Reference Include="Google.Apis.PlatformServices, Version=1.45.0.0, Culture=neutral, PublicKeyToken=4b01fa6e34db77ab, processorArchitecture=MSIL">
<HintPath>..\packages\Google.Apis.1.45.0\lib\net45\Google.Apis.PlatformServices.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
Expand Down
8 changes: 4 additions & 4 deletions opus_gui/packages.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Google.Apis" version="1.43.0" targetFramework="net48" />
<package id="Google.Apis.Auth" version="1.43.0" targetFramework="net48" />
<package id="Google.Apis.Core" version="1.43.0" targetFramework="net48" />
<package id="Google.Apis.Drive.v3" version="1.43.0.1807" targetFramework="net48" />
<package id="Google.Apis" version="1.45.0" targetFramework="net48" />
<package id="Google.Apis.Auth" version="1.45.0" targetFramework="net48" />
<package id="Google.Apis.Core" version="1.45.0" targetFramework="net48" />
<package id="Google.Apis.Drive.v3" version="1.45.0.1922" targetFramework="net48" />
<package id="Newtonsoft.Json" version="12.0.3" targetFramework="net48" />
</packages>

0 comments on commit 08ce6d0

Please sign in to comment.