fix error handling (CR hardsub), fix season dub selection

fix error handling (CR hardsub) #893
fix season dub selection #890
This commit is contained in:
hama3254 2024-01-28 12:09:00 +01:00
parent 4ee9664b3a
commit 08bec55b38
5 changed files with 96 additions and 36 deletions

Binary file not shown.

View File

@ -193,7 +193,7 @@ Public Class Anime_Add
Dim Pfad_DL As String = Path.Combine(Main.Pfad, Namep2)
Dim Service As String = "other"
MsgBox(URL_DL)
'MsgBox(URL_DL)
Main.ItemConstructor(NameKomplett, Namep1, Namep2, Reso, HardSub, ThumbnialURL, URL_DL, Chr(34) + Pfad_DL + Chr(34), Service)
@ -460,6 +460,12 @@ Public Class Anime_Add
Dim audio_locale_filter As String = Nothing
For i As Integer = 0 To Main.LangValueEnum.Count - 1
If Main.LangValueEnum.Item(i).DisplayText = CB_Dub.Text Then
audio_locale_filter = Main.LangValueEnum.Item(i).CR_Value
End If
Next
Dim EpisodeJObject As JObject = JObject.Parse(EpisodeJson)
Dim EpisodeData As List(Of JToken) = EpisodeJObject.Children().ToList
@ -551,6 +557,7 @@ Public Class Anime_Add
End Try
'My.Computer.Clipboard.SetText(EpisodeJson)
Debug.WriteLine("EpisodeJson: " + EpisodeJson)
FillCREpisodes(EpisodeJson)

View File

@ -98,12 +98,17 @@ Public Class ErrorDialog
End If
Next
SurroundingSub()
Try
ComboBox1.SelectedIndex = 0
Catch ex As Exception
End Try
End If
'check for the first option and error if there are none
If ComboBox1.Items.Count > 0 Then
ComboBox1.SelectedIndex = 0
Else
MsgBox("Error, no available options found!", MsgBoxStyle.Information)
End If
Delay.Enabled = True
End Sub
@ -142,6 +147,7 @@ Public Class ErrorDialog
Else
If Main.DialogTaskString = "Language_CR_Beta" Then
Main.ResoBackString = DisplayToHardSubValues(ComboBox1.SelectedItem.ToString)
'MsgBox(Main.ResoBackString)
Main.UserCloseDialog = False
Me.Close()
Else
@ -153,35 +159,13 @@ Public Class ErrorDialog
End Sub
Public Function DisplayToHardSubValues(ByVal HardSub As String) As String
Try
If HardSub = "Deutsch" Then
Return "de-DE"
ElseIf HardSub = "English" Then
Return "en-US"
ElseIf HardSub = "Português (Brasil)" Then
Return "pt-BR"
ElseIf HardSub = "Español (LA)" Then '"(LA)-Español"
Return "es-LA"
ElseIf HardSub = "Español" Then
Return "es-419"
ElseIf HardSub = "Français (France)" Then
Return "fr-FR"
ElseIf HardSub = "العربية (Arabic)" Then
Return "ar-SA"
ElseIf HardSub = "Русский (Russian)" Then
Return "ru-RU"
ElseIf HardSub = "Italiano (Italian)" Then
Return "it-IT"
ElseIf HardSub = "Español (España)" Then
Return "es-ES"
Else
Return Nothing
For i As Integer = 0 To Main.LangValueEnum.Count - 1
If Main.LangValueEnum.Item(i).DisplayText = HardSub Then ' does not find "No Hardsubs" but default is correct here anyway.
Return Main.LangValueEnum.Item(i).CR_Value
End If
Next
Catch ex As Exception
Return Nothing
End Try
Return "null" ' null as text because CR does so...
End Function

View File

@ -120,12 +120,12 @@ Module GetData
Return CurlError
ElseIf CBool(InStr(CurlError, "curl:")) Then
Debug.WriteLine(CurlError)
Throw New System.Exception("Error - Getting" + vbNewLine + CurlError)
Throw New System.Exception("Error - Getting" + Sender + vbNewLine + CurlError)
Return Nothing
ElseIf CBool(InStr(CurlOutput, "curl:")) Then
Debug.WriteLine(CurlOutput)
Throw New System.Exception("Error - Getting" + vbNewLine + CurlError)
Throw New System.Exception("Error - Getting" + Sender + vbNewLine + CurlError)
Return Nothing
Else
Return CurlOutput

View File

