fixes and ui changes

-fix Funimation error with firefox add-on
-fix misleading output of fishinshed downloads
-added Dub laguage detection and metadata for video files
This commit is contained in:
hama3254 2020-08-27 13:25:28 +02:00
parent 1bb3c31d56
commit 538b3c98a8
16 changed files with 102 additions and 3439 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
Crunchyroll Downloader/bin/x86/Debug/Crunchyroll-Downloader-v3.0.zip Crunchyroll Downloader/bin/x86/Debug/Crunchyroll-Downloader-v3.0.zip
*.zip *.zip
*.mp4

Binary file not shown.

View File

@ -12,7 +12,7 @@ Public Class CRD_List_Item
Dim Label_website_Text As String = Nothing Dim Label_website_Text As String = Nothing
Dim StatusRunning As Boolean = True Dim StatusRunning As Boolean = True
Dim UsedMap As String = Nothing 'Dim UsedMap As String = Nothing
Dim ffmpeg_command As String = Nothing Dim ffmpeg_command As String = Nothing
Dim Debug2 As Boolean = False Dim Debug2 As Boolean = False
Dim MergeSubstoMP4 As Boolean = False Dim MergeSubstoMP4 As Boolean = False
@ -92,9 +92,9 @@ Public Class CRD_List_Item
End Function End Function
#End Region #End Region
#Region "Set Variables" #Region "Set Variables"
Public Sub SetUsedMap(ByVal Value As String) 'Public Sub SetUsedMap(ByVal Value As String)
UsedMap = Value ' UsedMap = Value
End Sub 'End Sub
Public Sub Setffmpeg_command(ByVal Value As String) Public Sub Setffmpeg_command(ByVal Value As String)
ffmpeg_command = Value ffmpeg_command = Value
End Sub End Sub
@ -220,26 +220,28 @@ Public Class CRD_List_Item
#Region "Download + Update UI" #Region "Download + Update UI"
Public Function DownloadFFMPEG(ByVal DL_URL As String, ByVal DL_Pfad As String, ByVal Filename As String) As String Public Function DownloadFFMPEG(ByVal DLCommand As String, ByVal DL_Pfad As String, ByVal Filename As String) As String
DownloadPfad = DL_Pfad DownloadPfad = DL_Pfad
HistoryDL_URL = DL_URL HistoryDL_URL = DLCommand
HistoryDL_Pfad = DL_Pfad HistoryDL_Pfad = DL_Pfad
HistoryFilename = Filename HistoryFilename = Filename
Dim exepath As String = Application.StartupPath + "\ffmpeg.exe" Dim exepath As String = Application.StartupPath + "\ffmpeg.exe"
Dim startinfo As New System.Diagnostics.ProcessStartInfo Dim startinfo As New System.Diagnostics.ProcessStartInfo
'Dim cmd As String = "-i " + Chr(34) + URL_DL + Chr(34) + " -c copy -bsf:a aac_adtstoasc " + Pfad_DL 'start ffmpeg with command strFFCMD string 'Dim cmd As String = "-i " + Chr(34) + URL_DL + Chr(34) + " -c copy -bsf:a aac_adtstoasc " + Pfad_DL 'start ffmpeg with command strFFCMD string
Dim cmd As String = "-i " + Chr(34) + DL_URL + Chr(34) + " " + ffmpeg_command + " " + DL_Pfad 'start ffmpeg with command strFFCMD string Dim cmd As String = DLCommand + " " + DL_Pfad 'start ffmpeg with command strFFCMD string
If MergeSubstoMP4 = True Then
If CBool(InStr(DL_URL, "-i " + Chr(34))) = True Then 'If MergeSubstoMP4 = True Then
cmd = DL_URL + " " + DL_Pfad ' If CBool(InStr(DL_URL, "-i " + Chr(34))) = True Then
End If ' cmd = DL_URL + " " + DL_Pfad
End If ' End If
If UsedMap = Nothing Then 'End If
Else
cmd = "-i " + Chr(34) + DL_URL + Chr(34) + " -map 0:a " + "-map " + UsedMap + " " + ffmpeg_command + " " + DL_Pfad 'If UsedMap = Nothing Then
UsedMap = Nothing 'Else
End If
' UsedMap = Nothing
'End If
If Debug2 = True Then If Debug2 = True Then
MsgBox(cmd) MsgBox(cmd)
End If End If
@ -353,6 +355,13 @@ Public Class CRD_List_Item
Label_percent.Text = Math.Round(DownloadFinished, 2, MidpointRounding.AwayFromZero).ToString + "MB/" + Math.Round(FileSize, 2, MidpointRounding.AwayFromZero).ToString + "MB " + percent.ToString + "%" Label_percent.Text = Math.Round(DownloadFinished, 2, MidpointRounding.AwayFromZero).ToString + "MB/" + Math.Round(FileSize, 2, MidpointRounding.AwayFromZero).ToString + "MB " + percent.ToString + "%"
Return Nothing Return Nothing
End Function)) End Function))
ElseIf InStr(e.Data, "muxing overhead:") Then
Me.Invoke(New Action(Function()
Dim Done As String() = Label_percent.Text.Split(New String() {"MB"}, System.StringSplitOptions.RemoveEmptyEntries)
Label_percent.Text = "Finsihed - " + Done(0) + "MB"
Return Nothing
End Function))
End If End If

