diff --git a/.vs/Crunchyroll Downloader/v17/.suo b/.vs/Crunchyroll Downloader/v17/.suo index ecbc563..373bd8d 100644 Binary files a/.vs/Crunchyroll Downloader/v17/.suo and b/.vs/Crunchyroll Downloader/v17/.suo differ diff --git a/Crunchyroll Downloader/Anime_Add.vb b/Crunchyroll Downloader/Anime_Add.vb index 73b4f6d..d91899e 100644 --- a/Crunchyroll Downloader/Anime_Add.vb +++ b/Crunchyroll Downloader/Anime_Add.vb @@ -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 diff --git a/Crunchyroll Downloader/App.config b/Crunchyroll Downloader/App.config index 6142e53..c0b5867 100644 --- a/Crunchyroll Downloader/App.config +++ b/Crunchyroll Downloader/App.config @@ -153,6 +153,9 @@ False + + 0 + diff --git a/Crunchyroll Downloader/Main.vb b/Crunchyroll Downloader/Main.vb index d5562e9..b0e85c6 100644 --- a/Crunchyroll Downloader/Main.vb +++ b/Crunchyroll Downloader/Main.vb @@ -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) diff --git a/Crunchyroll Downloader/My Project/Settings.Designer.vb b/Crunchyroll Downloader/My Project/Settings.Designer.vb index 8bb09e3..eff9d7b 100644 --- a/Crunchyroll Downloader/My Project/Settings.Designer.vb +++ b/Crunchyroll Downloader/My Project/Settings.Designer.vb @@ -581,6 +581,18 @@ Namespace My Me("SaveMode") = value End Set End Property + + _ + 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 diff --git a/Crunchyroll Downloader/My Project/Settings.settings b/Crunchyroll Downloader/My Project/Settings.settings index 3fbf1d3..f6e6c10 100644 --- a/Crunchyroll Downloader/My Project/Settings.settings +++ b/Crunchyroll Downloader/My Project/Settings.settings @@ -134,5 +134,8 @@ False + + 0 + \ No newline at end of file diff --git a/Crunchyroll Downloader/Subfolder.vb b/Crunchyroll Downloader/Subfolder.vb index 45cc589..0735e8e 100644 --- a/Crunchyroll Downloader/Subfolder.vb +++ b/Crunchyroll Downloader/Subfolder.vb @@ -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