@ -889,6 +889,7 @@ Public Class Main
SeasonJson = CleanJSON(SeasonJson)
'Debug.WriteLine("SeasonJson: " + SeasonJson)
Dim SeasonJObject As JObject = JObject.Parse(SeasonJson)
Dim SeasonData As List(Of JToken) = SeasonJObject.Children().ToList
@ -1366,9 +1367,10 @@ Public Class Main
'MsgBox(CR_Streams.Count.ToString)
For i As Integer = 0 To CR_Streams.Count - 1
Debug.WriteLine("1280: " + CR_Streams.Item(i).subLang)
If CR_Streams.Item(i).subLang = CR_HardSubLang Then
If CR_Streams.Item(i).subLang = CR_HardSubLang Then 'check for all hardsubs even 'null'
CR_URI_Master.Add(CR_Streams.Item(i).Url)
ElseIf CR_Streams.Item(i).subLang = "" And CR_HardSubLang = "null" Then 'keeping in mind 'null' and a empty string would be CRs style ...
CR_URI_Master.Add(CR_Streams.Item(i).Url)
End If
Next
@ -4030,6 +4032,73 @@ Public Class Main
End Try
#End Region
ElseIf CBool(InStr(htmlReq, "m3u8_Url=")) Then
Debug.WriteLine("m3u8_Url mode")
Try
Dim DecodedHTML As String = UrlDecode(htmlReq)
'MsgBox(DecodedHTML)
If CBool(InStr(DecodedHTML, "&tabName=")) Then
Dim DataSplit() As String = DecodedHTML.Split(New String() {"&tabName="}, System.StringSplitOptions.RemoveEmptyEntries)
Dim UrlSplit() As String = DataSplit(0).Split(New String() {"m3u8_Url="}, System.StringSplitOptions.RemoveEmptyEntries)
Dim NameSplit() As String = DataSplit(1).Split(New String() {" | "}, System.StringSplitOptions.RemoveEmptyEntries)
' CR_title = String.Join(" ", Title.Split(invalids, StringSplitOptions.RemoveEmptyEntries)).TrimEnd("."c).Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", "")
' MsgBox(URLSplit(1) + vbNewLine + DataSplit(1))
Dim NameKomplett As String = Nothing
Try
NameKomplett = String.Join(" ", NameSplit(0).Split(invalids, StringSplitOptions.RemoveEmptyEntries)).TrimEnd("."c).Replace(Chr(34), "").Replace("\", "").Replace("/", "").Replace(":", "")
NameKomplett = RemoveExtraSpaces(String.Join(" ", NameKomplett.Split(invalids, StringSplitOptions.RemoveEmptyEntries)).TrimEnd("."c)).Replace(Chr(34), "").Replace("\", "").Replace("/", "")
Catch ex As Exception
End Try
'
If NameKomplett = Nothing Or NameKomplett = "Use Custom Name" Then
NameKomplett = GeräteID2().Replace("CRD-Temp-File", "misc_download-#")
End If
Dim Namep1 As String = "Other"
Dim Namep2 As String = NameKomplett + VideoFormat
Dim Reso As String = "NaN"
Dim HardSub As String = "maybe?"
Dim ThumbnialURL As String = "no"
Dim URL_DL As String = "-i " + Chr(34) + UrlSplit(1).Replace(vbCrLf, "").Replace(vbCr, "").Replace(vbLf, "") + Chr(34) + ffmpeg_command
Dim Pfad_DL As String = Path.Combine(Pfad, Namep2)
Dim Service As String = "other"
Me.Invoke(New Action(Function() As Object
If MessageBox.Show(NameKomplett + vbNewLine + vbNewLine + URL_DL, "Confirm Download", MessageBoxButtons.OKCancel) = DialogResult.OK Then
Else
strRequest = rootPath & "Post_Mass_Sucess.html" 'PostPage
SendHTMLResponse(stream, strRequest)
Return Nothing
Exit Function
End If
ItemConstructor(NameKomplett, Namep1, Namep2, Reso, HardSub, ThumbnialURL, URL_DL, Chr(34) + Pfad_DL + Chr(34), Service)
Return Nothing
End Function))
'End If
strRequest = rootPath & "Post_Mass_Sucess.html" 'PostPage
SendHTMLResponse(stream, strRequest)
End If
Catch abort As ThreadAbortException
Exit Sub
Catch ex As Exception
Dim ErrorPage As String = My.Resources.Post_error_Top + ex.ToString + My.Resources.Post_error_Bottom
SendHTMLResponse(stream, Nothing, New ServerResponse(ErrorPage, "html"))
End Try
Else
strRequest = rootPath & "error_Page_default.html" 'PostPage
SendHTMLResponse(stream, strRequest)