View File

@ -76,10 +76,10 @@
End Sub End Sub
Private Sub Button2_Click_1(sender As Object, e As EventArgs) Handles Button2.Click Private Sub Button2_Click_1(sender As Object, e As EventArgs) Handles Button2.Click
Main.FFMPEG_Reso(RichTextBox2.Text) 'Main.FFMPEG_Reso(RichTextBox2.Text)
End Sub End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
MsgBox(Main.ResoAvalibe) 'MsgBox(Main.ResoAvalibe)
End Sub End Sub
End Class End Class

View File

@ -295,7 +295,7 @@ Public Class Main
End Sub End Sub
Public Sub ListItemAdd(ByVal NameKomplett As String, ByVal NameP1 As String, ByVal NameP2 As String, ByVal Reso As String, ByVal HardSub As String, ByVal SoftSubs As String, ByVal ThumbnialURL As String, ByVal URL_DL As String, ByVal Pfad_DL As String) Public Sub ListItemAdd(ByVal NameKomplett As String, ByVal NameP1 As String, ByVal NameP2 As String, ByVal Reso As String, ByVal HardSub As String, ByVal SoftSubs As String, ByVal ThumbnialURL As String, ByVal URL_DL As String, ByVal Pfad_DL As String) ', ByVal AudioLang As String)
Dim Thumbnail As Image = My.Resources.main_del Dim Thumbnail As Image = My.Resources.main_del
Try Try
Dim wc As New WebClient() Dim wc As New WebClient()
@ -320,7 +320,7 @@ Public Class Main
Item.Width = 838 Item.Width = 838
Item.Height = 142 Item.Height = 142
#Region "Set Variables" #Region "Set Variables"
Item.SetUsedMap(UsedMap) 'Item.SetUsedMap(UsedMap)
Item.Setffmpeg_command(ffmpeg_command) Item.Setffmpeg_command(ffmpeg_command)
Item.SetMergeSubstoMP4(MergeSubstoMP4) Item.SetMergeSubstoMP4(MergeSubstoMP4)
Item.SetDebug2(Debug2) Item.SetDebug2(Debug2)
@ -1079,6 +1079,7 @@ Public Class Main
'Throw New System.Exception("Test") 'Throw New System.Exception("Test")
Grapp_RDY = False Grapp_RDY = False
Dim CR_Anime_Titel As String = Nothing Dim CR_Anime_Titel As String = Nothing
Dim CR_Anime_Dub As String = Nothing
Dim CR_Anime_Staffel As String = Nothing Dim CR_Anime_Staffel As String = Nothing
Dim CR_Anime_Folge As String = Nothing Dim CR_Anime_Folge As String = Nothing
#Region "Name + Pfad" #Region "Name + Pfad"
@ -1289,6 +1290,10 @@ Public Class Main
Dim s() As String = hls_List(i).Split(New String() {Chr(34) + "hardsub_lang" + Chr(34) + ":" + SubSprache2 + "," + Chr(34) + "url" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries) Dim s() As String = hls_List(i).Split(New String() {Chr(34) + "hardsub_lang" + Chr(34) + ":" + SubSprache2 + "," + Chr(34) + "url" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
CR_URI_Master = s(1).Replace("\/", "/") CR_URI_Master = s(1).Replace("\/", "/")
Dim dub() As String = hls_List(i).Split(New String() {Chr(34) + "audio_lang" + Chr(34) + ":" + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
Dim dub2() As String = dub(0).Split(New String() {Chr(34) + ","}, System.StringSplitOptions.RemoveEmptyEntries)
CR_Anime_Dub = dub2(0)
'MsgBox(CR_URI_Master) 'MsgBox(CR_URI_Master)
End If End If
Next Next
@ -1372,9 +1377,9 @@ Public Class Main
#End Region #End Region
If Resu = 42 Then If Resu = 42 Then
If MergeSubstoMP4 = True Then If MergeSubstoMP4 = True Then
URL_DL = "-i " + Chr(34) + CR_URI_Master + Chr(34) + SoftSubMergeURLs + SoftSubMergeMaps + " " + ffmpeg_command + " -c:s mov_text" + SoftSubMergeMetatata URL_DL = "-i " + Chr(34) + CR_URI_Master + Chr(34) + " -metadata:s:a:0 language=" + CCtoMP4CC(CR_Anime_Dub) + SoftSubMergeURLs + SoftSubMergeMaps + " " + ffmpeg_command + " -c:s mov_text" + SoftSubMergeMetatata
Else Else
URL_DL = CR_URI_Master URL_DL = "-i " + Chr(34) + CR_URI_Master + Chr(34) + " -metadata:s:a:0 language=" + CCtoMP4CC(CR_Anime_Dub) + " " + ffmpeg_command
End If End If
'MsgBox(URL_DL) 'MsgBox(URL_DL)
Else Else
@ -1414,9 +1419,12 @@ Public Class Main
Dim VLC_URI_2 As String() = VLC_URI_1(1).Split(New [Char]() {Chr(34)}) Dim VLC_URI_2 As String() = VLC_URI_1(1).Split(New [Char]() {Chr(34)})
Dim VLC_URI_3 As String() = VLC_URI_2(2).Split(New [Char]() {System.Convert.ToChar("#")}) Dim VLC_URI_3 As String() = VLC_URI_2(2).Split(New [Char]() {System.Convert.ToChar("#")})
If MergeSubstoMP4 = True Then If MergeSubstoMP4 = True Then
URL_DL = "-i " + Chr(34) + VLC_URI_3(0).Trim() + Chr(34) + SoftSubMergeURLs + SoftSubMergeMaps + " " + ffmpeg_command + " -c:s mov_text" + SoftSubMergeMetatata URL_DL = "-i " + Chr(34) + VLC_URI_3(0).Trim() + Chr(34) + " -metadata:s:a:0 language=" + CCtoMP4CC(CR_Anime_Dub) + SoftSubMergeURLs + SoftSubMergeMaps + " " + ffmpeg_command + " -c:s mov_text" + SoftSubMergeMetatata
'URL_DL = "-i " + Chr(34) + VLC_URI_3(0).Trim() + Chr(34) + SoftSubMergeURLs + SoftSubMergeMaps + " " + ffmpeg_command + " -c:s mov_text" + SoftSubMergeMetatata
Else Else
URL_DL = VLC_URI_3(0).Trim() URL_DL = "-i " + Chr(34) + VLC_URI_3(0).Trim() + Chr(34) + " -metadata:s:a:0 language=" + CCtoMP4CC(CR_Anime_Dub) + " " + ffmpeg_command
'URL_DL = VLC_URI_3(0).Trim()
End If End If
'MsgBox(URL_DL) 'MsgBox(URL_DL)
End If End If
@ -1780,25 +1788,25 @@ Public Class Main
#Region "<li> constructor" #Region "<li> constructor"
Dim Subsprache3 As String = "undefined" 'HardSubValuesToDisplay(SubSprache2) Dim Subsprache3 As String = "undefined" 'HardSubValuesToDisplay(SubSprache2)
Dim ResoHTMLDisplay As String = "[Auto]" Dim ResoHTMLDisplay As String = "[Auto]"
If InStr(ResoAvalibe, Resu.ToString) Then
Dim ResoUse As String() = ResoAvalibe.Split(New String() {Resu.ToString + ":--:"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim ResoUse2 As String() = ResoUse(1).Split(New String() {vbNewLine}, System.StringSplitOptions.RemoveEmptyEntries)
UsedMap = ResoUse2(0)
If Debug2 = True Then
MsgBox(UsedMap)
End If
ResoHTMLDisplay = Resu.ToString + "p"
Else
ResoHTMLDisplay = "[Auto]"
End If
Dim L2Name As String = Video_Title Dim L2Name As String = Video_Title
Dim L1Name_Split As String() = WebbrowserURL.Split(New String() {"/"}, System.StringSplitOptions.RemoveEmptyEntries) Dim L1Name_Split As String() = WebbrowserURL.Split(New String() {"/"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim L1Name As String = L1Name_Split(1) Dim L1Name As String = L1Name_Split(1)
Pfad_DL = Chr(34) + Pfad + "\" + Video_FilenName + Chr(34) Pfad_DL = Chr(34) + Pfad + "\" + Video_FilenName + Chr(34)
'If InStr(ResoAvalibe, Resu.ToString) Then
' Dim ResoUse As String() = ResoAvalibe.Split(New String() {Resu.ToString + ":--:"}, System.StringSplitOptions.RemoveEmptyEntries)
' Dim ResoUse2 As String() = ResoUse(1).Split(New String() {vbNewLine}, System.StringSplitOptions.RemoveEmptyEntries)
' UsedMap = ResoUse2(0)
' If Debug2 = True Then
' MsgBox(UsedMap)
' End If
' ResoHTMLDisplay = Resu.ToString + "p"
'Else
ResoHTMLDisplay = "[Auto]"
'End If
Dim cmd As String = "-i " + Chr(34) + URL_DL + Chr(34) + " " + ffmpeg_command
Me.Invoke(New Action(Function() Me.Invoke(New Action(Function()
ListItemAdd(Pfad_DL, L1Name, L2Name, ResoHTMLDisplay, Subsprache3, SubValuesToDisplay(), thumbnail4, URL_DL, Pfad_DL) ListItemAdd(Pfad_DL, L1Name, L2Name, ResoHTMLDisplay, Subsprache3, SubValuesToDisplay(), thumbnail4, cmd, Pfad_DL)
Return Nothing Return Nothing
End Function)) End Function))
@ -1890,9 +1898,9 @@ Public Class Main
FunimationDub = FunimationDub2(0) FunimationDub = FunimationDub2(0)
Dim DefaultName As String = RemoveExtraSpaces(FunimationTitle + " " + FunimationSeason + " " + FunimationEpisode + ".mp4") Dim DefaultName As String = RemoveExtraSpaces(FunimationTitle + " " + FunimationSeason + " " + FunimationEpisode)
Dim DefaultPath As String = Pfad + "\" + DefaultName Dim DefaultPath As String = Pfad + "\" + DefaultName + ".mp4"
#End Region #End Region
#Region "Pfad" #Region "Pfad"
@ -1932,9 +1940,9 @@ Public Class Main
End Function)) End Function))
If SubfolderValue = Nothing Then If SubfolderValue = Nothing Then
DownloadPfad = Pfad + "\" + DefaultName DownloadPfad = Pfad + "\" + DefaultName + ".mp4"
Else Else
DownloadPfad = Pfad + "\" + SubfolderValue + DefaultName DownloadPfad = Pfad + "\" + SubfolderValue + DefaultName + ".mp4"
End If End If
If Not Directory.Exists(Path.GetDirectoryName(DownloadPfad)) Then If Not Directory.Exists(Path.GetDirectoryName(DownloadPfad)) Then
' Nein! Jetzt erstellen... ' Nein! Jetzt erstellen...
@ -1942,7 +1950,7 @@ Public Class Main
Directory.CreateDirectory(Path.GetDirectoryName(DownloadPfad)) Directory.CreateDirectory(Path.GetDirectoryName(DownloadPfad))
Catch ex As Exception Catch ex As Exception
' Ordner wurde nich erstellt ' Ordner wurde nich erstellt
DownloadPfad = Pfad + "\" + DefaultName DownloadPfad = Pfad + "\" + DefaultName + ".mp4"
End Try End Try
End If End If
@ -2129,11 +2137,29 @@ Public Class Main
If MergeSubstoMP4 = True Then If MergeSubstoMP4 = True Then
If UsedSub = Nothing Then If UsedSub = Nothing Then
Else Else
Dim DubMetatata As String = " -metadata:s:a:0 language=jpn"
If FunimationDub = "japanese" Then
DubMetatata = " -metadata:s:a:0 language=jpn"
'Funimation_m3u8_final = "-i " + Chr(34) + Funimation_m3u8_final + Chr(34) + DubMetatata + " " + ffmpeg_command
Else
DubMetatata = " -metadata:s:a:0 language=eng"
'Funimation_m3u8_final = "-i " + Chr(34) + Funimation_m3u8_final + Chr(34) + DubMetatata + " " + ffmpeg_command
End If
Dim SoftSubMergeURLs As String = " -i " + Chr(34) + UsedSub + Chr(34) Dim SoftSubMergeURLs As String = " -i " + Chr(34) + UsedSub + Chr(34)
Dim SoftSubMergeMaps As String = " -map 0:v -map 0:a -map 1" Dim SoftSubMergeMaps As String = " -map 0:v -map 0:a -map 1"
Dim SoftSubMergeMetatata As String = " -metadata:s:s:0 language=eng" Dim SoftSubMergeMetatata As String = " -metadata:s:s:0 language=eng"
Funimation_m3u8_final = "-i " + Chr(34) + Funimation_m3u8_final + Chr(34) + SoftSubMergeURLs + SoftSubMergeMaps + " " + ffmpeg_command + " -c:s mov_text" + SoftSubMergeMetatata Funimation_m3u8_final = "-i " + Chr(34) + Funimation_m3u8_final + Chr(34) + DubMetatata + SoftSubMergeURLs + SoftSubMergeMaps + " " + ffmpeg_command + " -c:s mov_text" + SoftSubMergeMetatata
End If End If
Else
If FunimationDub = "japanese" Then
Dim DubMetatata As String = " -metadata:s:a:0 language=jpn"
Funimation_m3u8_final = "-i " + Chr(34) + Funimation_m3u8_final + Chr(34) + DubMetatata + " " + ffmpeg_command
Else
Dim DubMetatata As String = " -metadata:s:a:0 language=eng"
Funimation_m3u8_final = "-i " + Chr(34) + Funimation_m3u8_final + Chr(34) + DubMetatata + " " + ffmpeg_command
End If
End If End If
#End Region #End Region
@ -2349,12 +2375,25 @@ Public Class Main
WebbrowserHeadText = HeadSplit2(0) WebbrowserHeadText = HeadSplit2(0)
If Funimation_Grapp_RDY = True Then If Funimation_Grapp_RDY = True Then
Dim t As Thread 'Dim t As Thread
t = New Thread(AddressOf Funitmation_Grapp) 't = New Thread(AddressOf Funitmation_Grapp)
t.Priority = ThreadPriority.Normal 't.Priority = ThreadPriority.Normal
t.IsBackground = True 't.IsBackground = True
t.Start() 't.Start()
Else
If RunningDownloads >= MaxDL Then
Anime_Add.ListBox1.Items.Add(WebbrowserURL)
Else
Me.Invoke(New Action(Function()
GeckoFX.WebBrowser1.Navigate(WebbrowserURL)
Return Nothing
End Function))
b = False
End If
Else
If Anime_Add.Visible = True Then If Anime_Add.Visible = True Then
Anime_Add.ListBox1.Items.Add(WebbrowserURL) Anime_Add.ListBox1.Items.Add(WebbrowserURL)
Else Else

View File

@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben: ' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("3.4")> <Assembly: AssemblyVersion("3.4.2")>
<Assembly: AssemblyFileVersion("3.4")> <Assembly: AssemblyFileVersion("3.4.2")>
<Assembly: NeutralResourcesLanguage("en")> <Assembly: NeutralResourcesLanguage("en")>

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB