├── .gitattributes
├── .github
└── dependabot.yml
├── .gitignore
├── README.md
├── appveyor.yml
├── opus_gui.sln
└── opus_gui
├── App.config
├── Form1.Designer.vb
├── Form1.resx
├── Form1.vb
├── GoogleDriveClass.vb
├── GoogleDriveForm.Designer.vb
├── GoogleDriveForm.resx
├── GoogleDriveForm.vb
├── My Project
├── Application.Designer.vb
├── Application.myapp
├── AssemblyInfo.vb
├── Resources.Designer.vb
├── Resources.resx
├── Settings.Designer.vb
└── Settings.settings
├── opus_gui.vbproj
└── packages.config
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | # To get started with Dependabot version updates, you'll need to specify which
2 | # package ecosystems to update and where the package manifests are located.
3 | # Please see the documentation for all configuration options:
4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5 |
6 | version: 2
7 | updates:
8 | - package-ecosystem: "nuget" # See documentation for possible values
9 | directory: "/opus_gui" # Location of package manifests
10 | schedule:
11 | interval: "daily"
12 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | project.fragment.lock.json
46 | artifacts/
47 |
48 | *_i.c
49 | *_p.c
50 | *_i.h
51 | *.ilk
52 | *.meta
53 | *.obj
54 | *.pch
55 | *.pdb
56 | *.pgc
57 | *.pgd
58 | *.rsp
59 | *.sbr
60 | *.tlb
61 | *.tli
62 | *.tlh
63 | *.tmp
64 | *.tmp_proj
65 | *.log
66 | *.vspscc
67 | *.vssscc
68 | .builds
69 | *.pidb
70 | *.svclog
71 | *.scc
72 |
73 | # Chutzpah Test files
74 | _Chutzpah*
75 |
76 | # Visual C++ cache files
77 | ipch/
78 | *.aps
79 | *.ncb
80 | *.opendb
81 | *.opensdf
82 | *.sdf
83 | *.cachefile
84 | *.VC.db
85 | *.VC.VC.opendb
86 |
87 | # Visual Studio profiler
88 | *.psess
89 | *.vsp
90 | *.vspx
91 | *.sap
92 |
93 | # TFS 2012 Local Workspace
94 | $tf/
95 |
96 | # Guidance Automation Toolkit
97 | *.gpState
98 |
99 | # ReSharper is a .NET coding add-in
100 | _ReSharper*/
101 | *.[Rr]e[Ss]harper
102 | *.DotSettings.user
103 |
104 | # JustCode is a .NET coding add-in
105 | .JustCode
106 |
107 | # TeamCity is a build add-in
108 | _TeamCity*
109 |
110 | # DotCover is a Code Coverage Tool
111 | *.dotCover
112 |
113 | # NCrunch
114 | _NCrunch_*
115 | .*crunch*.local.xml
116 | nCrunchTemp_*
117 |
118 | # MightyMoose
119 | *.mm.*
120 | AutoTest.Net/
121 |
122 | # Web workbench (sass)
123 | .sass-cache/
124 |
125 | # Installshield output folder
126 | [Ee]xpress/
127 |
128 | # DocProject is a documentation generator add-in
129 | DocProject/buildhelp/
130 | DocProject/Help/*.HxT
131 | DocProject/Help/*.HxC
132 | DocProject/Help/*.hhc
133 | DocProject/Help/*.hhk
134 | DocProject/Help/*.hhp
135 | DocProject/Help/Html2
136 | DocProject/Help/html
137 |
138 | # Click-Once directory
139 | publish/
140 |
141 | # Publish Web Output
142 | *.[Pp]ublish.xml
143 | *.azurePubxml
144 | # TODO: Comment the next line if you want to checkin your web deploy settings
145 | # but database connection strings (with potential passwords) will be unencrypted
146 | #*.pubxml
147 | *.publishproj
148 |
149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
150 | # checkin your Azure Web App publish settings, but sensitive information contained
151 | # in these scripts will be unencrypted
152 | PublishScripts/
153 |
154 | # NuGet Packages
155 | *.nupkg
156 | # The packages folder can be ignored because of Package Restore
157 | **/packages/*
158 | # except build/, which is used as an MSBuild target.
159 | !**/packages/build/
160 | # Uncomment if necessary however generally it will be regenerated when needed
161 | #!**/packages/repositories.config
162 | # NuGet v3's project.json files produces more ignoreable files
163 | *.nuget.props
164 | *.nuget.targets
165 |
166 | # Microsoft Azure Build Output
167 | csx/
168 | *.build.csdef
169 |
170 | # Microsoft Azure Emulator
171 | ecf/
172 | rcf/
173 |
174 | # Windows Store app package directories and files
175 | AppPackages/
176 | BundleArtifacts/
177 | Package.StoreAssociation.xml
178 | _pkginfo.txt
179 |
180 | # Visual Studio cache files
181 | # files ending in .cache can be ignored
182 | *.[Cc]ache
183 | # but keep track of directories ending in .cache
184 | !*.[Cc]ache/
185 |
186 | # Others
187 | ClientBin/
188 | ~$*
189 | *~
190 | *.dbmdl
191 | *.dbproj.schemaview
192 | *.jfm
193 | *.pfx
194 | *.publishsettings
195 | node_modules/
196 | orleans.codegen.cs
197 |
198 | # Since there are multiple workflows, uncomment next line to ignore bower_components
199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
200 | #bower_components/
201 |
202 | # RIA/Silverlight projects
203 | Generated_Code/
204 |
205 | # Backup & report files from converting an old project file
206 | # to a newer Visual Studio version. Backup files are not needed,
207 | # because we have git ;-)
208 | _UpgradeReport_Files/
209 | Backup*/
210 | UpgradeLog*.XML
211 | UpgradeLog*.htm
212 |
213 | # SQL Server files
214 | *.mdf
215 | *.ldf
216 |
217 | # Business Intelligence projects
218 | *.rdl.data
219 | *.bim.layout
220 | *.bim_*.settings
221 |
222 | # Microsoft Fakes
223 | FakesAssemblies/
224 |
225 | # GhostDoc plugin setting file
226 | *.GhostDoc.xml
227 |
228 | # Node.js Tools for Visual Studio
229 | .ntvs_analysis.dat
230 |
231 | # Visual Studio 6 build log
232 | *.plg
233 |
234 | # Visual Studio 6 workspace options file
235 | *.opt
236 |
237 | # Visual Studio LightSwitch build output
238 | **/*.HTMLClient/GeneratedArtifacts
239 | **/*.DesktopClient/GeneratedArtifacts
240 | **/*.DesktopClient/ModelManifest.xml
241 | **/*.Server/GeneratedArtifacts
242 | **/*.Server/ModelManifest.xml
243 | _Pvt_Extensions
244 |
245 | # Paket dependency manager
246 | .paket/paket.exe
247 | paket-files/
248 |
249 | # FAKE - F# Make
250 | .fake/
251 |
252 | # JetBrains Rider
253 | .idea/
254 | *.sln.iml
255 |
256 | # CodeRush
257 | .cr/
258 |
259 | # Python Tools for Visual Studio (PTVS)
260 | __pycache__/
261 | *.pyc
262 | /Screenshots
263 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Opus GUI
2 | A GUI to encode music files into Opus.
3 |
4 | 
5 |
6 | It allows you to encode files to Opus using the following encoding methods:
7 |
8 | * opusenc (libopus)
9 | * ffmpeg - libopus
10 | * ffmpeg - opus (native ffmpeg opus library, using CELT only)
11 |
12 | The software comes bundled with the Opus encoder. You will need to download ffmpeg to use it if it is not in your system.
13 |
14 | You can get updated Opus Tools builds at my site here: [https://moisescardona.me/opusenc-builds/](https://moisescardona.me/opusenc-builds/).
15 |
16 | Written in Visual Basic .NET using Visual Studio 2017.
17 |
18 | By default, non-compatible files are copied to the output folder. You can make an "ignore.txt" file to ignore certain file types from being copied. Just add the file types like ".accurip", ".cue", etc and they will not be copied. FLACs and WAVs will be encoded.
19 |
20 | Enjoy!
21 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | image: Visual Studio 2017
2 | configuration: Release
3 |
4 | before_build:
5 | - nuget restore
6 |
7 | build_script:
8 | - msbuild "opus_gui.sln" /p:TargetFrameworkVersion=v4.7.2
9 |
10 | artifacts:
11 | - path: opus_gui\bin\Release\opus_gui.exe
12 |
--------------------------------------------------------------------------------
/opus_gui.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 16
4 | VisualStudioVersion = 16.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "opus_gui", "opus_gui\opus_gui.vbproj", "{51B64CB0-26F1-466F-A4EF-05F48DA441ED}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|Any CPU = Debug|Any CPU
11 | Debug|x64 = Debug|x64
12 | Release|Any CPU = Release|Any CPU
13 | Release|x64 = Release|x64
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {51B64CB0-26F1-466F-A4EF-05F48DA441ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {51B64CB0-26F1-466F-A4EF-05F48DA441ED}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {51B64CB0-26F1-466F-A4EF-05F48DA441ED}.Debug|x64.ActiveCfg = Debug|x64
19 | {51B64CB0-26F1-466F-A4EF-05F48DA441ED}.Debug|x64.Build.0 = Debug|x64
20 | {51B64CB0-26F1-466F-A4EF-05F48DA441ED}.Release|Any CPU.ActiveCfg = Release|Any CPU
21 | {51B64CB0-26F1-466F-A4EF-05F48DA441ED}.Release|Any CPU.Build.0 = Release|Any CPU
22 | {51B64CB0-26F1-466F-A4EF-05F48DA441ED}.Release|x64.ActiveCfg = Release|x64
23 | {51B64CB0-26F1-466F-A4EF-05F48DA441ED}.Release|x64.Build.0 = Release|x64
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {6677CD0A-1F01-4E78-AAC1-7B208DACE1C2}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/opus_gui/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | 96
18 |
19 |
20 | True
21 |
22 |
23 | False
24 |
25 |
26 | False
27 |
28 |
29 | False
30 |
31 |
32 | 0
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/opus_gui/Form1.Designer.vb:
--------------------------------------------------------------------------------
1 |
2 | Partial Class Form1
3 | Inherits System.Windows.Forms.Form
4 |
5 | 'Form overrides dispose to clean up the component list.
6 |
7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8 | Try
9 | If disposing AndAlso components IsNot Nothing Then
10 | components.Dispose()
11 | End If
12 | Finally
13 | MyBase.Dispose(disposing)
14 | End Try
15 | End Sub
16 |
17 | 'Required by the Windows Form Designer
18 | Private components As System.ComponentModel.IContainer
19 |
20 | 'NOTE: The following procedure is required by the Windows Form Designer
21 | 'It can be modified using the Windows Form Designer.
22 | 'Do not modify it using the code editor.
23 |
24 | Private Sub InitializeComponent()
25 | Me.Label1 = New System.Windows.Forms.Label()
26 | Me.Label2 = New System.Windows.Forms.Label()
27 | Me.InputTxt = New System.Windows.Forms.TextBox()
28 | Me.OutputTxt = New System.Windows.Forms.TextBox()
29 | Me.Label3 = New System.Windows.Forms.Label()
30 | Me.InputBrowseBtn = New System.Windows.Forms.Button()
31 | Me.OutputBrowseBtn = New System.Windows.Forms.Button()
32 | Me.StartBtn = New System.Windows.Forms.Button()
33 | Me.Label4 = New System.Windows.Forms.Label()
34 | Me.ProgressBar1 = New System.Windows.Forms.ProgressBar()
35 | Me.Label5 = New System.Windows.Forms.Label()
36 | Me.Label6 = New System.Windows.Forms.Label()
37 | Me.OpusVersionLabel = New System.Windows.Forms.Label()
38 | Me.BitrateNumberBox = New System.Windows.Forms.NumericUpDown()
39 | Me.enableMultithreading = New System.Windows.Forms.CheckBox()
40 | Me.GroupBox1 = New System.Windows.Forms.GroupBox()
41 | Me.EncFFmpeg2 = New System.Windows.Forms.RadioButton()
42 | Me.EncFfmpeg1 = New System.Windows.Forms.RadioButton()
43 | Me.EncOpusenc = New System.Windows.Forms.RadioButton()
44 | Me.InputFileBtn = New System.Windows.Forms.Button()
45 | Me.ffmpegVersionLabel = New System.Windows.Forms.Label()
46 | Me.GoogleDriveButton = New System.Windows.Forms.Button()
47 | Me.Label7 = New System.Windows.Forms.Label()
48 | Me.CPUThreads = New System.Windows.Forms.NumericUpDown()
49 | CType(Me.BitrateNumberBox, System.ComponentModel.ISupportInitialize).BeginInit()
50 | Me.GroupBox1.SuspendLayout()
51 | CType(Me.CPUThreads, System.ComponentModel.ISupportInitialize).BeginInit()
52 | Me.SuspendLayout()
53 | '
54 | 'Label1
55 | '
56 | Me.Label1.AutoSize = True
57 | Me.Label1.Location = New System.Drawing.Point(9, 64)
58 | Me.Label1.Name = "Label1"
59 | Me.Label1.Size = New System.Drawing.Size(274, 13)
60 | Me.Label1.TabIndex = 0
61 | Me.Label1.Text = "Step 1: Browse for and input file or folder with music files:"
62 | '
63 | 'Label2
64 | '
65 | Me.Label2.AutoSize = True
66 | Me.Label2.Location = New System.Drawing.Point(9, 107)
67 | Me.Label2.Name = "Label2"
68 | Me.Label2.Size = New System.Drawing.Size(274, 13)
69 | Me.Label2.TabIndex = 1
70 | Me.Label2.Text = "Step 2: Browse for output folder for encoded Opus file(s):"
71 | '
72 | 'InputTxt
73 | '
74 | Me.InputTxt.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
75 | Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
76 | Me.InputTxt.Location = New System.Drawing.Point(12, 81)
77 | Me.InputTxt.Name = "InputTxt"
78 | Me.InputTxt.Size = New System.Drawing.Size(374, 20)
79 | Me.InputTxt.TabIndex = 2
80 | '
81 | 'OutputTxt
82 | '
83 | Me.OutputTxt.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
84 | Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
85 | Me.OutputTxt.Location = New System.Drawing.Point(12, 123)
86 | Me.OutputTxt.Name = "OutputTxt"
87 | Me.OutputTxt.Size = New System.Drawing.Size(464, 20)
88 | Me.OutputTxt.TabIndex = 3
89 | '
90 | 'Label3
91 | '
92 | Me.Label3.AutoSize = True
93 | Me.Label3.Location = New System.Drawing.Point(12, 152)
94 | Me.Label3.Name = "Label3"
95 | Me.Label3.Size = New System.Drawing.Size(40, 13)
96 | Me.Label3.TabIndex = 4
97 | Me.Label3.Text = "Bitrate:"
98 | '
99 | 'InputBrowseBtn
100 | '
101 | Me.InputBrowseBtn.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
102 | Me.InputBrowseBtn.Location = New System.Drawing.Point(473, 78)
103 | Me.InputBrowseBtn.Name = "InputBrowseBtn"
104 | Me.InputBrowseBtn.Size = New System.Drawing.Size(84, 23)
105 | Me.InputBrowseBtn.TabIndex = 5
106 | Me.InputBrowseBtn.Text = "Browse Folder"
107 | Me.InputBrowseBtn.UseVisualStyleBackColor = True
108 | '
109 | 'OutputBrowseBtn
110 | '
111 | Me.OutputBrowseBtn.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
112 | Me.OutputBrowseBtn.Location = New System.Drawing.Point(482, 123)
113 | Me.OutputBrowseBtn.Name = "OutputBrowseBtn"
114 | Me.OutputBrowseBtn.Size = New System.Drawing.Size(75, 23)
115 | Me.OutputBrowseBtn.TabIndex = 6
116 | Me.OutputBrowseBtn.Text = "Browse"
117 | Me.OutputBrowseBtn.UseVisualStyleBackColor = True
118 | '
119 | 'StartBtn
120 | '
121 | Me.StartBtn.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
122 | Me.StartBtn.Location = New System.Drawing.Point(356, 152)
123 | Me.StartBtn.Name = "StartBtn"
124 | Me.StartBtn.Size = New System.Drawing.Size(204, 37)
125 | Me.StartBtn.TabIndex = 8
126 | Me.StartBtn.Text = "Start"
127 | Me.StartBtn.UseVisualStyleBackColor = True
128 | '
129 | 'Label4
130 | '
131 | Me.Label4.AutoSize = True
132 | Me.Label4.Location = New System.Drawing.Point(12, 199)
133 | Me.Label4.Name = "Label4"
134 | Me.Label4.Size = New System.Drawing.Size(51, 13)
135 | Me.Label4.TabIndex = 9
136 | Me.Label4.Text = "Progress:"
137 | '
138 | 'ProgressBar1
139 | '
140 | Me.ProgressBar1.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _
141 | Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
142 | Me.ProgressBar1.Location = New System.Drawing.Point(15, 216)
143 | Me.ProgressBar1.Name = "ProgressBar1"
144 | Me.ProgressBar1.Size = New System.Drawing.Size(545, 23)
145 | Me.ProgressBar1.Step = 1
146 | Me.ProgressBar1.TabIndex = 10
147 | '
148 | 'Label5
149 | '
150 | Me.Label5.AutoSize = True
151 | Me.Label5.Location = New System.Drawing.Point(9, 300)
152 | Me.Label5.Name = "Label5"
153 | Me.Label5.Size = New System.Drawing.Size(119, 13)
154 | Me.Label5.TabIndex = 11
155 | Me.Label5.Text = "GUI by Moises Cardona"
156 | '
157 | 'Label6
158 | '
159 | Me.Label6.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
160 | Me.Label6.AutoSize = True
161 | Me.Label6.Location = New System.Drawing.Point(517, 300)
162 | Me.Label6.Name = "Label6"
163 | Me.Label6.Size = New System.Drawing.Size(34, 13)
164 | Me.Label6.TabIndex = 12
165 | Me.Label6.Text = "v1.16"
166 | '
167 | 'OpusVersionLabel
168 | '
169 | Me.OpusVersionLabel.AutoSize = True
170 | Me.OpusVersionLabel.Location = New System.Drawing.Point(12, 250)
171 | Me.OpusVersionLabel.Name = "OpusVersionLabel"
172 | Me.OpusVersionLabel.Size = New System.Drawing.Size(88, 13)
173 | Me.OpusVersionLabel.TabIndex = 14
174 | Me.OpusVersionLabel.Text = "opusenc version:"
175 | '
176 | 'BitrateNumberBox
177 | '
178 | Me.BitrateNumberBox.Location = New System.Drawing.Point(15, 169)
179 | Me.BitrateNumberBox.Maximum = New Decimal(New Integer() {320, 0, 0, 0})
180 | Me.BitrateNumberBox.Name = "BitrateNumberBox"
181 | Me.BitrateNumberBox.Size = New System.Drawing.Size(61, 20)
182 | Me.BitrateNumberBox.TabIndex = 15
183 | '
184 | 'enableMultithreading
185 | '
186 | Me.enableMultithreading.AutoSize = True
187 | Me.enableMultithreading.Location = New System.Drawing.Point(82, 172)
188 | Me.enableMultithreading.Name = "enableMultithreading"
189 | Me.enableMultithreading.Size = New System.Drawing.Size(121, 17)
190 | Me.enableMultithreading.TabIndex = 16
191 | Me.enableMultithreading.Text = "Use Multi-Threading"
192 | Me.enableMultithreading.UseVisualStyleBackColor = True
193 | '
194 | 'GroupBox1
195 | '
196 | Me.GroupBox1.Controls.Add(Me.EncFFmpeg2)
197 | Me.GroupBox1.Controls.Add(Me.EncFfmpeg1)
198 | Me.GroupBox1.Controls.Add(Me.EncOpusenc)
199 | Me.GroupBox1.Location = New System.Drawing.Point(12, 12)
200 | Me.GroupBox1.Name = "GroupBox1"
201 | Me.GroupBox1.Size = New System.Drawing.Size(271, 48)
202 | Me.GroupBox1.TabIndex = 17
203 | Me.GroupBox1.TabStop = False
204 | Me.GroupBox1.Text = "Encoder: "
205 | '
206 | 'EncFFmpeg2
207 | '
208 | Me.EncFFmpeg2.AutoSize = True
209 | Me.EncFFmpeg2.Location = New System.Drawing.Point(180, 19)
210 | Me.EncFFmpeg2.Name = "EncFFmpeg2"
211 | Me.EncFFmpeg2.Size = New System.Drawing.Size(83, 17)
212 | Me.EncFFmpeg2.TabIndex = 2
213 | Me.EncFFmpeg2.TabStop = True
214 | Me.EncFFmpeg2.Text = "ffmpeg opus"
215 | Me.EncFFmpeg2.UseVisualStyleBackColor = True
216 | '
217 | 'EncFfmpeg1
218 | '
219 | Me.EncFfmpeg1.AutoSize = True
220 | Me.EncFfmpeg1.Location = New System.Drawing.Point(81, 19)
221 | Me.EncFfmpeg1.Name = "EncFfmpeg1"
222 | Me.EncFfmpeg1.Size = New System.Drawing.Size(93, 17)
223 | Me.EncFfmpeg1.TabIndex = 1
224 | Me.EncFfmpeg1.TabStop = True
225 | Me.EncFfmpeg1.Text = "ffmpeg libopus"
226 | Me.EncFfmpeg1.UseVisualStyleBackColor = True
227 | '
228 | 'EncOpusenc
229 | '
230 | Me.EncOpusenc.AutoSize = True
231 | Me.EncOpusenc.Location = New System.Drawing.Point(6, 19)
232 | Me.EncOpusenc.Name = "EncOpusenc"
233 | Me.EncOpusenc.Size = New System.Drawing.Size(66, 17)
234 | Me.EncOpusenc.TabIndex = 0
235 | Me.EncOpusenc.TabStop = True
236 | Me.EncOpusenc.Text = "opusenc"
237 | Me.EncOpusenc.UseVisualStyleBackColor = True
238 | '
239 | 'InputFileBtn
240 | '
241 | Me.InputFileBtn.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
242 | Me.InputFileBtn.Location = New System.Drawing.Point(392, 79)
243 | Me.InputFileBtn.Name = "InputFileBtn"
244 | Me.InputFileBtn.Size = New System.Drawing.Size(75, 23)
245 | Me.InputFileBtn.TabIndex = 18
246 | Me.InputFileBtn.Text = "Browse File"
247 | Me.InputFileBtn.UseVisualStyleBackColor = True
248 | '
249 | 'ffmpegVersionLabel
250 | '
251 | Me.ffmpegVersionLabel.AutoSize = True
252 | Me.ffmpegVersionLabel.Location = New System.Drawing.Point(12, 265)
253 | Me.ffmpegVersionLabel.Name = "ffmpegVersionLabel"
254 | Me.ffmpegVersionLabel.Size = New System.Drawing.Size(79, 13)
255 | Me.ffmpegVersionLabel.TabIndex = 19
256 | Me.ffmpegVersionLabel.Text = "ffmpeg version:"
257 | '
258 | 'GoogleDriveButton
259 | '
260 | Me.GoogleDriveButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
261 | Me.GoogleDriveButton.Location = New System.Drawing.Point(392, 28)
262 | Me.GoogleDriveButton.Name = "GoogleDriveButton"
263 | Me.GoogleDriveButton.Size = New System.Drawing.Size(165, 23)
264 | Me.GoogleDriveButton.TabIndex = 20
265 | Me.GoogleDriveButton.Text = "Google Drive"
266 | Me.GoogleDriveButton.UseVisualStyleBackColor = True
267 | '
268 | 'Label7
269 | '
270 | Me.Label7.AutoSize = True
271 | Me.Label7.Location = New System.Drawing.Point(201, 152)
272 | Me.Label7.Name = "Label7"
273 | Me.Label7.Size = New System.Drawing.Size(74, 13)
274 | Me.Label7.TabIndex = 21
275 | Me.Label7.Text = "CPU Threads:"
276 | '
277 | 'CPUThreads
278 | '
279 | Me.CPUThreads.Location = New System.Drawing.Point(204, 169)
280 | Me.CPUThreads.Name = "CPUThreads"
281 | Me.CPUThreads.Size = New System.Drawing.Size(71, 20)
282 | Me.CPUThreads.TabIndex = 22
283 | '
284 | 'Form1
285 | '
286 | Me.AllowDrop = True
287 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
288 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
289 | Me.ClientSize = New System.Drawing.Size(572, 322)
290 | Me.Controls.Add(Me.CPUThreads)
291 | Me.Controls.Add(Me.Label7)
292 | Me.Controls.Add(Me.GoogleDriveButton)
293 | Me.Controls.Add(Me.ffmpegVersionLabel)
294 | Me.Controls.Add(Me.InputFileBtn)
295 | Me.Controls.Add(Me.GroupBox1)
296 | Me.Controls.Add(Me.enableMultithreading)
297 | Me.Controls.Add(Me.BitrateNumberBox)
298 | Me.Controls.Add(Me.OpusVersionLabel)
299 | Me.Controls.Add(Me.Label6)
300 | Me.Controls.Add(Me.Label5)
301 | Me.Controls.Add(Me.ProgressBar1)
302 | Me.Controls.Add(Me.Label4)
303 | Me.Controls.Add(Me.StartBtn)
304 | Me.Controls.Add(Me.OutputBrowseBtn)
305 | Me.Controls.Add(Me.InputBrowseBtn)
306 | Me.Controls.Add(Me.Label3)
307 | Me.Controls.Add(Me.OutputTxt)
308 | Me.Controls.Add(Me.InputTxt)
309 | Me.Controls.Add(Me.Label2)
310 | Me.Controls.Add(Me.Label1)
311 | Me.KeyPreview = True
312 | Me.MaximizeBox = False
313 | Me.Name = "Form1"
314 | Me.Text = "Opus GUI"
315 | CType(Me.BitrateNumberBox, System.ComponentModel.ISupportInitialize).EndInit()
316 | Me.GroupBox1.ResumeLayout(False)
317 | Me.GroupBox1.PerformLayout()
318 | CType(Me.CPUThreads, System.ComponentModel.ISupportInitialize).EndInit()
319 | Me.ResumeLayout(False)
320 | Me.PerformLayout
321 |
322 | End Sub
323 |
324 | Friend WithEvents Label1 As Label
325 | Friend WithEvents Label2 As Label
326 | Friend WithEvents InputTxt As TextBox
327 | Friend WithEvents OutputTxt As TextBox
328 | Friend WithEvents Label3 As Label
329 | Friend WithEvents InputBrowseBtn As Button
330 | Friend WithEvents OutputBrowseBtn As Button
331 | Friend WithEvents StartBtn As Button
332 | Friend WithEvents Label4 As Label
333 | Friend WithEvents Label5 As Label
334 | Friend WithEvents Label6 As Label
335 | Friend WithEvents OpusVersionLabel As Label
336 | Friend WithEvents BitrateNumberBox As NumericUpDown
337 | Friend WithEvents enableMultithreading As CheckBox
338 | Friend WithEvents GroupBox1 As GroupBox
339 | Friend WithEvents InputFileBtn As Button
340 | Friend WithEvents ffmpegVersionLabel As Label
341 | Friend WithEvents GoogleDriveButton As Button
342 | Friend WithEvents ProgressBar1 As ProgressBar
343 | Friend WithEvents EncFfmpeg1 As RadioButton
344 | Friend WithEvents EncOpusenc As RadioButton
345 | Friend WithEvents EncFFmpeg2 As RadioButton
346 | Friend WithEvents Label7 As Label
347 | Friend WithEvents CPUThreads As NumericUpDown
348 | End Class
349 |
--------------------------------------------------------------------------------
/opus_gui/Form1.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/opus_gui/Form1.vb:
--------------------------------------------------------------------------------
1 | Imports System.IO.Pipes
2 |
3 | Public Class Form1
4 | Private AudioFormats As New List(Of String)
5 | Private opusenc_version As String = String.Empty
6 | Private ffmpeg_version As String = String.Empty
7 | Public Running As Boolean = False
8 |
9 | Private Sub InputBrowseBtn_Click(sender As Object, e As EventArgs) Handles InputBrowseBtn.Click
10 | Dim InputBrowser As New FolderBrowserDialog With {
11 | .ShowNewFolderButton = False
12 | }
13 | Dim OkAction As MsgBoxResult = InputBrowser.ShowDialog
14 | If OkAction = MsgBoxResult.Ok Then
15 | InputTxt.Text = InputBrowser.SelectedPath
16 | End If
17 | End Sub
18 |
19 | Private Sub OutputBrowseBtn_Click(sender As Object, e As EventArgs) Handles OutputBrowseBtn.Click
20 | Dim OutputBrowser As New FolderBrowserDialog With {
21 | .ShowNewFolderButton = True
22 | }
23 | Dim OkAction As MsgBoxResult = OutputBrowser.ShowDialog
24 | If OkAction = MsgBoxResult.Ok Then
25 | OutputTxt.Text = OutputBrowser.SelectedPath
26 | End If
27 | End Sub
28 | Private Sub DisableElements()
29 | StartBtn.Enabled = False
30 | InputTxt.Enabled = False
31 | OutputTxt.Enabled = False
32 | InputBrowseBtn.Enabled = False
33 | InputFileBtn.Enabled = False
34 | OutputBrowseBtn.Enabled = False
35 | BitrateNumberBox.Enabled = False
36 | enableMultithreading.Enabled = False
37 | CPUThreads.Enabled = False
38 | Running = True
39 | End Sub
40 | Private Sub StartBtn_Click(sender As Object, e As EventArgs) Handles StartBtn.Click
41 | If InputTxt.Text = String.Empty Then
42 | MessageBox.Show("There was no input file or folder specified. Cannot encode")
43 | Exit Sub
44 | End If
45 | DisableElements()
46 | Dim StartTasks As New Threading.Thread(Sub() StartThreads())
47 | StartTasks.Start()
48 | End Sub
49 | Public Sub StartGoogleDriveEncodes(GDriveItemsToProcess As List(Of String), GDriveItemIDs As List(Of String))
50 | DisableElements()
51 | Dim StartTasks As New Threading.Thread(Sub() StartThreads(True, GDriveItemsToProcess, GDriveItemIDs))
52 | StartTasks.Start()
53 | End Sub
54 |
55 | Private Function GetOutputPath(OutputFolder As String, Item As String) As String
56 | Dim outputPath As String
57 | If Not String.IsNullOrEmpty(OutputFolder) Then
58 | outputPath = OutputTxt.Text + "\" + IO.Path.GetFileNameWithoutExtension(Item) + ".opus"
59 | Else
60 | outputPath = IO.Path.ChangeExtension(Item, ".opus")
61 | End If
62 | Return outputPath
63 | End Function
64 | Public Sub StartThreads(Optional GoogleDrive As Boolean = False, Optional GDriveItemsToProcess As List(Of String) = Nothing, Optional GDriveItemIDs As List(Of String) = Nothing)
65 | If Not String.IsNullOrEmpty(OutputTxt.Text) Then If Not IO.Directory.Exists(OutputTxt.Text) Then IO.Directory.CreateDirectory(OutputTxt.Text)
66 | Dim ItemsToProcess As List(Of String) = New List(Of String)
67 | Dim ItemsToDelete As List(Of String) = New List(Of String)
68 | Dim FileAlreadyExist As List(Of String) = New List(Of String)
69 | Dim ErrorList As List(Of String) = New List(Of String)
70 | Dim IgnoreFilesWithExtensions As String = String.Empty
71 | Dim Item_Type As Integer = 0
72 | If IO.File.Exists("ignore.txt") Then IgnoreFilesWithExtensions = My.Computer.FileSystem.ReadAllText("ignore.txt")
73 | If IO.Directory.Exists(InputTxt.Text) Or GoogleDrive Then
74 | Dim Items As Object
75 | If Not GoogleDrive Then
76 | Item_Type = 0
77 | Items = IO.Directory.GetFiles(InputTxt.Text)
78 | Else
79 | Item_Type = 1
80 | Items = GDriveItemsToProcess
81 | End If
82 | For Each File In Items
83 | If Not String.IsNullOrEmpty(OutputTxt.Text) Then
84 | If Not IO.File.Exists(OutputTxt.Text + "\" + My.Computer.FileSystem.GetName(File)) Then
85 | Dim FileFormat As String = IO.Path.GetExtension(File)
86 | If Not IgnoreFilesWithExtensions.Contains(FileFormat) And AudioFormats.Contains(FileFormat) Then
87 | ItemsToProcess.Add(File)
88 | Else
89 | If Item_Type = 0 Then
90 | My.Computer.FileSystem.CopyFile(File, OutputTxt.Text + "\" + My.Computer.FileSystem.GetName(File))
91 | Else
92 | GoogleDriveForm.drive.DownloadFile(GDriveItemIDs(GDriveItemsToProcess.IndexOf(File)), New IO.FileStream(OutputTxt.Text + "\" + My.Computer.FileSystem.GetName(File), IO.FileMode.CreateNew))
93 | End If
94 | End If
95 | End If
96 | End If
97 | Next
98 | Else
99 | ItemsToProcess.Add(InputTxt.Text)
100 | End If
101 | ProgressBar1.BeginInvoke(Sub()
102 | ProgressBar1.Maximum = ItemsToProcess.Count
103 | ProgressBar1.Value = 0
104 | End Sub)
105 | Dim tasks = New List(Of Action)
106 | If enableMultithreading.Checked Then
107 | For Counter As Integer = 0 To ItemsToProcess.Count - 1
108 | Dim args As Array
109 | If GoogleDrive Then
110 | args = {GDriveItemIDs(Counter), 1, GetOutputPath(OutputTxt.Text, ItemsToProcess(Counter)), IO.Path.GetExtension(ItemsToProcess(Counter)), My.Settings.Bitrate}
111 | Else
112 | args = {ItemsToProcess(Counter), 0, GetOutputPath(OutputTxt.Text, ItemsToProcess(Counter)), IO.Path.GetExtension(ItemsToProcess(Counter)), My.Settings.Bitrate}
113 | End If
114 | If Not IO.File.Exists(args(2)) Then
115 | If EncOpusenc.Checked Then
116 | tasks.Add(Function() Run_opus(args, "opusenc", "opusenc"))
117 | ElseIf EncFfmpeg1.Checked Then
118 | tasks.Add(Function() Run_opus(args, "ffmpeg1", "ffmpeg"))
119 | Else
120 | tasks.Add(Function() Run_opus(args, "ffmpeg2", "ffmpeg"))
121 | End If
122 | Else
123 | FileAlreadyExist.Add(args(2))
124 | End If
125 | Next
126 | Parallel.Invoke(New ParallelOptions With {.MaxDegreeOfParallelism = CPUThreads.Value}, tasks.ToArray())
127 | Else
128 | For Counter As Integer = 0 To ItemsToProcess.Count - 1
129 | Dim args As Array
130 | If GoogleDrive Then
131 | args = {GDriveItemIDs(Counter), 1, GetOutputPath(OutputTxt.Text, ItemsToProcess(Counter)), My.Settings.Bitrate}
132 | Else
133 | args = {ItemsToProcess(Counter), 0, GetOutputPath(OutputTxt.Text, ItemsToProcess(Counter)), My.Settings.Bitrate}
134 | End If
135 | If Not IO.File.Exists(args(2)) Then
136 | If EncOpusenc.Checked Then
137 | Run_opus(args, "opusenc", "opusenc")
138 | ElseIf EncFfmpeg1.Checked Then
139 | Run_opus(args, "ffmpeg1", "ffmpeg")
140 | ElseIf EncFFmpeg2.Checked Then
141 | Run_opus(args, "ffmpeg2", "ffmpeg")
142 | End If
143 | Else
144 | FileAlreadyExist.Add(args(2))
145 | End If
146 | Next
147 | End If
148 | If ItemsToDelete.Count > 0 Then
149 | For Each item As String In ItemsToDelete
150 | My.Computer.FileSystem.DeleteFile(item)
151 | Next
152 | End If
153 | Running = False
154 | StartBtn.BeginInvoke(Sub()
155 | StartBtn.Enabled = True
156 | BitrateNumberBox.Enabled = True
157 | enableMultithreading.Enabled = True
158 | CPUThreads.Enabled = True
159 | InputTxt.Enabled = True
160 | OutputTxt.Enabled = True
161 | InputBrowseBtn.Enabled = True
162 | InputFileBtn.Enabled = True
163 | OutputBrowseBtn.Enabled = True
164 | End Sub)
165 | Dim MessageToShow As String = "Finished!"
166 | If FileAlreadyExist.Count > 0 Then
167 | MessageToShow += Environment.NewLine + Environment.NewLine + "The following file(s) could not be encoded because there's an output file with the same filename at the destination folder:" + Environment.NewLine
168 | For Each item As String In FileAlreadyExist
169 | MessageToShow += "- " + item + Environment.NewLine
170 | Next
171 | End If
172 | If ErrorList.Count > 0 Then
173 | MessageToShow += Environment.NewLine + Environment.NewLine + "The following file(s) could not be encoded. This could happen if you used opusenc but the files are not compatible and you don't have ffmpeg in your system:" + Environment.NewLine
174 | For Each item As String In FileAlreadyExist
175 | MessageToShow += "- " + item + Environment.NewLine
176 | Next
177 | End If
178 | MsgBox(MessageToShow)
179 | End Sub
180 | Private Function Download_Files(id As String) As IO.MemoryStream
181 | Using memoryStream As New IO.MemoryStream
182 | GoogleDriveForm.drive.DownloadFile(id, memoryStream)
183 | Return memoryStream
184 | End Using
185 | End Function
186 | Private Function Run_opus(args As Array, encoder As String, encoderExe As String) As Boolean
187 | Dim Input_File As String = args(0)
188 | Dim Input_Type As Integer = args(1)
189 | Dim Output_File As String = args(2)
190 | Dim FileExtension As String = args(3)
191 | Dim Bitrate As String = args(4)
192 | Dim opusProcessInfo As New ProcessStartInfo
193 | Dim opusProcess As Process
194 | opusProcessInfo.FileName = encoderExe + ".exe"
195 | Dim Data As Byte()
196 | If Input_Type = 0 Then
197 | Data = IO.File.ReadAllBytes(Input_File)
198 | Else
199 | Data = Download_Files(Input_File).ToArray()
200 | End If
201 | Select Case encoder
202 | Case "opusenc"
203 | If Not (FileExtension = ".wav" Or FileExtension = ".flac" Or FileExtension = ".opus") Then
204 | If Not ffmpeg_version = String.Empty Then
205 | Data = ffmpeg_preprocess(Data, Input_File)
206 | Else
207 | Return False
208 | End If
209 | End If
210 | opusProcessInfo.Arguments = "--music --bitrate " & Bitrate & " - """ + Output_File + """"
211 | Case "ffmpeg1"
212 | opusProcessInfo.Arguments = "-i - -c:a libopus -application audio -b:a " & Bitrate & "K -c:v copy """ + Output_File + """"
213 | Case "ffmpeg2"
214 | opusProcessInfo.Arguments = "-i - -c:a opus -strict -2 -b:a " & Bitrate & "K -c:v copy """ + Output_File + """"
215 | End Select
216 | opusProcessInfo.WorkingDirectory = IO.Path.GetDirectoryName(Input_File)
217 | opusProcessInfo.CreateNoWindow = True
218 | opusProcessInfo.RedirectStandardOutput = False
219 | opusProcessInfo.RedirectStandardInput = True
220 | opusProcessInfo.UseShellExecute = False
221 | opusProcess = Process.Start(opusProcessInfo)
222 | Dim ffmpegIn As IO.Stream = opusProcess.StandardInput.BaseStream
223 | ffmpegIn.Write(Data, 0, Data.Length)
224 | ffmpegIn.Flush()
225 | ffmpegIn.Close()
226 | opusProcess.WaitForExit()
227 | ProgressBar1.BeginInvoke(Sub() ProgressBar1.PerformStep())
228 | Return True
229 | End Function
230 | Private Function ffmpeg_preprocess(Input As Byte(), Filename As String) As Byte()
231 | Dim input_file As String = IO.Path.GetFileName(Filename)
232 | Dim output_file As String = IO.Path.GetFileNameWithoutExtension(Filename) + ".flac"
233 | Dim InputPipe As New NamedPipeServerStream(input_file, PipeDirection.Out, -1, PipeTransmissionMode.Byte, PipeOptions.Asynchronous, 16384, 0)
234 | Dim OutputPipe As New NamedPipeServerStream(output_file, PipeDirection.In, -1, PipeTransmissionMode.Byte, PipeOptions.WriteThrough, 0, 16384)
235 | Dim ffmpegProcessInfo As New ProcessStartInfo
236 | Dim ffmpegProcess As Process
237 | ffmpegProcessInfo.FileName = "ffmpeg.exe"
238 | ffmpegProcessInfo.Arguments = "-i ""\\.\pipe\" + input_file + """ -c:a flac -c:v copy ""\\.\pipe\" + output_file + """ -y"
239 | ffmpegProcessInfo.CreateNoWindow = True
240 | ffmpegProcessInfo.RedirectStandardInput = True
241 | ffmpegProcessInfo.RedirectStandardOutput = True
242 | ffmpegProcessInfo.UseShellExecute = False
243 | ffmpegProcess = Process.Start(ffmpegProcessInfo)
244 | WriteByteAsync(InputPipe, Input)
245 | Dim lastRead As Integer
246 | OutputPipe.WaitForConnection()
247 | Dim PipedOutput As Byte()
248 | Using ms As New IO.MemoryStream
249 | Dim buffer As Byte() = New Byte(16384) {}
250 | Do
251 | lastRead = OutputPipe.Read(buffer, 0, 16384)
252 | ms.Write(buffer, 0, lastRead)
253 | Loop While lastRead > 0
254 | PipedOutput = ms.ToArray()
255 | OutputPipe.Close()
256 | End Using
257 | ffmpegProcess.WaitForExit()
258 | Return PipedOutput
259 | End Function
260 | Private Async Sub WriteByteAsync(InputPipe As NamedPipeServerStream, Input As Byte())
261 | InputPipe.WaitForConnection()
262 | Dim ChunkSize As Integer = 16384
263 | For Bytes As Long = 0 To Input.Length Step 16384
264 | Try
265 | If Input.Length - Bytes < ChunkSize Then
266 | ChunkSize = Input.Length - Bytes
267 | End If
268 | Await InputPipe.WriteAsync(Input, Bytes, ChunkSize)
269 | Catch
270 | End Try
271 | Next
272 | Try
273 | InputPipe.Flush()
274 | InputPipe.Dispose()
275 | Catch
276 | End Try
277 | End Sub
278 | Private Sub TrimAudioFormats(AudioFormatsList As IEnumerable(Of String))
279 | For Each Format As String In AudioFormatsList
280 | AudioFormats(AudioFormats.IndexOf(Format)) = Format.Trim
281 | Next
282 | End Sub
283 | Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
284 | If IO.File.Exists("audioformats.txt") Then
285 | AudioFormats.AddRange(IO.File.ReadAllText("audioformats.txt").Trim.Split(Environment.NewLine))
286 | For item As Integer = 0 To AudioFormats.Count - 1
287 | AudioFormats(item) = AudioFormats(item).Trim
288 | Next
289 | Else
290 | AudioFormats.AddRange({".flac", ".wav", ".mp3", ".mp4", ".m4a", ".ogg", ".opus", ".wma"})
291 | End If
292 | CPUThreads.Maximum = Environment.ProcessorCount
293 | If My.Settings.CPUThreads = 0 Then CPUThreads.Value = CPUThreads.Maximum Else CPUThreads.Value = My.Settings.CPUThreads
294 | BitrateNumberBox.Value = My.Settings.Bitrate
295 | enableMultithreading.Checked = My.Settings.Multithreading
296 | EncFfmpeg1.Checked = My.Settings.EncFfmpeg
297 | EncFFmpeg2.Checked = My.Settings.EncFfmpeg2
298 | EncOpusenc.Checked = My.Settings.EncOpusenc
299 | If Not EncFfmpeg1.Checked And Not EncFFmpeg2.Checked And Not EncOpusenc.Checked Then EncOpusenc.Checked = True
300 | IO.Directory.SetCurrentDirectory(IO.Path.GetDirectoryName(Process.GetCurrentProcess.MainModule.FileName))
301 | GetOpusencVersion()
302 | GetFFmpegVersion()
303 | Dim vars As String() = Environment.GetCommandLineArgs
304 | If vars.Count > 1 Then
305 | InputTxt.Text = vars(1)
306 | End If
307 | End Sub
308 |
309 | Private Sub GetOpusencVersion()
310 | Try
311 | Dim opusProcessInfo As New ProcessStartInfo
312 | Dim opusProcess As Process
313 | opusProcessInfo.FileName = "opusenc.exe"
314 | opusProcessInfo.Arguments = "-V"
315 | opusProcessInfo.CreateNoWindow = True
316 | opusProcessInfo.RedirectStandardOutput = True
317 | opusProcessInfo.UseShellExecute = False
318 | opusProcess = Process.Start(opusProcessInfo)
319 | opusProcess.WaitForExit()
320 | opusenc_version = opusProcess.StandardOutput.ReadLine()
321 | OpusVersionLabel.Text = "opusenc version: " + opusenc_version
322 | Catch ex As Exception
323 | MessageBox.Show("opusenc.exe was not found. Exiting...")
324 | Process.Start("https://moisescardona.me/opusenc-builds/")
325 | Me.Close()
326 | End Try
327 | End Sub
328 | Private Sub GetFFmpegVersion()
329 | Try
330 | Dim ffmpegProcessInfo As New ProcessStartInfo
331 | Dim ffmpegProcess As Process
332 | ffmpegProcessInfo.FileName = "ffmpeg.exe"
333 | ffmpegProcessInfo.CreateNoWindow = True
334 | ffmpegProcessInfo.RedirectStandardError = True
335 | ffmpegProcessInfo.UseShellExecute = False
336 | ffmpegProcess = Process.Start(ffmpegProcessInfo)
337 | ffmpegProcess.WaitForExit()
338 | ffmpeg_version = ffmpegProcess.StandardError.ReadLine()
339 | ffmpegVersionLabel.Text = ffmpeg_version
340 | Catch ex As Exception
341 | ffmpegVersionLabel.Text = "ffmpeg.exe was not found."
342 | EncFfmpeg1.Enabled = False
343 | EncFFmpeg2.Enabled = False
344 | EncOpusenc.Checked = True
345 | End Try
346 | End Sub
347 |
348 | Private Sub NumericUpDown1_ValueChanged(sender As Object, e As EventArgs) Handles BitrateNumberBox.ValueChanged
349 | My.Settings.Bitrate = BitrateNumberBox.Value
350 | My.Settings.Save()
351 | End Sub
352 |
353 | Private Sub EnableMultithreading_CheckedChanged(sender As Object, e As EventArgs) Handles enableMultithreading.CheckedChanged
354 | My.Settings.Multithreading = enableMultithreading.Checked
355 | My.Settings.Save()
356 | End Sub
357 | Private Sub Form1_DragEnter(sender As Object, e As DragEventArgs) Handles MyBase.DragEnter
358 | If e.Data.GetDataPresent(DataFormats.FileDrop) Then
359 | e.Effect = DragDropEffects.Copy
360 | End If
361 | End Sub
362 | Private Sub Form1_DragDrop(sender As Object, e As DragEventArgs) Handles MyBase.DragDrop
363 | If InputTxt.Enabled Then
364 | InputTxt.Text = CType(e.Data.GetData(DataFormats.FileDrop), String())(0)
365 | End If
366 | End Sub
367 |
368 | Private Sub EncOpusenc_CheckedChanged(sender As Object, e As EventArgs) Handles EncOpusenc.CheckedChanged
369 | My.Settings.EncOpusenc = EncOpusenc.Checked
370 | My.Settings.Save()
371 | End Sub
372 |
373 | Private Sub EncFfmpeg_CheckedChanged(sender As Object, e As EventArgs) Handles EncFfmpeg1.CheckedChanged
374 | My.Settings.EncFfmpeg = EncFfmpeg1.Checked
375 | My.Settings.Save()
376 | End Sub
377 |
378 | Private Sub Button1_Click(sender As Object, e As EventArgs) Handles InputFileBtn.Click
379 | Dim InputBrowser As New OpenFileDialog With {
380 | .Title = "Browse for a music file:",
381 | .FileName = ""
382 | }
383 | Dim OkAction As MsgBoxResult = InputBrowser.ShowDialog
384 | If OkAction = MsgBoxResult.Ok Then
385 | InputTxt.Text = InputBrowser.FileName
386 | End If
387 | End Sub
388 |
389 | Private Sub FfmpegVersionLabel_Click(sender As Object, e As EventArgs) Handles ffmpegVersionLabel.Click
390 | If Not ffmpeg_version = String.Empty Then
391 | Clipboard.SetText(ffmpeg_version)
392 | End If
393 | End Sub
394 |
395 | Private Sub OpusVersionLabel_Click(sender As Object, e As EventArgs) Handles OpusVersionLabel.Click
396 | If Not opusenc_version = String.Empty Then
397 | Clipboard.SetText(opusenc_version)
398 | End If
399 | End Sub
400 |
401 | Private Sub EncFFmpeg2_CheckedChanged(sender As Object, e As EventArgs) Handles EncFFmpeg2.CheckedChanged
402 | My.Settings.EncFfmpeg2 = EncFFmpeg2.Checked
403 | My.Settings.Save()
404 | End Sub
405 |
406 | Private Sub GoogleDriveButton_Click(sender As Object, e As EventArgs) Handles GoogleDriveButton.Click
407 | Dim gdriveForm As New GoogleDriveForm With {.Owner = Me}
408 | gdriveForm.Show()
409 | End Sub
410 |
411 | Private Sub Form1_KeyDown(sender As Object, e As KeyEventArgs) Handles MyBase.KeyDown
412 | If e.KeyValue = Keys.F5 Then
413 | GetOpusencVersion()
414 | GetFFmpegVersion()
415 | End If
416 | End Sub
417 |
418 | Private Sub CPUThreads_ValueChanged(sender As Object, e As EventArgs) Handles CPUThreads.ValueChanged
419 | My.Settings.CPUThreads = CPUThreads.Value
420 | My.Settings.Save()
421 | End Sub
422 | End Class
423 |
--------------------------------------------------------------------------------
/opus_gui/GoogleDriveClass.vb:
--------------------------------------------------------------------------------
1 | Imports System.IO
2 | Imports System.Threading
3 | Imports Google.Apis.Auth.OAuth2
4 | Imports Google.Apis.Drive.v3
5 | Imports Google.Apis.Services
6 | Imports Google.Apis.Util.Store
7 |
8 | Public Class GoogleDriveClass
9 | Shared ReadOnly Scopes As String() = {DriveService.Scope.DriveReadonly}
10 | Shared SoftwareName As String = String.Empty
11 | Public service As DriveService
12 | Public FolderList As List(Of String) = New List(Of String)
13 | Public FolderListID As List(Of String) = New List(Of String)
14 | Public FileList As List(Of String) = New List(Of String)
15 | Public FileListID As List(Of String) = New List(Of String)
16 | Public previousFolder As List(Of String) = New List(Of String)
17 | Public connected As Boolean = False
18 | Public currentFolder As String = ""
19 | Public currentFolderName As String = ""
20 | Public credential As UserCredential
21 | Public Sub New(ByVal AppName As String)
22 | SoftwareName = AppName
23 | Dim SectretsFile As String = String.Empty
24 | If File.Exists("client_secret.json") Then
25 | SectretsFile = "client_secret.json"
26 | ElseIf File.Exists("credentials.json") Then
27 | SectretsFile = "credentials.json"
28 | End If
29 | If Not SectretsFile = String.Empty Then
30 | Using stream = New FileStream(SectretsFile, FileMode.Open, FileAccess.Read)
31 | Dim credPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Personal)
32 | credPath = Path.Combine(credPath, ".credentials/" & SoftwareName & ".json")
33 | credential = GoogleWebAuthorizationBroker.AuthorizeAsync(GoogleClientSecrets.Load(stream).Secrets, Scopes, "user", CancellationToken.None, New FileDataStore(credPath, True)).Result
34 | End Using
35 | service = New DriveService(New BaseClientService.Initializer() With {
36 | .HttpClientInitializer = credential,
37 | .ApplicationName = SoftwareName
38 | })
39 | connected = True
40 | Else
41 | connected = False
42 | End If
43 | End Sub
44 | Private Async Function getToken(ByVal credentials As UserCredential) As Task(Of String)
45 | Return Await credentials.GetAccessTokenForRequestAsync()
46 | End Function
47 | Private Function GetFolderName(ByVal Id As String) As String
48 | Try
49 | Dim getRequest As FilesResource.GetRequest = service.Files.[Get](Id)
50 | Dim folderName As Google.Apis.Drive.v3.Data.File = getRequest.Execute()
51 | Return folderName.Name
52 | Catch
53 | Return "Error retrieving folder name"
54 | End Try
55 | End Function
56 | Public Sub GoBack()
57 | If previousFolder.Count > 0 Then
58 | GetData(previousFolder(previousFolder.Count - 1), True)
59 | previousFolder.RemoveAt(previousFolder.Count - 1)
60 | End If
61 | End Sub
62 |
63 | Public Sub GetData(ByVal folderId As String, ByVal Optional goingBack As Boolean = False, ByVal Optional refreshing As Boolean = False)
64 | FolderList.Clear()
65 | FolderListID.Clear()
66 | FileList.Clear()
67 | FileListID.Clear()
68 | Dim listRequestQString As String = "mimeType!='application/vnd.google-apps.folder' and '" & folderId & "' in parents and trashed = false"
69 | Dim listRequestQFolderString As String = "mimeType='application/vnd.google-apps.folder' and '" & folderId & "' in parents and trashed = false"
70 | Dim PageToken1 As String = String.Empty
71 | Do
72 | Dim listRequest As FilesResource.ListRequest = service.Files.List()
73 | listRequest.Fields = "nextPageToken, files(id, name)"
74 | listRequest.Q = listRequestQString
75 | listRequest.OrderBy = "name"
76 | listRequest.PageToken = PageToken1
77 | Try
78 | Dim files = listRequest.Execute()
79 | If files.Files IsNot Nothing AndAlso files.Files.Count > 0 Then
80 |
81 | For Each file In files.Files
82 | FileList.Add(file.Name)
83 | FileListID.Add(file.Id)
84 | Next
85 | End If
86 | PageToken1 = files.NextPageToken
87 | Catch
88 | End Try
89 | Loop While PageToken1 IsNot Nothing
90 | Dim PageToken2 As String = String.Empty
91 | Do
92 | Dim listRequest As FilesResource.ListRequest = service.Files.List()
93 | listRequest.Fields = "nextPageToken, files(id, name)"
94 | listRequest.Q = listRequestQFolderString
95 | listRequest.OrderBy = "name"
96 | listRequest.PageToken = PageToken2
97 | Try
98 | Dim files = listRequest.Execute()
99 |
100 | If files.Files IsNot Nothing AndAlso files.Files.Count > 0 Then
101 |
102 | For Each file In files.Files
103 | FolderList.Add(file.Name)
104 | FolderListID.Add(file.Id)
105 | Next
106 | End If
107 |
108 | PageToken2 = files.NextPageToken
109 | Catch
110 | End Try
111 | Loop While PageToken2 IsNot Nothing
112 | If Not refreshing AndAlso Not goingBack AndAlso folderId <> "root" Then previousFolder.Add(currentFolder)
113 | currentFolder = folderId
114 | currentFolderName = GetFolderName(currentFolder)
115 | End Sub
116 |
117 | Public Sub DownloadFile(ByVal Id As String, ByVal stream As FileStream)
118 | Dim getRequest As FilesResource.GetRequest = service.Files.Get(Id)
119 | getRequest.Download(stream)
120 | stream.Close()
121 | End Sub
122 | Public Sub DownloadFile(ByVal Id As String, ByVal stream As MemoryStream)
123 | Dim getRequest As FilesResource.GetRequest = service.Files.Get(Id)
124 | getRequest.Download(stream)
125 | End Sub
126 | End Class
127 |
--------------------------------------------------------------------------------
/opus_gui/GoogleDriveForm.Designer.vb:
--------------------------------------------------------------------------------
1 | _
2 | Partial Class GoogleDriveForm
3 | Inherits System.Windows.Forms.Form
4 |
5 | 'Form overrides dispose to clean up the component list.
6 | _
7 | Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8 | Try
9 | If disposing AndAlso components IsNot Nothing Then
10 | components.Dispose()
11 | End If
12 | Finally
13 | MyBase.Dispose(disposing)
14 | End Try
15 | End Sub
16 |
17 | 'Required by the Windows Form Designer
18 | Private components As System.ComponentModel.IContainer
19 |
20 | 'NOTE: The following procedure is required by the Windows Form Designer
21 | 'It can be modified using the Windows Form Designer.
22 | 'Do not modify it using the code editor.
23 | _
24 | Private Sub InitializeComponent()
25 | Me.tableLayoutPanel1 = New System.Windows.Forms.TableLayoutPanel()
26 | Me.panel1 = New System.Windows.Forms.Panel()
27 | Me.GoBackButton = New System.Windows.Forms.Button()
28 | Me.GoToRootButton = New System.Windows.Forms.Button()
29 | Me.FoldersListBox = New System.Windows.Forms.ListBox()
30 | Me.label1 = New System.Windows.Forms.Label()
31 | Me.panel2 = New System.Windows.Forms.Panel()
32 | Me.EncodeSelected = New System.Windows.Forms.Button()
33 | Me.EncodeAll = New System.Windows.Forms.Button()
34 | Me.FilesListBox = New System.Windows.Forms.ListBox()
35 | Me.label2 = New System.Windows.Forms.Label()
36 | Me.FolderName = New System.Windows.Forms.Label()
37 | Me.tableLayoutPanel1.SuspendLayout
38 | Me.panel1.SuspendLayout
39 | Me.panel2.SuspendLayout
40 | Me.SuspendLayout
41 | '
42 | 'tableLayoutPanel1
43 | '
44 | Me.tableLayoutPanel1.ColumnCount = 2
45 | Me.tableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50!))
46 | Me.tableLayoutPanel1.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50!))
47 | Me.tableLayoutPanel1.Controls.Add(Me.panel1, 0, 0)
48 | Me.tableLayoutPanel1.Controls.Add(Me.panel2, 1, 0)
49 | Me.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill
50 | Me.tableLayoutPanel1.Location = New System.Drawing.Point(0, 0)
51 | Me.tableLayoutPanel1.Name = "tableLayoutPanel1"
52 | Me.tableLayoutPanel1.RowCount = 1
53 | Me.tableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50!))
54 | Me.tableLayoutPanel1.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50!))
55 | Me.tableLayoutPanel1.Size = New System.Drawing.Size(800, 454)
56 | Me.tableLayoutPanel1.TabIndex = 2
57 | '
58 | 'panel1
59 | '
60 | Me.panel1.Controls.Add(Me.FolderName)
61 | Me.panel1.Controls.Add(Me.GoBackButton)
62 | Me.panel1.Controls.Add(Me.GoToRootButton)
63 | Me.panel1.Controls.Add(Me.FoldersListBox)
64 | Me.panel1.Controls.Add(Me.label1)
65 | Me.panel1.Dock = System.Windows.Forms.DockStyle.Fill
66 | Me.panel1.Location = New System.Drawing.Point(3, 3)
67 | Me.panel1.Name = "panel1"
68 | Me.panel1.Size = New System.Drawing.Size(394, 448)
69 | Me.panel1.TabIndex = 0
70 | '
71 | 'GoBackButton
72 | '
73 | Me.GoBackButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left),System.Windows.Forms.AnchorStyles)
74 | Me.GoBackButton.Location = New System.Drawing.Point(209, 416)
75 | Me.GoBackButton.Name = "GoBackButton"
76 | Me.GoBackButton.Size = New System.Drawing.Size(182, 23)
77 | Me.GoBackButton.TabIndex = 2
78 | Me.GoBackButton.Text = "Go Back"
79 | Me.GoBackButton.UseVisualStyleBackColor = true
80 | '
81 | 'GoToRootButton
82 | '
83 | Me.GoToRootButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left),System.Windows.Forms.AnchorStyles)
84 | Me.GoToRootButton.Location = New System.Drawing.Point(9, 416)
85 | Me.GoToRootButton.Name = "GoToRootButton"
86 | Me.GoToRootButton.Size = New System.Drawing.Size(194, 23)
87 | Me.GoToRootButton.TabIndex = 3
88 | Me.GoToRootButton.Text = "Go to Root"
89 | Me.GoToRootButton.UseVisualStyleBackColor = true
90 | '
91 | 'FoldersListBox
92 | '
93 | Me.FoldersListBox.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
94 | Or System.Windows.Forms.AnchorStyles.Left) _
95 | Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles)
96 | Me.FoldersListBox.FormattingEnabled = true
97 | Me.FoldersListBox.Location = New System.Drawing.Point(9, 22)
98 | Me.FoldersListBox.Name = "FoldersListBox"
99 | Me.FoldersListBox.Size = New System.Drawing.Size(379, 381)
100 | Me.FoldersListBox.TabIndex = 1
101 | '
102 | 'label1
103 | '
104 | Me.label1.AutoSize = true
105 | Me.label1.Location = New System.Drawing.Point(9, 6)
106 | Me.label1.Name = "label1"
107 | Me.label1.Size = New System.Drawing.Size(44, 13)
108 | Me.label1.TabIndex = 0
109 | Me.label1.Text = "Folders:"
110 | '
111 | 'panel2
112 | '
113 | Me.panel2.Controls.Add(Me.EncodeSelected)
114 | Me.panel2.Controls.Add(Me.EncodeAll)
115 | Me.panel2.Controls.Add(Me.FilesListBox)
116 | Me.panel2.Controls.Add(Me.label2)
117 | Me.panel2.Dock = System.Windows.Forms.DockStyle.Fill
118 | Me.panel2.Location = New System.Drawing.Point(403, 3)
119 | Me.panel2.Name = "panel2"
120 | Me.panel2.Size = New System.Drawing.Size(394, 448)
121 | Me.panel2.TabIndex = 1
122 | '
123 | 'EncodeSelected
124 | '
125 | Me.EncodeSelected.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles)
126 | Me.EncodeSelected.Enabled = false
127 | Me.EncodeSelected.Location = New System.Drawing.Point(6, 416)
128 | Me.EncodeSelected.Name = "EncodeSelected"
129 | Me.EncodeSelected.Size = New System.Drawing.Size(182, 23)
130 | Me.EncodeSelected.TabIndex = 6
131 | Me.EncodeSelected.Text = "Encode Selected File(s)"
132 | Me.EncodeSelected.UseVisualStyleBackColor = true
133 | '
134 | 'EncodeAll
135 | '
136 | Me.EncodeAll.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles)
137 | Me.EncodeAll.Location = New System.Drawing.Point(202, 416)
138 | Me.EncodeAll.Name = "EncodeAll"
139 | Me.EncodeAll.Size = New System.Drawing.Size(182, 23)
140 | Me.EncodeAll.TabIndex = 4
141 | Me.EncodeAll.Text = "Encode All Files"
142 | Me.EncodeAll.UseVisualStyleBackColor = true
143 | '
144 | 'FilesListBox
145 | '
146 | Me.FilesListBox.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
147 | Or System.Windows.Forms.AnchorStyles.Left) _
148 | Or System.Windows.Forms.AnchorStyles.Right),System.Windows.Forms.AnchorStyles)
149 | Me.FilesListBox.FormattingEnabled = true
150 | Me.FilesListBox.Location = New System.Drawing.Point(6, 22)
151 | Me.FilesListBox.Name = "FilesListBox"
152 | Me.FilesListBox.SelectionMode = System.Windows.Forms.SelectionMode.MultiExtended
153 | Me.FilesListBox.Size = New System.Drawing.Size(378, 381)
154 | Me.FilesListBox.TabIndex = 5
155 | '
156 | 'label2
157 | '
158 | Me.label2.AutoSize = true
159 | Me.label2.Location = New System.Drawing.Point(3, 6)
160 | Me.label2.Name = "label2"
161 | Me.label2.Size = New System.Drawing.Size(31, 13)
162 | Me.label2.TabIndex = 4
163 | Me.label2.Text = "Files:"
164 | '
165 | 'FolderName
166 | '
167 | Me.FolderName.AutoSize = true
168 | Me.FolderName.Location = New System.Drawing.Point(59, 6)
169 | Me.FolderName.Name = "FolderName"
170 | Me.FolderName.Size = New System.Drawing.Size(67, 13)
171 | Me.FolderName.TabIndex = 4
172 | Me.FolderName.Text = "Folder Name"
173 | '
174 | 'GoogleDriveForm
175 | '
176 | Me.AutoScaleDimensions = New System.Drawing.SizeF(6!, 13!)
177 | Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
178 | Me.ClientSize = New System.Drawing.Size(800, 454)
179 | Me.Controls.Add(Me.tableLayoutPanel1)
180 | Me.Name = "GoogleDriveForm"
181 | Me.Text = "Google Drive Browser"
182 | Me.tableLayoutPanel1.ResumeLayout(false)
183 | Me.panel1.ResumeLayout(false)
184 | Me.panel1.PerformLayout
185 | Me.panel2.ResumeLayout(false)
186 | Me.panel2.PerformLayout
187 | Me.ResumeLayout(false)
188 |
189 | End Sub
190 |
191 | Private WithEvents tableLayoutPanel1 As TableLayoutPanel
192 | Private WithEvents panel1 As Panel
193 | Private WithEvents GoBackButton As Button
194 | Private WithEvents GoToRootButton As Button
195 | Private WithEvents FoldersListBox As ListBox
196 | Private WithEvents label1 As Label
197 | Private WithEvents panel2 As Panel
198 | Private WithEvents EncodeSelected As Button
199 | Private WithEvents EncodeAll As Button
200 | Private WithEvents FilesListBox As ListBox
201 | Private WithEvents label2 As Label
202 | Friend WithEvents FolderName As Label
203 | End Class
204 |
--------------------------------------------------------------------------------
/opus_gui/GoogleDriveForm.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
--------------------------------------------------------------------------------
/opus_gui/GoogleDriveForm.vb:
--------------------------------------------------------------------------------
1 | Public Class GoogleDriveForm
2 | Public Shared drive As GoogleDriveClass
3 | Private Sub GoogleDriveForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
4 | drive = New GoogleDriveClass("opus_gui")
5 | If drive.connected Then
6 | PopulateListBoxes(drive)
7 | Else
8 | MessageBox.Show("client_secret.json or credentials.json file not found. Please follow Step 1 in this guide: https://developers.google.com/drive/v3/web/quickstart/dotnet" & Environment.NewLine + Environment.NewLine & "This file should be located in the folder where this software is located.")
9 | Process.Start("https://developers.google.com/drive/v3/web/quickstart/dotnet")
10 | Close()
11 | End If
12 | End Sub
13 | Private Sub PopulateListBoxes(ByVal drive As GoogleDriveClass, ByVal Optional location As String = "root", ByVal Optional refreshing As Boolean = False)
14 | If location = "back" Then
15 | drive.GoBack()
16 | Else
17 | If Not refreshing Then
18 | drive.GetData(location)
19 | Else
20 | drive.GetData(location, False, True)
21 | End If
22 | End If
23 | FoldersListBox.Items.Clear()
24 | FilesListBox.Items.Clear()
25 | Try
26 | If drive.FolderList.Count > 0 Then
27 | For Each item As String In drive.FolderList
28 | FoldersListBox.Items.Add(item)
29 | Next
30 | End If
31 | If drive.FileList.Count > 0 Then
32 | For Each item As String In drive.FileList
33 | FilesListBox.Items.Add(item)
34 | Next
35 | EncodeAll.Enabled = True
36 | Else
37 | EncodeAll.Enabled = False
38 | End If
39 | If drive.previousFolder.Count < 1 Then
40 | GoBackButton.Enabled = False
41 | Else
42 | GoBackButton.Enabled = True
43 | End If
44 | Me.Text = "Google Drive Browser - " + drive.currentFolderName
45 | FolderName.Text = drive.currentFolderName
46 | Catch
47 | MessageBox.Show("Error loading Google Drive contents")
48 | End Try
49 | End Sub
50 | Private Sub GoToRootButton_Click(sender As Object, e As EventArgs) Handles GoToRootButton.Click
51 | PopulateListBoxes(drive)
52 | End Sub
53 |
54 | Private Sub GoBackButton_Click(sender As Object, e As EventArgs) Handles GoBackButton.Click
55 | PopulateListBoxes(drive, "back")
56 | End Sub
57 |
58 | Private Sub FilesListBox_SelectedIndexChanged(sender As Object, e As EventArgs) Handles FilesListBox.SelectedIndexChanged
59 | If FilesListBox.SelectedIndex > -1 Then
60 | EncodeSelected.Enabled = True
61 | Else
62 | EncodeSelected.Enabled = False
63 | End If
64 | End Sub
65 |
66 | Private Sub EncodeSelected_Click(sender As Object, e As EventArgs) Handles EncodeSelected.Click
67 | Dim ItemNames As List(Of String) = New List(Of String)
68 | Dim ItemIDs As List(Of String) = New List(Of String)
69 | If FilesListBox.SelectedItems.Count > 0 Then
70 | For Each item In FilesListBox.SelectedItems
71 | ItemNames.Add(item)
72 | ItemIDs.Add(drive.FileListID(FilesListBox.Items.IndexOf(item)))
73 | Next
74 | StartEncodeTask(ItemNames, ItemIDs)
75 | Else
76 | MsgBox("You did not select an item to encode.")
77 | End If
78 | End Sub
79 |
80 | Private Sub EncodeAll_Click(sender As Object, e As EventArgs) Handles EncodeAll.Click
81 | Dim ItemNames As List(Of String) = New List(Of String)
82 | Dim ItemIDs As List(Of String) = New List(Of String)
83 | For Each item In FilesListBox.Items
84 | ItemNames.Add(item)
85 | ItemIDs.Add(drive.FileListID(FilesListBox.Items.IndexOf(item)))
86 | Next
87 | StartEncodeTask(ItemNames, ItemIDs)
88 | End Sub
89 | Private Sub StartEncodeTask(ItemNames As List(Of String), ItemIDs As List(Of String))
90 | If Not Form1.Running Then
91 | If Not Form1.OutputTxt.Text = String.Empty Then
92 | Form1.StartGoogleDriveEncodes(ItemNames, ItemIDs)
93 | Else
94 | MsgBox("The Output Path is empty. Please enter an Output Path before encoding files.")
95 | End If
96 | Else
97 | MessageBox.Show("An encoding task is currently running. Please wait for it to finish before encoding more files.")
98 | End If
99 | End Sub
100 | Private Sub FoldersListBox_DoubleClick(sender As Object, e As EventArgs) Handles FoldersListBox.DoubleClick
101 | If FoldersListBox.SelectedIndex > -1 Then PopulateListBoxes(drive, drive.FolderListID(FoldersListBox.SelectedIndex))
102 | End Sub
103 |
104 | Private Sub FoldersListBox_KeyDown(sender As Object, e As KeyEventArgs) Handles FoldersListBox.KeyDown
105 | If e.KeyCode = Keys.Enter Then
106 | If FoldersListBox.SelectedIndex > -1 Then
107 | PopulateListBoxes(drive, drive.FolderListID(FoldersListBox.SelectedIndex))
108 | End If
109 | ElseIf e.KeyCode = Keys.Back Then
110 | If (GoBackButton.Enabled) Then
111 | PopulateListBoxes(drive, "back")
112 | End If
113 | ElseIf (e.KeyCode = Keys.F5) Then
114 | PopulateListBoxes(drive, drive.currentFolder, True)
115 | End If
116 | End Sub
117 |
118 | Private Sub FolderName_Click(sender As Object, e As EventArgs) Handles FolderName.Click
119 | Clipboard.SetText(drive.currentFolderName)
120 | End Sub
121 | End Class
--------------------------------------------------------------------------------
/opus_gui/My Project/Application.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | 'NOTE: This file is auto-generated; do not modify it directly. To make changes,
18 | ' or if you encounter build errors in this file, go to the Project Designer
19 | ' (go to Project Properties or double-click the My Project node in
20 | ' Solution Explorer), and make changes on the Application tab.
21 | '
22 | Partial Friend Class MyApplication
23 |
24 | _
25 | Public Sub New()
26 | MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
27 | Me.IsSingleInstance = false
28 | Me.EnableVisualStyles = true
29 | Me.SaveMySettingsOnExit = true
30 | Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
31 | End Sub
32 |
33 | _
34 | Protected Overrides Sub OnCreateMainForm()
35 | Me.MainForm = Global.opus_gui.Form1
36 | End Sub
37 | End Class
38 | End Namespace
39 |
--------------------------------------------------------------------------------
/opus_gui/My Project/Application.myapp:
--------------------------------------------------------------------------------
1 |
2 |
3 | true
4 | Form1
5 | false
6 | 0
7 | true
8 | 0
9 | 0
10 | true
11 |
12 |
--------------------------------------------------------------------------------
/opus_gui/My Project/AssemblyInfo.vb:
--------------------------------------------------------------------------------
1 | Imports System
2 | Imports System.Reflection
3 | Imports System.Runtime.InteropServices
4 |
5 | ' General Information about an assembly is controlled through the following
6 | ' set of attributes. Change these attribute values to modify the information
7 | ' associated with an assembly.
8 |
9 | ' Review the values of the assembly attributes
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | 'The following GUID is for the ID of the typelib if this project is exposed to COM
21 |
22 |
23 | ' Version information for an assembly consists of the following four values:
24 | '
25 | ' Major Version
26 | ' Minor Version
27 | ' Build Number
28 | ' Revision
29 | '
30 | ' You can specify all the values or you can default the Build and Revision Numbers
31 | ' by using the '*' as shown below:
32 | '
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/opus_gui/My Project/Resources.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 | Imports System
15 |
16 | Namespace My.Resources
17 |
18 | 'This class was auto-generated by the StronglyTypedResourceBuilder
19 | 'class via a tool like ResGen or Visual Studio.
20 | 'To add or remove a member, edit your .ResX file then rerun ResGen
21 | 'with the /str option, or rebuild your VS project.
22 | '''
23 | ''' A strongly-typed resource class, for looking up localized strings, etc.
24 | '''
25 | _
29 | Friend Module Resources
30 |
31 | Private resourceMan As Global.System.Resources.ResourceManager
32 |
33 | Private resourceCulture As Global.System.Globalization.CultureInfo
34 |
35 | '''
36 | ''' Returns the cached ResourceManager instance used by this class.
37 | '''
38 | _
39 | Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
40 | Get
41 | If Object.ReferenceEquals(resourceMan, Nothing) Then
42 | Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("opus_gui.Resources", GetType(Resources).Assembly)
43 | resourceMan = temp
44 | End If
45 | Return resourceMan
46 | End Get
47 | End Property
48 |
49 | '''
50 | ''' Overrides the current thread's CurrentUICulture property for all
51 | ''' resource lookups using this strongly typed resource class.
52 | '''
53 | _
54 | Friend Property Culture() As Global.System.Globalization.CultureInfo
55 | Get
56 | Return resourceCulture
57 | End Get
58 | Set
59 | resourceCulture = value
60 | End Set
61 | End Property
62 | End Module
63 | End Namespace
64 |
--------------------------------------------------------------------------------
/opus_gui/My Project/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | text/microsoft-resx
107 |
108 |
109 | 2.0
110 |
111 |
112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
113 |
114 |
115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
--------------------------------------------------------------------------------
/opus_gui/My Project/Settings.Designer.vb:
--------------------------------------------------------------------------------
1 | '------------------------------------------------------------------------------
2 | '
3 | ' This code was generated by a tool.
4 | ' Runtime Version:4.0.30319.42000
5 | '
6 | ' Changes to this file may cause incorrect behavior and will be lost if
7 | ' the code is regenerated.
8 | '
9 | '------------------------------------------------------------------------------
10 |
11 | Option Strict On
12 | Option Explicit On
13 |
14 |
15 | Namespace My
16 |
17 | _
20 | Partial Friend NotInheritable Class MySettings
21 | Inherits Global.System.Configuration.ApplicationSettingsBase
22 |
23 | Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
24 |
25 | #Region "My.Settings Auto-Save Functionality"
26 | #If _MyType = "WindowsForms" Then
27 | Private Shared addedHandler As Boolean
28 |
29 | Private Shared addedHandlerLockObject As New Object
30 |
31 | _
32 | Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
33 | If My.Application.SaveMySettingsOnExit Then
34 | My.Settings.Save()
35 | End If
36 | End Sub
37 | #End If
38 | #End Region
39 |
40 | Public Shared ReadOnly Property [Default]() As MySettings
41 | Get
42 |
43 | #If _MyType = "WindowsForms" Then
44 | If Not addedHandler Then
45 | SyncLock addedHandlerLockObject
46 | If Not addedHandler Then
47 | AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
48 | addedHandler = True
49 | End If
50 | End SyncLock
51 | End If
52 | #End If
53 | Return defaultInstance
54 | End Get
55 | End Property
56 |
57 | _
60 | Public Property Bitrate() As Integer
61 | Get
62 | Return CType(Me("Bitrate"),Integer)
63 | End Get
64 | Set
65 | Me("Bitrate") = value
66 | End Set
67 | End Property
68 |
69 | _
72 | Public Property Multithreading() As Boolean
73 | Get
74 | Return CType(Me("Multithreading"),Boolean)
75 | End Get
76 | Set
77 | Me("Multithreading") = value
78 | End Set
79 | End Property
80 |
81 | _
84 | Public Property EncOpusenc() As Boolean
85 | Get
86 | Return CType(Me("EncOpusenc"),Boolean)
87 | End Get
88 | Set
89 | Me("EncOpusenc") = value
90 | End Set
91 | End Property
92 |
93 | _
96 | Public Property EncFfmpeg() As Boolean
97 | Get
98 | Return CType(Me("EncFfmpeg"),Boolean)
99 | End Get
100 | Set
101 | Me("EncFfmpeg") = value
102 | End Set
103 | End Property
104 |
105 | _
108 | Public Property EncFfmpeg2() As Boolean
109 | Get
110 | Return CType(Me("EncFfmpeg2"),Boolean)
111 | End Get
112 | Set
113 | Me("EncFfmpeg2") = value
114 | End Set
115 | End Property
116 |
117 | _
120 | Public Property CPUThreads() As Integer
121 | Get
122 | Return CType(Me("CPUThreads"),Integer)
123 | End Get
124 | Set
125 | Me("CPUThreads") = value
126 | End Set
127 | End Property
128 | End Class
129 | End Namespace
130 |
131 | Namespace My
132 |
133 | _
136 | Friend Module MySettingsProperty
137 |
138 | _
139 | Friend ReadOnly Property Settings() As Global.opus_gui.My.MySettings
140 | Get
141 | Return Global.opus_gui.My.MySettings.Default
142 | End Get
143 | End Property
144 | End Module
145 | End Namespace
146 |
--------------------------------------------------------------------------------
/opus_gui/My Project/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | 96
7 |
8 |
9 | True
10 |
11 |
12 | False
13 |
14 |
15 | False
16 |
17 |
18 | False
19 |
20 |
21 | 0
22 |
23 |
24 |
--------------------------------------------------------------------------------
/opus_gui/opus_gui.vbproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {51B64CB0-26F1-466F-A4EF-05F48DA441ED}
8 | WinExe
9 | opus_gui.My.MyApplication
10 | opus_gui
11 | opus_gui
12 | 512
13 | WindowsForms
14 | v4.8
15 | true
16 |
17 |
18 |
19 | AnyCPU
20 | true
21 | full
22 | true
23 | true
24 | bin\Debug\
25 | opus_gui.xml
26 | 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036
27 |
28 |
29 | AnyCPU
30 | pdbonly
31 | false
32 | true
33 | true
34 | bin\Release\
35 | opus_gui.xml
36 | 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036
37 |
38 |
39 | On
40 |
41 |
42 | Binary
43 |
44 |
45 | Off
46 |
47 |
48 | On
49 |
50 |
51 | x64
52 | bin\x64\Debug\
53 | 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036
54 |
55 |
56 | x64
57 | bin\x64\Release\
58 | 41999,42016,42017,42018,42019,42020,42021,42022,42032,42036
59 |
60 |
61 |
62 | ..\packages\Google.Apis.1.45.0\lib\net45\Google.Apis.dll
63 |
64 |
65 | ..\packages\Google.Apis.Auth.1.45.0\lib\net45\Google.Apis.Auth.dll
66 |
67 |
68 | ..\packages\Google.Apis.Auth.1.45.0\lib\net45\Google.Apis.Auth.PlatformServices.dll
69 |
70 |
71 | ..\packages\Google.Apis.Core.1.45.0\lib\net45\Google.Apis.Core.dll
72 |
73 |
74 | ..\packages\Google.Apis.Drive.v3.1.45.0.1922\lib\net45\Google.Apis.Drive.v3.dll
75 |
76 |
77 | ..\packages\Google.Apis.1.45.0\lib\net45\Google.Apis.PlatformServices.dll
78 |
79 |
80 | ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 | Form
109 |
110 |
111 | Form1.vb
112 | Form
113 |
114 |
115 |
116 | GoogleDriveForm.vb
117 |
118 |
119 | Form
120 |
121 |
122 |
123 | True
124 | Application.myapp
125 |
126 |
127 | True
128 | True
129 | Resources.resx
130 |
131 |
132 | True
133 | Settings.settings
134 | True
135 |
136 |
137 |
138 |
139 | Form1.vb
140 |
141 |
142 | GoogleDriveForm.vb
143 |
144 |
145 | VbMyResourcesResXFileCodeGenerator
146 | Resources.Designer.vb
147 | My.Resources
148 | Designer
149 |
150 |
151 |
152 |
153 | MyApplicationCodeGenerator
154 | Application.Designer.vb
155 |
156 |
157 | SettingsSingleFileGenerator
158 | My
159 | Settings.Designer.vb
160 |
161 |
162 |
163 |
164 |
165 |
--------------------------------------------------------------------------------
/opus_gui/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------