From ab042c6eeea48650ed699d785e68802abd1a87e8 Mon Sep 17 00:00:00 2001 From: hama3254 <52826614+hama3254@users.noreply.github.com> Date: Fri, 13 Jan 2023 14:05:30 +0100 Subject: [PATCH] improvement CR stream selector improvement CR stream selector #661 --- .vs/Crunchyroll Downloader/v17/.suo | Bin 185856 -> 189952 bytes Crunchyroll Downloader/CRD-Classes.vb | 2 +- Crunchyroll Downloader/Main.vb | 105 +++++++++++++----------- Crunchyroll Downloader/einstellungen.vb | 11 +-- 4 files changed, 64 insertions(+), 54 deletions(-) diff --git a/.vs/Crunchyroll Downloader/v17/.suo b/.vs/Crunchyroll Downloader/v17/.suo index 37d1d8c488afae10f03da6a717100d228f87aecb..18ed2bf8a38c8036f5abc6af0e18ca19597bde1b 100644 GIT binary patch delta 8369 zcmeHM4OrAw)}M12hCz@9MH~@vKtv?K;X@Dv8s%A0YeyStkUl@}wNks(^^hO}0!1`AFEoe0Ol z0Ua+qHDJ=P4`G#*BT<7jaEG{nb((ctKjNuM<1+V;;_?ng5+h!vs#9HLVjyEaqnuH~7{HLi^3gG!z({5UGNkpSx#~Zj^uJE<1phk7f-gYWO^E- z7bDn%FWbI$)n~d&J(tCdS&TD`evCPczB&AJKO>j%0OMDT$&9xda-dRIDMRo1)VlbR z*PrPr;?r3JwZobEFUHjbY2H;9@;^wBI?n`g>+|6ecdWj7*CgrHqtu zr;Ma!%E;0)Ww=_`oyH9Y#*gKU?7%s5!<3QjG9Pa?Wn|9EJXJGfK3-=1-9Mi*|9Z;! zva&daG}!$(Qf4mK+&MFf1%51N{F(p1kTSg%N6QKJL^P^Yk&K}XH{Zy#XzsOGEg2%z zZ}R$*2Ft(FH(;DE$O$N9Q0D=Ngu( zzN!dj$-T#8tb8*(Dyr|q8On=4rfbk*Y2;)<^FV%g<)Cq>$C|Q2ts-L=! zFD<&4d8ZjgjI)gKjBgm{8Q(Hw|4XhigiASZlIMO>mz%iZ>RF`^b_|5m*|px#G9+xu)cYk5K1fG+HNWL`U8Raq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FRStmNcUi`Zd2zIoz^0fjjm_3-<|32%U1rWJAO8K#r^Ev@ zIs%Rj*y8)~>k~&crc7@<8h;nouKzxnd=D;rI4d6JcYg45ZrdBlcYTnc#>Vl(ALOQ` zmc1IkPB zEQM~@N~2cgKO#&6*~6lvfNiH*v1}r%Wl1AMT{O$2B#}Ox9afYKW@1z$#)Yw^!nBAP zSW=>_FsLV^PNFq8i$v2nRw$;8VG-f4^{hqjp9`LJ{uTwp(vsL#$$Z3xAa+a?TUZor z6#FaLMwXP(?>F*${D$c9k_T^Uk4NzgV_^!GKu=<=51T4yyj0W>%MuNv*dd`Ez{-1V z(~K;wx8EQ=b1R*Gn8**T*koui8rQNOe?4u@pV0wav+~#XFKur}3OXub;?+0|`7xn)x8Ual0^eQ@6`&XG1MK%@TF6nier^t-SsSy9IE(j z0)80AhOw$1KcX~`1;FvaFpuLN!!6!ZocA)OmdPm0oEjzctxPW#uV+T3bT(^HV^$iT zF=UC*mokI0dM;Z>7&~*8;wSHP3>Ed9LbjF6S6N=fwubPI%0wk`F*`>h{ug*eqW7{m zG8s zvzS2P1ZGl9Ev!S`TQT^0xnSqu!7_ouMXC>Wd`~;O#&-`cceXJm+#fQFV!6!RBpM!N ddxZZ>xQ4ghQ^3m{)A_*3PHpddYeh-k{{UZ>tLp#& diff --git a/Crunchyroll Downloader/CRD-Classes.vb b/Crunchyroll Downloader/CRD-Classes.vb index f49f79b..2706e2e 100644 --- a/Crunchyroll Downloader/CRD-Classes.vb +++ b/Crunchyroll Downloader/CRD-Classes.vb @@ -61,7 +61,7 @@ Public Class CR_Beta_Stream 'ByVal audioLanguage As String, Public Sub New(ByVal subLang As String, ByVal Format As String, ByVal Url As String) Me.subLang = subLang - Me.Url = Url + Me.Url = Url.Replace("&", "&").Replace("/u0026", "&").Replace("\u002F", "/").Replace("\u0026", "&") Me.Format = Format End Sub 'Me.audioLanguage, diff --git a/Crunchyroll Downloader/Main.vb b/Crunchyroll Downloader/Main.vb index d8db40e..a938717 100644 --- a/Crunchyroll Downloader/Main.vb +++ b/Crunchyroll Downloader/Main.vb @@ -1446,26 +1446,27 @@ Public Class Main End Select Next - Dim CR_URI_Master As String = Nothing + Dim CR_URI_Master As New List(Of String) - Dim RawStream As String = "" + Dim RawStream As New List(Of String) For i As Integer = 0 To CR_Streams.Count - 1 Debug.WriteLine(CR_Streams.Item(i).subLang) If CR_Streams.Item(i).subLang = CR_HardSubLang Then - CR_URI_Master = CR_Streams.Item(i).Url + CR_URI_Master.Add(CR_Streams.Item(i).Url) ElseIf CR_Streams.Item(i).subLang = "" And CR_audio_locale IsNot "ja-JP" And DubMode = True Then 'nothing/raw - RawStream = CR_Streams.Item(i).Url + RawStream.Add(CR_Streams.Item(i).Url) End If Next - If CR_URI_Master = Nothing And RawStream IsNot "" Then - CR_URI_Master = RawStream + If CR_URI_Master.Count = 0 And RawStream.Count > 0 Then + CR_URI_Master.Clear() + CR_URI_Master.AddRange(RawStream) - ElseIf CR_URI_Master = Nothing Then + ElseIf CR_URI_Master.Count = 0 Then Me.Invoke(New Action(Function() As Object ResoNotFoundString = VideoJson DialogTaskString = "Language_CR_Beta" @@ -1482,16 +1483,15 @@ Public Class Main For i As Integer = 0 To CR_Streams.Count - 1 Debug.WriteLine(CR_Streams.Item(i).subLang) If CR_Streams.Item(i).subLang = CR_HardSubLang Then - CR_URI_Master = CR_Streams.Item(i).Url + CR_URI_Master.Add(CR_Streams.Item(i).Url) End If Next End If End If - CR_URI_Master = CR_URI_Master.Replace("&", "&").Replace("/u0026", "&").Replace("\u002F", "/").Replace("\u0026", "&") - If CBool(InStr(CR_URI_Master, "master.m3u8")) Then + If CBool(InStr(CR_URI_Master(0), "master.m3u8")) Then Me.Invoke(New Action(Function() As Object Anime_Add.StatusLabel.Text = "Status: m3u8 found, looking for resolution" Me.Text = "Status: m3u8 found, looking for resolution" @@ -1664,7 +1664,7 @@ Public Class Main If Reso = 42 And HybridMode = False Then - ffmpegInput = "-i " + Chr(34) + CR_URI_Master + Chr(34) + ffmpegInput = "-i " + Chr(34) + CR_URI_Master(0) + Chr(34) ElseIf SubsOnly = True Then ffmpegInput = "-i [Subtitles only]" @@ -1672,54 +1672,67 @@ Public Class Main Dim str As String = Nothing - str = Curl(CR_URI_Master) - If CBool(InStr(str, "x" + Reso.ToString + ",")) Then - ResoUsed = "x" + Reso.ToString - Else - If CBool(InStr(str, ResoSave + ",")) Then - ResoUsed = ResoSave - Else - Me.Invoke(New Action(Function() As Object - DialogTaskString = "Resolution" - ResoNotFoundString = str - ErrorDialog.ShowDialog() - Return Nothing - End Function)) - If UserCloseDialog = True Then - Throw New System.Exception(Chr(34) + "UserAbort" + Chr(34)) - Else - ResoUsed = ResoBackString - ResoSave = ResoBackString - End If - End If - End If - Dim ffmpeg_url_3 As String = Nothing - Dim LineChar As String = vbLf - If CBool(InStr(str, vbCrLf)) Then - LineChar = vbCrLf - ElseIf CBool(InStr(str, vbCr)) Then - LineChar = vbCr - End If - Dim ffmpeg_url_1 As String() = str.Split(New String() {LineChar}, System.StringSplitOptions.RemoveEmptyEntries) - For i As Integer = 0 To ffmpeg_url_1.Count - 2 'Step 2 - If CBool(InStr(ffmpeg_url_1(i), ResoUsed + ",")) Then - ffmpeg_url_3 = ffmpeg_url_1(i + 1) + For i As Integer = 0 To CR_URI_Master.Count - 1 + str = Curl(CR_URI_Master(i)) + + If CBool(InStr(str, "curl:")) = False Then + Exit For End If Next - ffmpegInput = "-i " + Chr(34) + ffmpeg_url_3.Trim() + Chr(34) + If CBool(InStr(str, "curl:")) = True Then - End If + MsgBox("Unable to get master.m3u8" + vbNewLine + str, MsgBoxStyle.Critical) + + ElseIf CBool(InStr(str, "x" + Reso.ToString + ",")) Then + ResoUsed = "x" + Reso.ToString + Else + If CBool(InStr(str, ResoSave + ",")) Then + ResoUsed = ResoSave + Else + Me.Invoke(New Action(Function() As Object + DialogTaskString = "Resolution" + ResoNotFoundString = str + ErrorDialog.ShowDialog() + Return Nothing + End Function)) + If UserCloseDialog = True Then + Throw New System.Exception(Chr(34) + "UserAbort" + Chr(34)) + Else + ResoUsed = ResoBackString + ResoSave = ResoBackString + End If + End If + End If + Dim ffmpeg_url_3 As String = Nothing + Dim LineChar As String = vbLf + If CBool(InStr(str, vbCrLf)) Then + LineChar = vbCrLf + ElseIf CBool(InStr(str, vbCr)) Then + LineChar = vbCr + End If + Dim ffmpeg_url_1 As String() = str.Split(New String() {LineChar}, System.StringSplitOptions.RemoveEmptyEntries) + + For i As Integer = 0 To ffmpeg_url_1.Count - 2 'Step 2 + If CBool(InStr(ffmpeg_url_1(i), ResoUsed + ",")) Then + ffmpeg_url_3 = ffmpeg_url_1(i + 1) + End If + Next + + + ffmpegInput = "-i " + Chr(34) + ffmpeg_url_3.Trim() + Chr(34) + + End If #End Region #Region "GetSoftsubs" - Dim SoftSubsAvailable As New List(Of String) + Dim SoftSubsAvailable As New List(Of String) Dim SoftSubsList As New List(Of CR_Subtiles) diff --git a/Crunchyroll Downloader/einstellungen.vb b/Crunchyroll Downloader/einstellungen.vb index d48f179..3e39377 100644 --- a/Crunchyroll Downloader/einstellungen.vb +++ b/Crunchyroll Downloader/einstellungen.vb @@ -204,10 +204,9 @@ Public Class Einstellungen AAuto.Checked = True End If - Try - CB_CR_Harsubs.Items.Clear() + CB_CR_Harsubs.Items.Clear() - For i As Integer = 0 To Main.SubSpracheEnum.Count - 1 + For i As Integer = 0 To Main.SubSpracheEnum.Count - 1 CB_CR_Harsubs.Items.Add(Main.SubSpracheEnum(i).Name) If Main.SubSpracheEnum(i).CR_Value = Main.SubSprache.CR_Value Then 'MsgBox(CB_CR_Harsubs.Items.Count.ToString) @@ -217,12 +216,10 @@ Public Class Einstellungen End If Next - Catch ex As Exception - MsgBox(ex.ToString) - End Try - DD_Season_Prefix.Text = Main.Season_Prefix + + DD_Season_Prefix.Text = Main.Season_Prefix DD_Episode_Prefix.Text = Main.Episode_Prefix