2021-09-20 20:37:57 +02:00
Option Strict On
Imports Microsoft . Win32
2019-11-10 00:16:12 +01:00
Imports System . Net
2020-01-12 16:25:55 +01:00
Imports System . IO
2020-11-04 19:11:38 +01:00
Imports System . Threading
2020-12-10 19:18:20 +01:00
Imports MetroFramework . Forms
Imports MetroFramework
Imports MetroFramework . Components
2020-11-04 19:11:38 +01:00
2019-11-10 00:16:12 +01:00
Public Class Anime_Add
Public Mass_DL_Cancel As Boolean = False
Public List_DL_Cancel As Boolean = False
2021-09-20 20:37:57 +02:00
Public ThreadList As New List ( Of Thread )
2021-12-19 13:38:19 +01:00
2020-12-02 21:01:30 +01:00
2021-04-05 19:08:42 +02:00
Public Authorization As String = Nothing
Public AuthorizationCookie As String = Nothing
2019-11-10 00:16:12 +01:00
Private Sub ComboBox2_SelectedIndexChanged ( sender As Object , e As EventArgs ) Handles ComboBox2 . SelectedIndexChanged
Try
2020-12-02 21:01:30 +01:00
If ComboBox2 . Text = SubFolder_Nothing Then
Dim rk As RegistryKey = Registry . CurrentUser . CreateSubKey ( " Software\CRDownloader " )
rk . SetValue ( " SubFolder_Value " , SubFolder_Nothing , RegistryValueKind . String )
SubFolder_Value = SubFolder_Nothing
ElseIf ComboBox2 . Text = SubFolder_automatic Then
2019-11-10 00:16:12 +01:00
Dim rk As RegistryKey = Registry . CurrentUser . CreateSubKey ( " Software\CRDownloader " )
2020-12-02 21:01:30 +01:00
rk . SetValue ( " SubFolder_Value " , SubFolder_automatic , RegistryValueKind . String )
SubFolder_Value = SubFolder_automatic
ElseIf ComboBox2 . Text = SubFolder_automatic2 Then
2019-11-10 00:16:12 +01:00
Dim rk As RegistryKey = Registry . CurrentUser . CreateSubKey ( " Software\CRDownloader " )
2020-12-02 21:01:30 +01:00
rk . SetValue ( " SubFolder_Value " , SubFolder_automatic2 , RegistryValueKind . String )
SubFolder_Value = SubFolder_automatic2
2019-11-10 00:16:12 +01:00
Else
Dim rk As RegistryKey = Registry . CurrentUser . CreateSubKey ( " Software\CRDownloader " )
rk . SetValue ( " SubFolder_Value " , ComboBox2 . Text , RegistryValueKind . String )
2020-12-02 21:01:30 +01:00
SubFolder_Value = ComboBox2 . Text
2019-11-10 00:16:12 +01:00
End If
Catch ex As Exception
2020-12-02 21:01:30 +01:00
ComboBox2 . Text = SubFolder_Nothing
2019-11-10 00:16:12 +01:00
End Try
End Sub
2020-12-10 19:18:20 +01:00
Dim Manager As MetroStyleManager = Main . Manager
2019-11-10 00:16:12 +01:00
Private Sub Anime_Add_Load ( sender As Object , e As EventArgs ) Handles MyBase . Load
2021-03-20 13:02:49 +01:00
SubTitlesOnlyCB . SelectedIndex = 0
2020-12-10 19:18:20 +01:00
Manager . Owner = Me
Me . StyleManager = Manager
2020-12-13 16:11:43 +01:00
Btn_Close . Image = Main . CloseImg
Btn_min . Image = Main . MinImg
2021-01-16 14:08:33 +01:00
ListBox1 . BackColor = Main . BackColorValue
ListBox1 . ForeColor = Main . ForeColorValue
2020-11-13 15:57:34 +01:00
Try
Me . Icon = My . Resources . icon
Catch ex As Exception
End Try
2020-06-01 18:43:38 +02:00
Try
2020-10-31 23:36:52 +01:00
Dim ListBox1List As New List ( Of String )
'Jeder Eintrag in der Combobox durchgehen
For Each item As String In Main . ListBoxList
'Wenn der Combobox-Eintrag noch nicht in der Result-List vorhanden ist, Eintrag der Result-List hinzufügen
If ListBox1List . Contains ( item ) = False Then
ListBox1List . Add ( item )
End If
2020-06-01 18:43:38 +02:00
Next
2020-10-31 23:36:52 +01:00
ListBox1 . Items . Clear ( )
'Die Result-List der Combobox hinzufügen
ListBox1 . Items . AddRange ( ListBox1List . ToArray )
'For i As Integer = 0 To Main.ListBoxList.Count - 1
' ListBox1.Items.Add(Main.ListBoxList.Item(i))
'Next
2020-06-01 18:43:38 +02:00
Catch ex As Exception
End Try
2020-01-12 16:25:55 +01:00
Try
Main . waveOutSetVolume ( 0 , 0 )
Catch ex As Exception
End Try
2021-09-20 20:37:57 +02:00
Me . Location = New Point ( CInt ( Main . Location . X + Main . Width / 2 - Me . Width / 2 ) , CInt ( Main . Location . Y + Main . Height / 2 - Me . Height / 2 ) )
2019-11-10 00:16:12 +01:00
TextBox4 . Text = Main . Pfad
2020-12-02 21:01:30 +01:00
' Dim SubFolder_Value As String
2019-11-10 00:16:12 +01:00
Try
Dim rkg As RegistryKey = Registry . CurrentUser . OpenSubKey ( " Software\CRDownloader " )
SubFolder_Value = rkg . GetValue ( " SubFolder_Value " ) . ToString
2020-12-02 21:01:30 +01:00
If SubFolder_Value = SubFolder_Nothing Then
ComboBox2 . Items . Add ( SubFolder_automatic )
ComboBox2 . Items . Add ( SubFolder_automatic2 )
ComboBox2 . Items . Add ( SubFolder_Nothing )
ElseIf SubFolder_Value = SubFolder_automatic Then
ComboBox2 . Items . Add ( SubFolder_automatic )
ComboBox2 . Items . Add ( SubFolder_automatic2 )
ComboBox2 . Items . Add ( SubFolder_Nothing )
ElseIf SubFolder_Value = SubFolder_automatic2 Then
ComboBox2 . Items . Add ( SubFolder_automatic )
ComboBox2 . Items . Add ( SubFolder_automatic2 )
ComboBox2 . Items . Add ( SubFolder_Nothing )
2019-11-10 00:16:12 +01:00
Else
2020-12-02 21:01:30 +01:00
ComboBox2 . Items . Add ( SubFolder_automatic )
ComboBox2 . Items . Add ( SubFolder_automatic2 )
ComboBox2 . Items . Add ( SubFolder_Nothing )
2019-11-10 00:16:12 +01:00
ComboBox2 . Items . Add ( SubFolder_Value )
End If
Catch ex As Exception
2020-12-02 21:01:30 +01:00
ComboBox2 . Items . Add ( SubFolder_automatic )
ComboBox2 . Items . Add ( SubFolder_automatic2 )
ComboBox2 . Items . Add ( SubFolder_Nothing )
ComboBox2 . SelectedItem = SubFolder_Nothing
SubFolder_Value = SubFolder_Nothing
2019-11-10 00:16:12 +01:00
End Try
Try
Dim di As New System . IO . DirectoryInfo ( Main . Pfad )
For Each fi As System . IO . DirectoryInfo In di . EnumerateDirectories ( " *.* " , System . IO . SearchOption . TopDirectoryOnly )
If fi . Attributes . HasFlag ( System . IO . FileAttributes . Hidden ) Then
Else
ComboBox2 . Items . Add ( fi . Name )
End If
Next
Dim Result As New List ( Of String )
'Jeder Eintrag in der Combobox durchgehen
For Each item As String In ComboBox2 . Items
'Wenn der Combobox-Eintrag noch nicht in der Result-List vorhanden ist, Eintrag der Result-List hinzufügen
If Result . Contains ( item ) = False Then
Result . Add ( item )
End If
Next
'In der Result-List sind jetzt alle Einträge einmal vorhanden
'Combobox leeren
ComboBox2 . Items . Clear ( )
'Die Result-List der Combobox hinzufügen
ComboBox2 . Items . AddRange ( Result . ToArray )
ComboBox2 . SelectedItem = SubFolder_Value
Catch ex As Exception
2022-02-27 12:13:03 +01:00
2019-11-10 00:16:12 +01:00
End Try
End Sub
2021-09-20 20:37:57 +02:00
'Public Sub BetaCR(ByVal Auth As String, ByVal Cookie As String)
2021-04-05 19:08:42 +02:00
2021-09-20 20:37:57 +02:00
' Try
' Using client As New WebClient()
' client.Encoding = System.Text.Encoding.UTF8
' client.Headers.Add(My.Resources.ffmpeg_user_agend.Replace(Chr(34), ""))
' client.Headers.Add("ACCEPT: gzip")
' client.Headers.Add("Cookie: " + Cookie)
' client.Headers.Add("Authorization: " + Auth)
' client.Headers.Add("Content-Type: application/x-www-form-urlencoded")
' client.Headers.Add("Referer: https://beta.crunchyroll.com/") '
' Dim reqparm As New Specialized.NameValueCollection
2021-04-05 19:08:42 +02:00
2021-09-20 20:37:57 +02:00
' reqparm.Add("grant_type", "etp_rt_cookie")
' Dim responsebytes = client.UploadValues("https://beta-api.crunchyroll.com/auth/v1/token", "POST", reqparm)
' Dim responsebody = (New Text.UTF8Encoding).GetString(responsebytes)
' 'My.Computer.Clipboard.SetText(responsebody)
' End Using
' Catch ex As Exception
' MsgBox(ex.ToString)
' End Try
2021-04-05 19:08:42 +02:00
2019-11-10 00:16:12 +01:00
2021-09-20 20:37:57 +02:00
'End Sub
Private Sub Btn_dl_Click ( sender As Object , e As EventArgs ) Handles btn_dl . Click
2021-12-20 18:10:51 +01:00
2021-09-20 20:37:57 +02:00
CefSharp_Browser . Show ( )
2020-06-01 18:43:38 +02:00
Main . LoginOnly = " Download Mode! "
2021-09-20 20:37:57 +02:00
'MsgBox(Main.WebbrowserURL)
2021-03-20 13:02:49 +01:00
If SubTitlesOnlyCB . Text = " [Default] " Then
Main . SubsOnly = False
Else
Main . SubsOnly = True
End If
2019-11-10 00:16:12 +01:00
If groupBox1 . Visible = True Then
2021-09-20 20:37:57 +02:00
2019-11-10 00:16:12 +01:00
Try
2021-09-20 20:37:57 +02:00
If CBool ( InStr ( textBox1 . Text , " crunchyroll.com " ) ) Or CBool ( InStr ( textBox1 . Text , " funimation.com " ) ) Or CBool ( InStr ( textBox1 . Text , " vrv.co/series/ " ) ) Or CBool ( InStr ( textBox1 . Text , " vrv.co/watch/ " ) ) Then
2021-04-05 19:08:42 +02:00
2020-11-19 22:28:42 +01:00
If StatusLabel . Text = " Status: waiting for episode selection " Then
2020-12-21 12:18:18 +01:00
If MessageBox . Show ( " Are you sure you want cancel the advanced download? " , " confirm? " , MessageBoxButtons . YesNo , MessageBoxIcon . Question ) = DialogResult . Yes Then
StatusLabel . Text = " Status: idle "
2020-11-19 22:28:42 +01:00
Else
2020-12-21 12:18:18 +01:00
Exit Sub
2021-09-20 20:37:57 +02:00
btn_dl . Enabled = True
2020-11-04 19:11:38 +01:00
End If
2020-12-21 12:18:18 +01:00
'ElseIf LabelUpdate = "Status: looking for video file" Then
' Exit Sub
' pictureBox4.Enabled = True
Else
If Main . RunningDownloads >= Main . MaxDL Then
ListBox1 . Items . Add ( textBox1 . Text )
textBox1 . ForeColor = Color . FromArgb ( 9248044 )
2020-11-19 22:28:42 +01:00
Pause ( 1 )
2020-12-21 12:18:18 +01:00
textBox1 . ForeColor = Color . Black
textBox1 . Text = " URL "
Else
2021-12-20 18:10:51 +01:00
If CBool ( InStr ( textBox1 . Text , " funimation.com " ) ) Then
Main . WebbrowserURL = textBox1 . Text
If CBool ( InStr ( textBox1 . Text , " funimation.com/v/ " ) ) Then
Dim Episode ( ) As String = textBox1 . Text . Split ( New String ( ) { " / " } , System . StringSplitOptions . RemoveEmptyEntries )
Dim v1JsonUrl As String = " https://d33et77evd9bgg.cloudfront.net/data/v1/episodes/ " + Episode ( Episode . Length - 1 ) + " .json "
Dim v1Json As String = Nothing
Try
Using client As New WebClient ( )
client . Encoding = System . Text . Encoding . UTF8
client . Headers . Add ( My . Resources . ffmpeg_user_agend . Replace ( Chr ( 34 ) , " " ) )
v1Json = client . DownloadString ( v1JsonUrl )
End Using
Main . GetFunimationNewJS_VideoProxy ( Nothing , v1Json )
Exit Sub
Catch ex As Exception
Debug . WriteLine ( " error- getting v1Json data for the bypasss " )
Debug . WriteLine ( ex . ToString )
End Try
End If
End If
2020-12-21 12:18:18 +01:00
If Main . Grapp_RDY = True Then
2021-07-04 17:22:46 +02:00
2020-12-21 12:18:18 +01:00
Main . b = False
2021-09-20 20:37:57 +02:00
Debug . WriteLine ( " Start loading: " + Date . Now . ToString )
CefSharp_Browser . WebBrowser1 . Load ( textBox1 . Text )
2021-07-04 17:22:46 +02:00
StatusLabel . Text = " Status: loading .... "
2020-11-19 22:28:42 +01:00
End If
2020-12-21 12:18:18 +01:00
End If
End If
2021-04-05 19:08:42 +02:00
2020-11-04 19:11:38 +01:00
2020-12-02 21:01:30 +01:00
ElseIf CBool ( InStr ( textBox1 . Text , " Test=true " ) ) Then
2021-09-20 20:37:57 +02:00
CefSharp_Browser . WebBrowser1 . Load ( textBox1 . Text )
2021-02-07 13:47:30 +01:00
'Else 'If CBool(InStr(textBox1.Text, "vrv.co")) Then
ElseIf CBool ( InStr ( textBox1 . Text , " https:// " ) ) Then
2020-12-21 12:18:18 +01:00
If MessageBox . Show ( " This in NOT a Crunchyroll URL, try anyway? " , " confirm? " , MessageBoxButtons . YesNo , MessageBoxIcon . Question ) = DialogResult . Yes Then
2021-04-05 19:08:42 +02:00
Main . b = False
2021-09-20 20:37:57 +02:00
CefSharp_Browser . WebBrowser1 . Load ( textBox1 . Text )
2019-12-21 14:40:47 +01:00
StatusLabel . Text = " Status: looking for non CR video file "
2021-04-05 19:08:42 +02:00
2019-12-21 14:40:47 +01:00
Else
Exit Sub
2021-09-20 20:37:57 +02:00
btn_dl . Enabled = True
2019-12-21 14:40:47 +01:00
End If
2021-09-20 20:37:57 +02:00
Else
MsgBox ( Main . URL_Invaild , MsgBoxStyle . OkOnly )
2019-11-10 00:16:12 +01:00
End If
Catch ex As Exception
2021-05-23 22:27:56 +02:00
MsgBox ( ex . ToString )
2019-11-10 00:16:12 +01:00
Main . b = True
MsgBox ( Main . URL_Invaild , MsgBoxStyle . OkOnly )
End Try
ElseIf groupBox2 . Visible = True Then
2021-04-05 19:08:42 +02:00
2019-11-10 00:16:12 +01:00
If Mass_DL_Cancel = True Then
Mass_DL_Cancel = False
GroupBox3 . Visible = False
groupBox2 . Visible = False
Main . Grapp_Abord = True
Main . b = True
groupBox1 . Visible = True
2021-09-20 20:37:57 +02:00
btn_dl . BackgroundImage = My . Resources . main_button_download_default
2021-05-23 22:27:56 +02:00
ElseIf CBool ( InStr ( Main . WebbrowserURL , " funimation.com " ) ) = True Then
StatusLabel . Text = " Status: idle "
2021-09-20 20:37:57 +02:00
'btn_dl.BackgroundImage = My.Resources.add_mass_running_cancel
btn_dl . Text = " Cancel "
2021-05-23 22:27:56 +02:00
Mass_DL_Cancel = True
PictureBox1 . Enabled = False
PictureBox1 . Visible = False
Main . DownloadFunimationJS_Seasons ( )
comboBox4 . Enabled = False
comboBox3 . Enabled = False
ComboBox1 . Enabled = False
2021-04-05 19:08:42 +02:00
ElseIf CBool ( InStr ( Main . WebbrowserURL , " beta.crunchyroll.com " ) ) = True Then
StatusLabel . Text = " Status: idle "
2021-09-20 20:37:57 +02:00
'btn_dl.BackgroundImage = My.Resources.add_mass_running_cancel
btn_dl . Text = " Cancel "
2021-04-05 19:08:42 +02:00
Mass_DL_Cancel = True
PictureBox1 . Enabled = False
PictureBox1 . Visible = False
2021-09-20 20:37:57 +02:00
2021-04-05 19:08:42 +02:00
Main . DownloadBetaSeasons ( )
comboBox4 . Enabled = False
comboBox3 . Enabled = False
ComboBox1 . Enabled = False
2021-09-20 20:37:57 +02:00
ElseIf CBool ( InStr ( Main . WebbrowserURL , " vrv.co " ) ) = True Then
2021-04-05 19:08:42 +02:00
2021-09-20 20:37:57 +02:00
StatusLabel . Text = " Status: idle "
'btn_dl.BackgroundImage = My.Resources.add_mass_running_cancel
btn_dl . Text = " Cancel "
Mass_DL_Cancel = True
PictureBox1 . Enabled = False
PictureBox1 . Visible = False
Main . Download_VRV_Seasons ( )
comboBox4 . Enabled = False
comboBox3 . Enabled = False
ComboBox1 . Enabled = False
2021-12-19 13:38:19 +01:00
2019-11-10 00:16:12 +01:00
Else
2020-11-04 19:11:38 +01:00
2019-11-10 00:16:12 +01:00
StatusLabel . Text = " Status: idle "
2021-09-20 20:37:57 +02:00
'btn_dl.BackgroundImage = My.Resources.add_mass_running_cancel
btn_dl . Text = " Cancel "
2019-11-10 00:16:12 +01:00
Mass_DL_Cancel = True
PictureBox1 . Enabled = False
PictureBox1 . Visible = False
Main . MassDL ( )
comboBox4 . Enabled = False
comboBox3 . Enabled = False
ComboBox1 . Enabled = False
End If
2021-04-05 19:08:42 +02:00
2020-01-12 16:25:55 +01:00
ElseIf GroupBox3 . Visible = True Then
2021-05-23 22:27:56 +02:00
GroupBox3 . Visible = False
2019-11-10 00:16:12 +01:00
groupBox2 . Visible = False
groupBox1 . Visible = True
List_DL_Cancel = False
2021-09-20 20:37:57 +02:00
btn_dl . BackgroundImage = My . Resources . main_button_download_default
2019-11-10 00:16:12 +01:00
End If
2020-09-30 18:24:45 +02:00
2021-09-20 20:37:57 +02:00
btn_dl . Enabled = True
2019-11-10 00:16:12 +01:00
End Sub
2021-05-23 22:27:56 +02:00
Public Sub ProcessFunimationJS ( ByVal InputURL As String )
Dim FunUri As String = Nothing
2021-09-20 20:37:57 +02:00
If CBool ( InStr ( InputURL , " ? " ) ) Then
2021-05-23 22:27:56 +02:00
Dim ClearUri As String ( ) = InputURL . Split ( New String ( ) { " ? " } , System . StringSplitOptions . RemoveEmptyEntries )
FunUri = ClearUri ( 0 )
Else
FunUri = InputURL
End If
Dim ShowPath As String = Nothing
Dim EpisodePath As String = Nothing
Dim ShowPath1 As String ( ) = FunUri . Split ( New String ( ) { " /shows/ " } , System . StringSplitOptions . RemoveEmptyEntries )
2021-09-20 20:37:57 +02:00
'If CBool(InStr(ShowPath1(1), "/") Then
2021-05-23 22:27:56 +02:00
Dim ShowPath2 As String ( ) = ShowPath1 ( 1 ) . Split ( New String ( ) { " / " } , System . StringSplitOptions . RemoveEmptyEntries )
If ShowPath2 . Count > 1 Then
2021-09-20 20:37:57 +02:00
ShowPath = ShowPath2 ( 0 ) . Replace ( " / " , " " )
EpisodePath = ShowPath2 ( 1 ) . Replace ( " / " , " " )
2021-05-23 22:27:56 +02:00
Else
2021-09-20 20:37:57 +02:00
ShowPath = ShowPath1 ( 1 ) . Replace ( " / " , " " )
2021-05-23 22:27:56 +02:00
End If
2021-09-20 20:37:57 +02:00
Main . FunimationShowPath = ShowPath + " / "
Debug . WriteLine ( ShowPath )
Debug . WriteLine ( Main . FunimationAPIRegion )
2021-05-23 22:27:56 +02:00
If EpisodePath = Nothing Then 'overview site
Main . GetFunimationJS_Seasons ( " https://title-api.prd.funimationsvc.com/v2/shows/ " + ShowPath + Main . FunimationAPIRegion )
Else 'single episode
End If
Dim FunimationCC As String ( ) = ShowPath1 ( 0 ) . Split ( New String ( ) { " funimation.com " } , System . StringSplitOptions . RemoveEmptyEntries )
If FunimationCC . Count > 1 Then
Main . FunimationRegion = FunimationCC ( 1 ) . Replace ( " / " , " " )
End If
End Sub
2021-09-20 20:37:57 +02:00
Private Sub Btn_dl_MouseEnter ( sender As Object , e As EventArgs ) Handles btn_dl . MouseEnter
2019-11-10 00:16:12 +01:00
If Mass_DL_Cancel = True Then
2021-09-20 20:37:57 +02:00
btn_dl . Text = " Cancel "
btn_dl . BackgroundImage = My . Resources . main_button_download_hovert
2019-11-10 00:16:12 +01:00
ElseIf List_DL_Cancel = True Then
2021-09-20 20:37:57 +02:00
btn_dl . Text = " Cancel "
btn_dl . BackgroundImage = My . Resources . main_button_download_hovert
2019-11-10 00:16:12 +01:00
Else
2021-09-20 20:37:57 +02:00
btn_dl . Text = " Download "
btn_dl . BackgroundImage = My . Resources . main_button_download_hovert
2019-11-10 00:16:12 +01:00
End If
End Sub
2021-09-20 20:37:57 +02:00
Private Sub Btn_dl_MouseLeave ( sender As Object , e As EventArgs ) Handles btn_dl . MouseLeave
2019-11-10 00:16:12 +01:00
If Mass_DL_Cancel = True Then
2021-09-20 20:37:57 +02:00
btn_dl . Text = " Cancel "
btn_dl . BackgroundImage = My . Resources . main_button_download_hovert
2019-11-10 00:16:12 +01:00
ElseIf List_DL_Cancel = True Then
2021-09-20 20:37:57 +02:00
btn_dl . Text = " Cancel "
btn_dl . BackgroundImage = My . Resources . main_button_download_hovert
2019-11-10 00:16:12 +01:00
Else
2021-09-20 20:37:57 +02:00
btn_dl . Text = " Download "
btn_dl . BackgroundImage = My . Resources . main_button_download_default
2019-11-10 00:16:12 +01:00
End If
End Sub
2020-01-12 16:25:55 +01:00
Private Sub TextBox1_Click ( sender As Object , e As EventArgs ) Handles textBox1 . Click
2019-11-10 00:16:12 +01:00
If textBox1 . Text = " URL " Then
textBox1 . Text = Nothing
End If
End Sub
Private Sub PictureBox1_Click ( sender As Object , e As EventArgs ) Handles PictureBox1 . Click
groupBox1 . Visible = True
groupBox2 . Visible = False
End Sub
Private Sub ComboBox1_SelectedIndexChanged ( sender As Object , e As EventArgs ) Handles ComboBox1 . SelectedIndexChanged
2021-04-05 19:08:42 +02:00
If CBool ( InStr ( Main . WebbrowserURL , " beta.crunchyroll.com " ) ) = True Then
comboBox3 . Items . Clear ( )
comboBox4 . Items . Clear ( )
comboBox3 . Enabled = True
comboBox4 . Enabled = True
2021-05-23 22:27:56 +02:00
comboBox3 . Text = Nothing
comboBox4 . Text = Nothing
2021-04-05 19:08:42 +02:00
Dim SeasonSplit ( ) As String = Main . CrBetaMass . Split ( New String ( ) { Chr ( 34 ) + " id " + Chr ( 34 ) + " : " + Chr ( 34 ) } , System . StringSplitOptions . RemoveEmptyEntries )
Dim SeasonSplit2 ( ) As String = SeasonSplit ( ComboBox1 . SelectedIndex + 1 ) . Split ( New String ( ) { Chr ( 34 ) } , System . StringSplitOptions . RemoveEmptyEntries )
2021-05-23 22:27:56 +02:00
Dim EpisodeJsonURL As String = Main . CrBetaMassBaseURL + " episodes?season_id= " + SeasonSplit2 ( 0 ) + " &locale= " + Main . CrBetaMassParameters
2021-04-05 19:08:42 +02:00
Dim EpisodeJson As String = Nothing
Debug . WriteLine ( EpisodeJsonURL )
Try
Using client As New WebClient ( )
client . Encoding = System . Text . Encoding . UTF8
client . Headers . Add ( My . Resources . ffmpeg_user_agend . Replace ( Chr ( 34 ) , " " ) )
EpisodeJson = client . DownloadString ( EpisodeJsonURL )
End Using
Catch ex As Exception
Debug . WriteLine ( " error- getting EpisodeJson data " )
2021-07-04 17:22:46 +02:00
Debug . WriteLine ( ex . ToString )
2021-04-25 16:26:45 +02:00
Exit Sub
2021-04-05 19:08:42 +02:00
End Try
Main . CrBetaMassEpisodes = EpisodeJson
2021-04-25 16:26:45 +02:00
2021-05-23 22:27:56 +02:00
Dim EpisodeNameSplit ( ) As String = EpisodeJson . Split ( New String ( ) { Chr ( 34 ) + " title " + Chr ( 34 ) + " : " + Chr ( 34 ) } , System . StringSplitOptions . RemoveEmptyEntries )
2021-04-25 16:26:45 +02:00
2021-04-05 19:08:42 +02:00
Dim EpisodeSplit ( ) As String = EpisodeJson . Split ( New String ( ) { Chr ( 34 ) + " episode " + Chr ( 34 ) + " : " + Chr ( 34 ) } , System . StringSplitOptions . RemoveEmptyEntries )
2021-05-23 22:27:56 +02:00
For i As Integer = 1 To EpisodeSplit . Count - 1
Dim EpisodeSplit2 ( ) As String = EpisodeSplit ( i ) . Split ( New String ( ) { Chr ( 34 ) } , System . StringSplitOptions . RemoveEmptyEntries )
Dim EpisodeNameSplit2 ( ) As String = EpisodeNameSplit ( i ) . Split ( New String ( ) { Chr ( 34 ) } , System . StringSplitOptions . RemoveEmptyEntries )
If EpisodeSplit ( i ) . Substring ( 0 , 1 ) = Chr ( 34 ) Then
comboBox3 . Items . Add ( EpisodeNameSplit2 ( 0 ) )
comboBox4 . Items . Add ( EpisodeNameSplit2 ( 0 ) )
Else
comboBox3 . Items . Add ( " Episode " + EpisodeSplit2 ( 0 ) )
comboBox4 . Items . Add ( " Episode " + EpisodeSplit2 ( 0 ) )
End If
Next
2021-09-20 20:37:57 +02:00
ElseIf CBool ( InStr ( Main . WebbrowserURL , " vrv.co " ) ) = True Then
comboBox3 . Items . Clear ( )
comboBox4 . Items . Clear ( )
comboBox3 . Enabled = True
comboBox4 . Enabled = True
comboBox3 . Text = Nothing
comboBox4 . Text = Nothing
Dim SeasonSplit ( ) As String = Main . VRVMass . Split ( New String ( ) { Chr ( 34 ) + " id " + Chr ( 34 ) + " : " + Chr ( 34 ) } , System . StringSplitOptions . RemoveEmptyEntries )
Dim SeasonSplit2 ( ) As String = SeasonSplit ( ComboBox1 . SelectedIndex + 1 ) . Split ( New String ( ) { Chr ( 34 ) } , System . StringSplitOptions . RemoveEmptyEntries )
Dim EpisodeJsonURL As String = Main . VRVMassBaseURL + " episodes?season_id= " + SeasonSplit2 ( 0 ) + " &Policy= " + Main . VRVMassParameters
Dim EpisodeJson As String = Nothing
Debug . WriteLine ( EpisodeJsonURL )
Try
Using client As New WebClient ( )
client . Encoding = System . Text . Encoding . UTF8
client . Headers . Add ( My . Resources . ffmpeg_user_agend . Replace ( Chr ( 34 ) , " " ) )
EpisodeJson = client . DownloadString ( EpisodeJsonURL )
End Using
Catch ex As Exception
Debug . WriteLine ( " error- getting EpisodeJson data " )
Debug . WriteLine ( ex . ToString )
Exit Sub
End Try
Main . VRVMassEpisodes = EpisodeJson
Dim EpisodeNameSplit ( ) As String = EpisodeJson . Split ( New String ( ) { Chr ( 34 ) + " title " + Chr ( 34 ) + " : " + Chr ( 34 ) } , System . StringSplitOptions . RemoveEmptyEntries )
Dim EpisodeSplit ( ) As String = EpisodeJson . Split ( New String ( ) { Chr ( 34 ) + " episode " + Chr ( 34 ) + " : " + Chr ( 34 ) } , System . StringSplitOptions . RemoveEmptyEntries )
For i As Integer = 1 To EpisodeSplit . Count - 1
Dim EpisodeSplit2 ( ) As String = EpisodeSplit ( i ) . Split ( New String ( ) { Chr ( 34 ) } , System . StringSplitOptions . RemoveEmptyEntries )
Dim EpisodeNameSplit2 ( ) As String = EpisodeNameSplit ( i ) . Split ( New String ( ) { Chr ( 34 ) } , System . StringSplitOptions . RemoveEmptyEntries )
If EpisodeSplit ( i ) . Substring ( 0 , 1 ) = Chr ( 34 ) Then
comboBox3 . Items . Add ( EpisodeNameSplit2 ( 0 ) )
comboBox4 . Items . Add ( EpisodeNameSplit2 ( 0 ) )
Else
comboBox3 . Items . Add ( " Episode " + EpisodeSplit2 ( 0 ) )
comboBox4 . Items . Add ( " Episode " + EpisodeSplit2 ( 0 ) )
End If
Next
ElseIf Main . WebbrowserURL = " https://funimation.com/js " Then
2021-05-23 22:27:56 +02:00
comboBox3 . Items . Clear ( )
comboBox4 . Items . Clear ( )
comboBox3 . Text = Nothing
comboBox4 . Text = Nothing
2021-09-26 22:01:31 +02:00
Dim ContentID As String = Nothing
For i As Integer = 0 To Main . FunimtaionSeasonList . Count - 1
If ComboBox1 . Text = Main . FunimtaionSeasonList . Item ( i ) . Title Then
ContentID = Main . FunimtaionSeasonList . Item ( i ) . ID
Exit For
End If
Next
If ContentID = Nothing Then
MsgBox ( " error during season selection " )
Exit Sub
End If
Dim BaseUrl ( ) As String = Main . FunimationSeasonAPIUrl . Split ( New String ( ) { " /shows/ " } , System . StringSplitOptions . RemoveEmptyEntries )
2021-05-23 22:27:56 +02:00
2021-09-26 22:01:31 +02:00
Dim EpisodeJsonURL As String = BaseUrl ( 0 ) + " /seasons/ " + ContentID + " .json "
2021-05-23 22:27:56 +02:00
Dim EpisodeJson As String = Nothing
Debug . WriteLine ( EpisodeJsonURL )
Try
Using client As New WebClient ( )
client . Encoding = System . Text . Encoding . UTF8
client . Headers . Add ( My . Resources . ffmpeg_user_agend . Replace ( Chr ( 34 ) , " " ) )
EpisodeJson = client . DownloadString ( EpisodeJsonURL )
End Using
Catch ex As Exception
Debug . WriteLine ( " error- getting EpisodeJson data " )
2021-07-04 17:22:46 +02:00
Debug . WriteLine ( ex . ToString )
Main . FunimationJsonBrowser = " EpisodeJson "
2021-09-20 20:37:57 +02:00
CefSharp_Browser . WebBrowser1 . Load ( EpisodeJsonURL )
2021-05-23 22:27:56 +02:00
Exit Sub
End Try
2021-09-26 22:01:31 +02:00
FillFunimationEpisodes ( EpisodeJson )
2021-05-23 22:27:56 +02:00
2021-12-19 13:38:19 +01:00
Else
2020-11-04 19:11:38 +01:00
2021-04-05 19:08:42 +02:00
'MsgBox(Main.WebbrowserURL)
2020-11-04 19:11:38 +01:00
comboBox3 . Items . Clear ( )
comboBox4 . Items . Clear ( )
2021-03-08 21:08:26 +01:00
comboBox3 . Enabled = True
comboBox4 . Enabled = True
2020-11-04 19:11:38 +01:00
'comboBox3.Items.Add("[First Episode]")
'comboBox4.Items.Add("[Last Episode]")
Dim SeasonDropdownAnzahl As String ( ) = Main . WebbrowserText . Split ( New String ( ) { " season-dropdown content-menu block " } , System . StringSplitOptions . RemoveEmptyEntries )
Array . Reverse ( SeasonDropdownAnzahl )
Dim SDV As Integer = 0
For i As Integer = 0 To SeasonDropdownAnzahl . Count - 1
2021-09-20 20:37:57 +02:00
If CBool ( InStr ( SeasonDropdownAnzahl ( i ) , Chr ( 34 ) + " > " + ComboBox1 . SelectedItem . ToString + " </a> " ) ) Then
2020-11-04 19:11:38 +01:00
SDV = i
End If
Next
'MsgBox(SDV)
Dim Anzahl As String ( ) = SeasonDropdownAnzahl ( SDV ) . Split ( New String ( ) { " wrapper container-shadow hover-classes " } , System . StringSplitOptions . RemoveEmptyEntries )
'MsgBox(Anzahl(0))
Dim c As Integer = Anzahl . Count - 1
Array . Reverse ( Anzahl )
For i As Integer = 0 To Anzahl . Count - 2
Dim URLGrapp As String ( ) = Anzahl ( i ) . Split ( New String ( ) { " title= " + Chr ( 34 ) } , System . StringSplitOptions . RemoveEmptyEntries )
Dim URLGrapp2 As String ( ) = URLGrapp ( 1 ) . Split ( New String ( ) { Chr ( 34 ) } , System . StringSplitOptions . RemoveEmptyEntries )
comboBox3 . Items . Add ( URLGrapp2 ( 0 ) )
comboBox4 . Items . Add ( URLGrapp2 ( 0 ) )
Next
2021-05-01 13:56:48 +02:00
2020-11-04 19:11:38 +01:00
End If
2019-11-10 00:16:12 +01:00
End Sub
2021-07-04 17:22:46 +02:00
Public Sub FillFunimationEpisodes ( ByVal EpisodeJson As String )
Main . FunimationEpisodeJSON = EpisodeJson
comboBox3 . Enabled = True
comboBox4 . Enabled = True
2021-09-26 22:01:31 +02:00
Dim EpisodeSplit ( ) As String = EpisodeJson . Split ( New String ( ) { Chr ( 34 ) + " episodeNumber " + Chr ( 34 ) + " : " + Chr ( 34 ) } , System . StringSplitOptions . RemoveEmptyEntries )
'EpisodeJson.Split(New String() {Chr(34) + "episodeNumber" + Chr(34) + ": " + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
Debug . WriteLine ( EpisodeSplit . Count . ToString )
2021-07-04 17:22:46 +02:00
For i As Integer = 1 To EpisodeSplit . Count - 1
Dim EpisodeSplit2 ( ) As String = EpisodeSplit ( i ) . Split ( New String ( ) { Chr ( 34 ) } , System . StringSplitOptions . RemoveEmptyEntries )
comboBox3 . Items . Add ( " Episode " + EpisodeSplit2 ( 0 ) )
comboBox4 . Items . Add ( " Episode " + EpisodeSplit2 ( 0 ) )
Next
2021-09-26 22:01:31 +02:00
Main . WebbrowserURL = " https://funimation.com/js "
2021-07-04 17:22:46 +02:00
End Sub
2019-11-10 00:16:12 +01:00
Private Sub PictureBox1_MouseEnter ( sender As Object , e As EventArgs ) Handles PictureBox1 . MouseEnter
PictureBox1 . Image = My . Resources . add_mass_cancel_hover
End Sub
Private Sub PictureBox1_MouseLeave ( sender As Object , e As EventArgs ) Handles PictureBox1 . MouseLeave
PictureBox1 . Image = My . Resources . add_mass_cancel
End Sub
Private Sub Timer1_Tick ( sender As Object , e As EventArgs ) Handles Timer1 . Tick
If ListBox1 . Items . Count > 0 Then
If StatusLabel . Text = " Status: idle " Then
2021-08-08 12:23:22 +02:00
StatusLabel . Cursor = Cursors . Hand
StatusLabel . Text = " Status: items in queue, click me to work off. "
2019-11-10 00:16:12 +01:00
End If
2021-08-08 12:23:22 +02:00
Else
StatusLabel . Cursor = Cursors . Default
2019-11-10 00:16:12 +01:00
End If
End Sub
#Region "Listbox"
Private Sub Timer2_Tick ( sender As Object , e As EventArgs ) Handles Timer2 . Tick
If GroupBox3 . Visible = True Then
If ListBox1 . Items . Count = 0 Then
GroupBox3 . Visible = False
groupBox2 . Visible = False
groupBox1 . Visible = True
List_DL_Cancel = False
2021-09-20 20:37:57 +02:00
btn_dl . BackgroundImage = My . Resources . main_button_download_default
2019-11-10 00:16:12 +01:00
End If
End If
2021-03-08 21:08:26 +01:00
Try
Dim ItemFinshedCount As Integer = 0
For i As Integer = 0 To Main . ListView1 . Items . Count - 1
If Main . ItemList ( i ) . GetIsStatusFinished ( ) = True Then
ItemFinshedCount = ItemFinshedCount + 1
End If
Next
Main . RunningDownloads = Main . ListView1 . Items . Count - ItemFinshedCount
Catch ex As Exception
Main . RunningDownloads = Main . ListView1 . Items . Count
End Try
2020-08-16 23:27:48 +02:00
If Main . RunningDownloads < Main . MaxDL Then
2019-11-10 00:16:12 +01:00
If ListBox1 . Items . Count > 0 Then
If GroupBox3 . Visible = True Then
2021-09-20 20:37:57 +02:00
If CBool ( InStr ( ListBox1 . GetItemText ( ListBox1 . Items ( 0 ) ) , " funimation.com " ) ) Then
2020-09-30 18:24:45 +02:00
If Main . Funimation_Grapp_RDY = True Then
2021-01-16 14:08:33 +01:00
Dim UriUsed As String = ListBox1 . GetItemText ( ListBox1 . Items ( 0 ) )
2021-12-19 13:38:19 +01:00
If CBool ( InStr ( UriUsed , " funimation.com/v/ " ) ) Then
Dim Episode ( ) As String = UriUsed . Split ( New String ( ) { " / " } , System . StringSplitOptions . RemoveEmptyEntries )
Dim v1JsonUrl As String = " https://d33et77evd9bgg.cloudfront.net/data/v1/episodes/ " + Episode ( Episode . Length - 1 ) + " .json "
Dim v1Json As String = Nothing
Try
Using client As New WebClient ( )
client . Encoding = System . Text . Encoding . UTF8
client . Headers . Add ( My . Resources . ffmpeg_user_agend . Replace ( Chr ( 34 ) , " " ) )
v1Json = client . DownloadString ( v1JsonUrl )
End Using
2021-12-20 18:10:51 +01:00
Main . Funimation_Grapp_RDY = False
Main . WebbrowserURL = UriUsed
ListBox1 . Items . Remove ( ListBox1 . Items ( 0 ) )
Main . b = False
Main . Invalidate ( )
2021-12-19 13:38:19 +01:00
Main . GetFunimationNewJS_VideoProxy ( Nothing , v1Json )
Exit Sub
Catch ex As Exception
Debug . WriteLine ( " error- getting v1Json data for the bypasss " )
Debug . WriteLine ( ex . ToString )
End Try
End If
2021-01-14 18:06:42 +01:00
Main . Funimation_Grapp_RDY = False
2021-02-28 13:22:00 +01:00
Main . WebbrowserURL = UriUsed
2020-09-30 18:24:45 +02:00
ListBox1 . Items . Remove ( ListBox1 . Items ( 0 ) )
2021-06-20 19:02:55 +02:00
Main . b = False
2021-09-20 20:37:57 +02:00
CefSharp_Browser . WebBrowser1 . Load ( UriUsed )
StatusLabel . Text = " Status: loading in browser "
Main . Text = " Status: loading in browser "
2021-02-28 13:22:00 +01:00
2021-09-20 20:37:57 +02:00
Main . Invalidate ( )
2020-09-30 18:24:45 +02:00
End If
Else
If Main . Grapp_RDY = True Then
2021-01-14 18:06:42 +01:00
Main . Grapp_RDY = False
2021-09-20 20:37:57 +02:00
CefSharp_Browser . WebBrowser1 . Load ( ListBox1 . GetItemText ( ListBox1 . Items ( 0 ) ) )
2020-09-30 18:24:45 +02:00
ListBox1 . Items . Remove ( ListBox1 . Items ( 0 ) )
Main . b = False
2020-10-31 23:36:52 +01:00
StatusLabel . Text = " Status: loading ... "
2020-11-13 15:57:34 +01:00
Main . Text = " Status: loading ... "
Main . Invalidate ( )
2020-10-31 23:36:52 +01:00
2020-09-30 18:24:45 +02:00
End If
2019-11-10 00:16:12 +01:00
End If
End If
2020-09-30 18:24:45 +02:00
2019-11-10 00:16:12 +01:00
End If
End If
End Sub
Private Sub StatusLabel_Click ( sender As Object , e As EventArgs ) Handles StatusLabel . Click
2021-08-08 12:23:22 +02:00
If StatusLabel . Text = " Status: items in queue, click me to work off. " Then
2019-11-10 00:16:12 +01:00
groupBox1 . Visible = False
groupBox2 . Visible = False
GroupBox3 . Visible = True
2021-09-20 20:37:57 +02:00
btn_dl . Text = " Cancel "
2019-11-10 00:16:12 +01:00
List_DL_Cancel = True
End If
End Sub
2021-09-20 20:37:57 +02:00
Private Sub TextBox2_Click ( sender As Object , e As EventArgs ) Handles textBox2 . Click
If textBox2 . Text = " Use Custom Name " Then
textBox2 . Text = Nothing
2020-01-02 15:13:38 +01:00
End If
2019-11-10 00:16:12 +01:00
End Sub
2020-01-02 15:13:38 +01:00
2020-06-01 18:43:38 +02:00
Private Sub ListBox1_DoubleClick ( sender As Object , e As EventArgs ) Handles ListBox1 . DoubleClick
ListBox1 . Items . Remove ( ListBox1 . SelectedItem )
End Sub
2020-02-02 16:39:54 +01:00
2019-11-10 00:16:12 +01:00
#End Region
2020-12-02 21:01:30 +01:00
2020-12-13 16:11:43 +01:00
Private Sub Anime_Add_Resize ( sender As Object , e As EventArgs ) Handles Me . Resize
Btn_Close . Location = New Point ( Me . Width - 40 , 1 )
Btn_min . Location = New Point ( Me . Width - 68 , 10 )
End Sub
Private Sub Btn_min_Click ( sender As Object , e As EventArgs ) Handles Btn_min . Click
Me . WindowState = System . Windows . Forms . FormWindowState . Minimized
End Sub
Private Sub Btn_Close_Click ( sender As Object , e As EventArgs ) Handles Btn_Close . Click
Main . ListBoxList . Clear ( )
If ListBox1 . Items . Count > 0 Then
For i As Integer = 0 To ListBox1 . Items . Count - 1
2021-09-20 20:37:57 +02:00
Main . ListBoxList . Add ( ListBox1 . Items . Item ( i ) . ToString )
2020-12-13 16:11:43 +01:00
Next
End If
Me . Close ( )
End Sub
Private Sub Btn_min_MouseEnter ( sender As Object , e As EventArgs ) Handles Btn_min . MouseEnter
2021-09-20 20:37:57 +02:00
Btn_min . Image = My . Resources . main_mini_red
2020-12-13 16:11:43 +01:00
End Sub
Private Sub Btn_min_MouseLeave ( sender As Object , e As EventArgs ) Handles Btn_min . MouseLeave
2021-09-20 20:37:57 +02:00
Btn_min . Image = Main . MinImg
2020-12-13 16:11:43 +01:00
End Sub
Private Sub Btn_Close_MouseEnter ( sender As Object , e As EventArgs ) Handles Btn_Close . MouseEnter
2021-09-20 20:37:57 +02:00
Btn_Close . Image = My . Resources . main_del
2020-12-13 16:11:43 +01:00
End Sub
Private Sub Btn_Close_MouseLeave ( sender As Object , e As EventArgs ) Handles Btn_Close . MouseLeave
2021-09-20 20:37:57 +02:00
Btn_Close . Image = Main . CloseImg
2020-12-13 16:11:43 +01:00
End Sub
2020-12-18 13:47:55 +01:00
Private Sub TextBox4_Click ( sender As Object , e As EventArgs ) Handles TextBox4 . Click
Dim FolderBrowserDialog1 As New FolderBrowserDialog ( )
FolderBrowserDialog1 . RootFolder = Environment . SpecialFolder . MyComputer
If FolderBrowserDialog1 . ShowDialog ( ) = DialogResult . OK Then
ComboBox2 . Items . Clear ( )
Main . Pfad = FolderBrowserDialog1 . SelectedPath
Dim rk0 As RegistryKey = Registry . CurrentUser . CreateSubKey ( " Software\CRDownloader " )
rk0 . SetValue ( " Ordner " , Main . Pfad , RegistryValueKind . String )
ComboBox2 . Items . Add ( SubFolder_automatic )
ComboBox2 . Items . Add ( SubFolder_automatic2 )
ComboBox2 . Items . Add ( SubFolder_Nothing )
ComboBox2 . SelectedItem = SubFolder_Nothing
TextBox4 . Text = Main . Pfad
Try
Dim di As New System . IO . DirectoryInfo ( Main . Pfad )
For Each fi As System . IO . DirectoryInfo In di . EnumerateDirectories ( " *.* " , System . IO . SearchOption . TopDirectoryOnly )
If fi . Attributes . HasFlag ( System . IO . FileAttributes . Hidden ) Then
Else
ComboBox2 . Items . Add ( fi . Name )
End If
Next
Dim Result As New List ( Of String )
'Jeder Eintrag in der Combobox durchgehen
For Each item As String In ComboBox2 . Items
'Wenn der Combobox-Eintrag noch nicht in der Result-List vorhanden ist, Eintrag der Result-List hinzufügen
If Result . Contains ( item ) = False Then
Result . Add ( item )
End If
Next
'In der Result-List sind jetzt alle Einträge einmal vorhanden
'Combobox leeren
'ComboBox2.Items.Clear()
'Die Result-List der Combobox hinzufügen
'ComboBox2.Items.AddRange(Result.ToArray)
Catch ex As Exception
End Try
End If
End Sub
2021-01-14 18:06:42 +01:00
2021-03-20 13:02:49 +01:00
Private Sub SubTitlesOnlyCB_SelectedIndexChanged ( sender As Object , e As EventArgs ) Handles SubTitlesOnlyCB . SelectedIndexChanged
If SubTitlesOnlyCB . Text = " [Default] " Then
Main . SubsOnly = False
Else
Main . SubsOnly = True
End If
End Sub
2021-05-23 22:27:56 +02:00
2021-08-08 12:23:22 +02:00
2021-09-20 20:37:57 +02:00
Private Sub GroupBox1_VisibleChanged ( sender As Object , e As EventArgs ) Handles groupBox1 . VisibleChanged
If Not textBox2 . Text = " Use Custom Name " Then
textBox2 . Text = " Use Custom Name "
2021-08-08 12:23:22 +02:00
End If
End Sub
2021-09-20 20:37:57 +02:00
Private Sub Timer3_Tick ( sender As Object , e As EventArgs ) Handles Timer3 . Tick
Try
For tlc As Integer = 0 To ThreadList . Count - 1
If ThreadList . Item ( tlc ) . IsAlive Then
Else
ThreadList . Remove ( ThreadList . Item ( tlc ) )
End If
Next
Catch ex As Exception
End Try
End Sub
End Class