improvents #698
This commit is contained in:
hama3254 2023-02-22 14:50:53 +01:00
parent e788828a18
commit a49d3ff11b
7 changed files with 116 additions and 6 deletions

Binary file not shown.

View File

@ -40,7 +40,9 @@ Public Class Anime_Add
Private Sub Anime_Add_Load(sender As Object, e As EventArgs) Handles MyBase.Load
DownloadScope.SelectedIndex = 0
DownloadScope.SelectedIndex = Main.DownloadScope
Manager.Owner = Me
Me.StyleManager = Manager
Btn_Close.Image = Main.CloseImg
@ -588,6 +590,8 @@ Public Class Anime_Add
Private Sub SubTitlesOnlyCB_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DownloadScope.SelectedIndexChanged
Main.DownloadScope = DownloadScope.SelectedIndex
My.Settings.DownloadScope = Main.DownloadScope
My.Settings.Save()
End Sub

View File

@ -153,6 +153,9 @@
<setting name="SaveMode" serializeAs="String">
<value>False</value>
</setting>
<setting name="DownloadScope" serializeAs="String">
<value>0</value>
</setting>
</Crunchyroll_Downloader.My.MySettings>
</userSettings>
</configuration>

View File

@ -424,13 +424,8 @@ Public Class Main
Private Sub Main_Load(sender As Object, e As EventArgs) Handles MyBase.Load
FillArray()
#Region "settings path"
Dim mySettings As New DirectorySettings
@ -450,6 +445,7 @@ Public Class Main
DarkModeValue = My.Settings.DarkModeValue
DownloadScope = My.Settings.DownloadScope
Manager.Style = MetroColorStyle.Orange
If DarkModeValue = True Then
@ -1866,9 +1862,16 @@ Public Class Main
If DownloadScope = DownloadScopeEnum.AudioOnly Then
If CR_MetadataUsage = False Then
ffmpegInput = ffmpegInput + " -metadata:s:a:0 language=" + CCtoMP4CC(CR_audio_locale) + " " + ffmpeg_command_temp
Else
ffmpegInput = ffmpegInput + " -i " + Chr(34) + Mdata_File + Chr(34) + " -map_metadata 1" + " -metadata:s:a:0 language=" + CCtoMP4CC(CR_audio_locale) + " " + ffmpeg_command_temp
End If
ElseIf MergeAudio = True Then
ffmpegInput = "-i " + Chr(34) + Pfad6 + Chr(34) + " " + ffmpegInput + " -map 0 -map 1:a" + " -metadata:s:a:" + FFMPEG_Audio(Pfad6).ToString + " language=" + CCtoMP4CC(CR_audio_locale) + " -c copy"
ElseIf SoftSubsAvailable.Count > 0 Then
@ -1956,7 +1959,13 @@ Public Class Main
ffmpegInput = ffmpegInput + " -i " + Chr(34) + Mdata_File + Chr(34) + " -map_metadata 1" + " -metadata:s:a:0 language=" + CCtoMP4CC(CR_audio_locale) + " " + ffmpeg_command_temp
End If
End If
Else
If CR_MetadataUsage = False Then
ffmpegInput = ffmpegInput + " -metadata:s:a:0 language=" + CCtoMP4CC(CR_audio_locale) + " " + ffmpeg_command_temp
Else
ffmpegInput = ffmpegInput + " -i " + Chr(34) + Mdata_File + Chr(34) + " -map_metadata 1" + " -metadata:s:a:0 language=" + CCtoMP4CC(CR_audio_locale) + " " + ffmpeg_command_temp
End If
End If
ffmpegInput = RemoveExtraSpaces(ffmpegInput)

View File

@ -581,6 +581,18 @@ Namespace My
Me("SaveMode") = value
End Set
End Property
<Global.System.Configuration.UserScopedSettingAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Configuration.DefaultSettingValueAttribute("0")> _
Public Property DownloadScope() As Integer
Get
Return CType(Me("DownloadScope"),Integer)
End Get
Set
Me("DownloadScope") = value
End Set
End Property
End Class
End Namespace

View File

@ -134,5 +134,8 @@
<Setting Name="SaveMode" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="DownloadScope" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -155,5 +155,84 @@ Module Subfolder
Write(msg & vbCrLf)
End Sub
End Class
Public Function ShortingName(ByVal FullPath As String) As String
Dim FileName As String = Path.GetFileNameWithoutExtension(FullPath)
Dim Segements() As String = FileName.Split(New String() {" "}, System.StringSplitOptions.RemoveEmptyEntries)
Dim ReturnName As String = Nothing
For i As Integer = 0 To Segements.Count - 1
If Segements(i).Count > 5 Then ' 6 chars or more, split at 5
ReturnName = ReturnName + Segements(i).Substring(0, 3) + ". "
ElseIf Segements(i).Count > 3 Then ' 4 or 5 can stay
ReturnName = ReturnName + Segements(i) + " "
End If
Next
If ReturnName = Nothing Then
ReturnName = FullPath
Else
ReturnName = Path.GetDirectoryName(FullPath) + "\" + ReturnName + Path.GetExtension(FullPath)
End If
Return ReturnName
End Function
Public Function FFMPEG_Audio(ByVal file As String) As Integer
Dim proc As New Process
Dim exepath As String = Application.StartupPath + "\ffmpeg.exe"
Dim startinfo As New System.Diagnostics.ProcessStartInfo
Dim sr As StreamReader
Dim cmd As String = "-i " + Chr(34) + file + Chr(34) 'start ffmpeg with command strFFCMD string
Dim ffmpegOutput As String = Nothing
'all parameters required to run the process
startinfo.FileName = exepath
startinfo.Arguments = cmd
startinfo.UseShellExecute = False
startinfo.WindowStyle = ProcessWindowStyle.Normal
startinfo.RedirectStandardError = True
startinfo.RedirectStandardOutput = True
startinfo.CreateNoWindow = True
startinfo.StandardOutputEncoding = Encoding.UTF8
startinfo.StandardErrorEncoding = Encoding.UTF8
proc.StartInfo = startinfo
proc.Start() ' start the process
sr = proc.StandardError 'standard error is used by ffmpeg
Dim start, finish, pau As Double
start = CSng(Microsoft.VisualBasic.DateAndTime.Timer)
pau = 5
finish = start + pau
Do
ffmpegOutput = ffmpegOutput + sr.ReadToEnd
Loop Until proc.HasExited Or Microsoft.VisualBasic.DateAndTime.Timer < finish
Dim Streams() As String = ffmpegOutput.Split(New String() {"Stream #"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim Tracks As Integer = 0
For i As Integer = 0 To Streams.Count - 1
If CBool(InStr(Streams(i), ": Audio:")) Then
Tracks = Tracks + 1
End If
Next
Return Tracks
End Function
End Module