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
2022-05-28 22:17:12 +02:00
Imports System . Text
2022-10-22 13:53:55 +02:00
Imports System . Runtime . InteropServices . ComTypes
2022-11-10 14:31:11 +01:00
Imports System . Windows . Forms . VisualStyles . VisualStyleElement . Status
2023-01-21 11:21:39 +01:00
Imports Newtonsoft . Json . Linq
2023-06-03 15:57:13 +02:00
Imports System . Timers
Imports System . Security . Policy
2024-01-06 14:35:22 +01:00
Imports Crunchyroll_Downloader . CRD_Classes
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
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
SubFolder_Value = SubFolder_Nothing
2022-12-02 18:43:43 +01:00
My . Settings . SubFolder_Value = SubFolder_Value
2020-12-02 21:01:30 +01:00
ElseIf ComboBox2 . Text = SubFolder_automatic Then
SubFolder_Value = SubFolder_automatic
2022-12-02 18:43:43 +01:00
My . Settings . SubFolder_Value = SubFolder_Value
2020-12-02 21:01:30 +01:00
ElseIf ComboBox2 . Text = SubFolder_automatic2 Then
SubFolder_Value = SubFolder_automatic2
2022-12-02 18:43:43 +01:00
My . Settings . SubFolder_Value = SubFolder_Value
2019-11-10 00:16:12 +01:00
Else
2020-12-02 21:01:30 +01:00
SubFolder_Value = ComboBox2 . Text
2022-12-02 18:43:43 +01:00
My . Settings . SubFolder_Value = SubFolder_Value
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
2023-02-22 14:50:53 +01:00
DownloadScope . SelectedIndex = Main . DownloadScope
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
2023-06-03 15:57:13 +02:00
btn_dl . Cursor = Cursors . No
btn_dl . BackgroundImage = My . Resources . main_button_download_deactivate
If File . Exists ( " cookies.txt " ) = True Or Main . BowserWasOpen = True Then
btn_dl . BackgroundImage = My . Resources . main_button_download_default
btn_dl . Cursor = Cursors . Default
End If
2020-11-13 15:57:34 +01:00
Try
Me . Icon = My . Resources . icon
Catch ex As Exception
End Try
2020-10-31 23:36:52 +01:00
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
2022-12-02 18:43:43 +01:00
SubFolder_Value = My . Settings . SubFolder_Value
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
2023-02-09 13:24:51 +01:00
Dim TS As TimeSpan = TimeSpan . FromDays ( 3666 )
If Main . HideFLInt = 1 Then
TS = TimeSpan . FromMilliseconds ( 1 )
ElseIf Main . HideFLInt = 2 Then
TS = TimeSpan . FromDays ( 7 )
ElseIf Main . HideFLInt = 3 Then
TS = TimeSpan . FromDays ( 30 )
ElseIf Main . HideFLInt = 4 Then
TS = TimeSpan . FromDays ( 90 )
ElseIf Main . HideFLInt = 5 Then
TS = TimeSpan . FromDays ( 180 )
End If
'MsgBox(TS.ToString)
2019-11-10 00:16:12 +01:00
Try
Dim di As New System . IO . DirectoryInfo ( Main . Pfad )
For Each fi As System . IO . DirectoryInfo In di . EnumerateDirectories ( " *.* " , System . IO . SearchOption . TopDirectoryOnly )
2023-02-09 13:24:51 +01:00
If fi . Attributes . HasFlag ( System . IO . FileAttributes . Hidden ) = False Then
'MsgBox(fi.Name + vbNewLine + fi.LastAccessTime.ToString)
If fi . Name = SubFolder_Value = True Then
ComboBox2 . Items . Add ( fi . Name )
ElseIf fi . LastAccessTime > Date . Now . Subtract ( TS ) = True Then
ComboBox2 . Items . Add ( fi . Name )
End If
2019-11-10 00:16:12 +01:00
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
2023-07-11 18:53:50 +02:00
' MsgBox(ex.ToString)
'SubFolder_Nothing
ComboBox2 . SelectedItem = SubFolder_Nothing
2019-11-10 00:16:12 +01:00
End Try
2022-12-02 18:43:43 +01:00
'Timer3.Enabled = True
End Sub
2021-04-05 19:08:42 +02:00
2019-11-10 00:16:12 +01:00
2021-09-20 20:37:57 +02:00
Private Sub Btn_dl_Click ( sender As Object , e As EventArgs ) Handles btn_dl . Click
2021-12-20 18:10:51 +01:00
2023-06-03 15:57:13 +02:00
If btn_dl . Cursor = Cursors . No Then
Exit Sub
End If
2021-12-20 18:10:51 +01:00
2020-06-01 18:43:38 +02:00
Main . LoginOnly = " Download Mode! "
2021-09-20 20:37:57 +02:00
'MsgBox(Main.WebbrowserURL)
2023-02-21 14:17:59 +01:00
2019-11-10 00:16:12 +01:00
If groupBox1 . Visible = True Then
2022-10-01 12:47:02 +02:00
' Main.LoadedUrls.Clear()
2023-06-03 15:57:13 +02:00
Try
2023-09-10 16:28:23 +02:00
If CBool ( InStr ( textBox1 . Text , " :\ " ) ) Then
Main . ProcessLocal ( textBox1 . Text )
2024-01-09 17:55:11 +01:00
ElseIf CBool ( InStr ( textBox1 . Text , " .m3u8 " ) ) Then
' Main.ProcessLocal(textBox1.Text)
Dim NameKomplett As String = TextBox2 . Text
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
Dim Reso As String = " NaN "
Dim HardSub As String = " maybe? "
Dim ThumbnialURL As String = " no "
2024-01-11 22:02:32 +01:00
Dim URL_DL As String = " -i " + Chr ( 34 ) + textBox1 . Text + Chr ( 34 ) + " " + Main . ffmpeg_command
2024-01-09 17:55:11 +01:00
Dim Pfad_DL As String = Path . Combine ( Main . Pfad , Namep2 )
Dim Service As String = " other "
2024-01-11 22:02:32 +01:00
MsgBox ( URL_DL )
2024-01-09 17:55:11 +01:00
2024-01-11 22:02:32 +01:00
Main . ItemConstructor ( NameKomplett , Namep1 , Namep2 , Reso , HardSub , ThumbnialURL , URL_DL , Chr ( 34 ) + Pfad_DL + Chr ( 34 ) , Service )
2023-09-10 16:28:23 +02:00
ElseIf CBool ( InStr ( textBox1 . Text , " crunchyroll.com " ) ) Or CBool ( InStr ( textBox1 . Text , " funimation.com " ) ) Then
2021-04-05 19:08:42 +02:00
2020-11-19 22:28:42 +01:00
2022-10-01 12:13:29 +02:00
'If StatusLabel.Text = "Status: waiting for episode selection" Then
' If MessageBox.Show("Are you sure you want cancel the advanced download?", "confirm?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
' StatusLabel.Text = "Status: idle"
' Else
' Exit Sub
' btn_dl.Enabled = True
' End If
' 'ElseIf LabelUpdate = "Status: looking for video file" Then
' ' Exit Sub
' ' pictureBox4.Enabled = True
'Else
2023-06-19 20:17:59 +02:00
If Main . RunningQueue = True Then
If CBool ( InStr ( textBox1 . Text , " series/ " ) ) Then
Debug . WriteLine ( " Queue_Block_series " )
'textBox1.Text = "URL"
StatusLabel . Text = " Status: Series add blocked, queue is running! "
Pause ( 5 )
StatusLabel . Text = " Status: Idle "
Else
Debug . WriteLine ( " Queue_Block " )
Main . ListBoxList . Add ( textBox1 . Text )
textBox1 . Text = " URL "
StatusLabel . Text = " Status: Added to Queue "
Pause ( 5 )
StatusLabel . Text = " Status: Idle "
End If
ElseIf Main . RunningDownloads >= Main . MaxDL Then
2022-10-01 12:13:29 +02:00
Debug . WriteLine ( " Max_Dl " )
2023-01-07 19:04:56 +01:00
Main . ListBoxList . Add ( textBox1 . Text )
2022-10-01 12:13:29 +02:00
textBox1 . Text = " URL "
2023-06-19 20:17:59 +02:00
StatusLabel . Text = " Status: Added to Queue "
Pause ( 5 )
StatusLabel . Text = " Status: Idle "
2020-12-21 12:18:18 +01:00
Else
2021-12-20 18:10:51 +01:00
2022-10-01 12:13:29 +02:00
If CBool ( InStr ( textBox1 . Text , " funimation.com " ) ) Then
Main . WebbrowserURL = textBox1 . Text
If CBool ( InStr ( textBox1 . Text , " funimation.com/v/ " ) ) Then
2022-12-02 18:43:43 +01:00
Dim Episode0 ( ) As String = textBox1 . Text . Split ( New String ( ) { " ? " } , System . StringSplitOptions . RemoveEmptyEntries )
Dim Episode ( ) As String = Episode0 ( 0 ) . Split ( New String ( ) { " / " } , System . StringSplitOptions . RemoveEmptyEntries )
2022-10-01 12:13:29 +02:00
Dim v1JsonUrl As String = " https://d33et77evd9bgg.cloudfront.net/data/v1/episodes/ " + Episode ( Episode . Length - 1 ) + " .json "
2022-12-27 17:04:25 +01:00
'MsgBox(v1JsonUrl)
2022-10-01 12:13:29 +02:00
Dim v1Json As String = Nothing
Try
Using client As New WebClient ( )
client . Encoding = System . Text . Encoding . UTF8
2023-04-21 17:03:00 +02:00
client . Headers . Add ( My . Settings . User_Agend . Replace ( Chr ( 34 ) , " " ) )
2022-10-01 12:13:29 +02:00
v1Json = client . DownloadString ( v1JsonUrl )
End Using
2022-12-02 18:43:43 +01:00
Main . WebbrowserURL = textBox1 . Text
2022-10-01 12:13:29 +02:00
Main . GetFunimationNewJS_VideoProxy ( Nothing , v1Json )
Exit Sub
Catch ex As Exception
2022-12-02 18:43:43 +01:00
Debug . WriteLine ( " error- getting v1Json data for the bypass " )
2022-10-01 12:13:29 +02:00
Debug . WriteLine ( ex . ToString )
End Try
2023-06-03 15:57:13 +02:00
ElseIf CBool ( InStr ( textBox1 . Text , " funimation.com/shows/ " ) ) Then
Main . LoadingUrl = textBox1 . Text
Main . LoadedUrls . Clear ( )
Main . b = False
Debug . WriteLine ( " loading funimation show url: " + Date . Now . ToString )
StatusLabel . Text = " Status: loading funimation.... "
'Main.LoadBrowser()
Browser . WebView2 . CoreWebView2 . Navigate ( textBox1 . Text )
Exit Sub
2021-12-20 18:10:51 +01:00
End If
2022-10-01 12:13:29 +02:00
End If
2021-07-04 17:22:46 +02:00
2022-10-01 12:13:29 +02:00
If Main . Grapp_RDY = True Then
2021-07-04 17:22:46 +02:00
2022-10-01 12:13:29 +02:00
Main . b = False
2022-12-19 21:15:30 +01:00
Debug . WriteLine ( " what's going on?: " + Date . Now . ToString )
2022-10-01 12:13:29 +02:00
StatusLabel . Text = " Status: loading .... "
2023-01-07 19:04:56 +01:00
Main . LoadBrowser ( textBox1 . Text )
2022-10-01 12:13:29 +02:00
Else
Debug . WriteLine ( " Not Ready! " )
2020-12-21 12:18:18 +01:00
End If
End If
2022-10-01 12:13:29 +02:00
'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
2023-01-07 19:04:56 +01:00
Main . LoadBrowser ( textBox1 . Text )
2019-12-21 14:40:47 +01:00
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 )
2023-06-03 15:57:13 +02:00
Main . b = True
MsgBox ( Main . URL_Invaild , MsgBoxStyle . OkOnly )
2019-11-10 00:16:12 +01:00
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
groupBox2 . Visible = False
Main . Grapp_Abord = True
Main . b = True
groupBox1 . Visible = True
2022-10-01 12:13:29 +02:00
btn_dl . Text = " Download "
2021-09-20 20:37:57 +02:00
btn_dl . BackgroundImage = My . Resources . main_button_download_default
2022-10-01 12:13:29 +02:00
StatusLabel . Text = " Status: idle "
2021-05-23 22:27:56 +02:00
ElseIf CBool ( InStr ( Main . WebbrowserURL , " funimation.com " ) ) = True Then
2022-10-01 12:13:29 +02:00
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
2022-07-08 20:54:20 +02:00
bt_Cancel_mass . Enabled = False
bt_Cancel_mass . Visible = False
2021-05-23 22:27:56 +02:00
Main . DownloadFunimationJS_Seasons ( )
2024-01-06 14:35:22 +01:00
CB_EP1 . Enabled = False
CB_EP0 . Enabled = False
CB_Season . Enabled = False
2021-05-23 22:27:56 +02:00
2022-10-20 18:23:22 +02:00
ElseIf CBool ( InStr ( Main . WebbrowserURL , " crunchyroll.com " ) ) = True Then
2021-04-05 19:08:42 +02: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 "
2021-04-05 19:08:42 +02:00
Mass_DL_Cancel = True
2022-07-08 20:54:20 +02:00
bt_Cancel_mass . Enabled = False
bt_Cancel_mass . Visible = False
2021-09-20 20:37:57 +02:00
2021-04-05 19:08:42 +02:00
Main . DownloadBetaSeasons ( )
2024-01-06 14:35:22 +01:00
CB_EP1 . Enabled = False
CB_EP0 . Enabled = False
CB_Season . Enabled = False
2021-04-05 19:08:42 +02:00
2021-12-19 13:38:19 +01:00
2019-11-10 00:16:12 +01:00
End If
2021-04-05 19:08:42 +02:00
2023-01-07 19:04:56 +01:00
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
2023-06-03 15:57:13 +02:00
If btn_dl . Cursor = Cursors . No Then
Exit Sub
End If
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
2023-06-03 15:57:13 +02:00
If btn_dl . Cursor = Cursors . No Then
Exit Sub
End If
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
2022-07-08 20:54:20 +02:00
Private Sub bt_Cancel_mass_Click ( sender As Object , e As EventArgs ) Handles bt_Cancel_mass . Click
2019-11-10 00:16:12 +01:00
groupBox1 . Visible = True
groupBox2 . Visible = False
End Sub
2022-07-08 20:54:20 +02:00
Private Sub bt_Cancel_mass_MouseEnter ( sender As Object , e As EventArgs ) Handles bt_Cancel_mass . MouseEnter
bt_Cancel_mass . BackgroundImage = My . Resources . add_mass_cancel_hover
End Sub
Private Sub bt_Cancel_mass_MouseLeave ( sender As Object , e As EventArgs ) Handles bt_Cancel_mass . MouseLeave
bt_Cancel_mass . BackgroundImage = My . Resources . add_mass_cancel
End Sub
2023-01-21 11:21:39 +01:00
Public Sub FillCREpisodes ( ByVal EpisodeJson As String )
2023-03-27 18:19:02 +02:00
2023-01-21 11:21:39 +01:00
EpisodeJson = CleanJSON ( EpisodeJson )
Main . CR_MassEpisodes . Clear ( )
2023-03-27 18:19:02 +02:00
Dim audio_locale_filter As String = Nothing
2023-01-21 11:21:39 +01:00
Dim EpisodeJObject As JObject = JObject . Parse ( EpisodeJson )
Dim EpisodeData As List ( Of JToken ) = EpisodeJObject . Children ( ) . ToList
For Each item As JProperty In EpisodeData
item . CreateReader ( )
Select Case item . Name
Case " data " 'each record is inside the entries array
For Each Entry As JObject In item . Values
2023-03-27 18:19:02 +02:00
Dim audio_locale As String = Entry . GetValue ( " audio_locale " ) . ToString
If audio_locale_filter = Nothing Then
audio_locale_filter = audio_locale
ElseIf CBool ( InStr ( audio_locale_filter , audio_locale ) ) = False Then
'MsgBox(audio_locale + vbNewLine + audio_locale_filter)
Continue For
End If
2023-01-21 11:21:39 +01:00
Dim episode_number As String = Entry . GetValue ( " episode_number " ) . ToString
Dim episode_id As String = Entry . GetValue ( " id " ) . ToString
Dim slug_title As String = Entry . GetValue ( " slug_title " ) . ToString
2024-01-06 14:35:22 +01:00
CB_EP0 . Items . Add ( " Episode " + episode_number )
CB_EP1 . Items . Add ( " Episode " + episode_number )
Main . CR_MassEpisodes . Add ( New CR_Seasons ( episode_id , slug_title , Main . CR_MassSeasons . Item ( CB_Season . SelectedIndex ) . Auth , " " ) )
2023-03-27 18:19:02 +02:00
2023-01-21 11:21:39 +01:00
Next
End Select
Next
2024-01-06 14:35:22 +01:00
If CB_EP0 . Items . Count > 0 Then
CB_EP0 . SelectedIndex = 0
CB_EP1 . SelectedIndex = CB_EP1 . Items . Count - 1
2023-01-21 11:21:39 +01:00
End If
2024-01-06 14:35:22 +01:00
CB_EP0 . Enabled = True
CB_EP1 . Enabled = True
2023-01-21 11:21:39 +01:00
End Sub
2024-01-06 14:35:22 +01:00
Private Sub ComboBox1_SelectedIndexChanged ( sender As Object , e As EventArgs ) Handles CB_Season . SelectedIndexChanged
2022-10-20 18:23:22 +02:00
If CBool ( InStr ( Main . WebbrowserURL , " crunchyroll.com " ) ) = True Then
2024-01-06 14:35:22 +01:00
CB_EP0 . Items . Clear ( )
CB_EP1 . Items . Clear ( )
CB_EP0 . Enabled = False
CB_EP1 . Enabled = False
CB_EP0 . Text = Nothing
CB_EP1 . Text = Nothing
'get guid
Dim guid As String = Nothing
For i As Integer = 0 To Main . CR_MassSeasons . Count - 1
If " Season " + Main . CR_MassSeasons . Item ( i ) . Season = CB_Season . Text And Main . ConvertSubValue ( Main . CR_MassSeasons . Item ( i ) . audio_locale , ConvertSubsEnum . DisplayText ) = CB_Dub . Text Then
guid = Main . CR_MassSeasons . Item ( i ) . guid
'MsgBox(guid + vbNewLine + Main.CR_MassSeasons.Item(i).audio_locale)
End If
Next
If guid = Nothing Then
MsgBox ( " Requested guid not found " , MsgBoxStyle . Critical )
Exit Sub
End If
' Dim JsonUrl As String = "https://www.crunchyroll.com/content/v2/cms/seasons/" + Main.CR_MassSeasons.Item(CB_Season.SelectedIndex).guid + "/episodes?preferred_audio_language=" + Main.DubSprache.CR_Value + "&locale=" + Main.locale
Dim JsonUrl As String = " https://www.crunchyroll.com/content/v2/cms/seasons/ " + guid + " /episodes?preferred_audio_language= " + Main . DubSprache . CR_Value + " &locale= " + Main . locale
2022-10-20 18:23:22 +02:00
2021-04-05 19:08:42 +02:00
2023-01-21 12:57:00 +01:00
Dim Loc_CR_Cookies = " -H " + Chr ( 34 ) + Main . CR_Cookies . Replace ( Chr ( 34 ) , " " ) . Replace ( " -H " , " " ) + Chr ( 34 )
2022-10-21 20:25:48 +02:00
2023-01-21 12:57:00 +01:00
2023-04-09 09:31:16 +02:00
Dim EpisodeJson As String = Nothing 'CurlAuth(JsonUrl, Loc_CR_Cookies, Main.CR_MassSeasons.Item(ComboBox1.SelectedIndex).Auth) '
Try
2024-01-06 14:35:22 +01:00
EpisodeJson = CurlAuthNew ( JsonUrl , Loc_CR_Cookies , Main . CR_MassSeasons . Item ( CB_Season . SelectedIndex ) . Auth ) '
2023-04-09 09:31:16 +02:00
Catch ex As Exception
If CBool ( InStr ( ex . ToString , " Error - Getting " ) ) Then
MsgBox ( " Error invalid CR respone " )
Exit Sub
Else
MsgBox ( " Error processing data " )
Exit Sub
End If
End Try
2022-10-21 20:25:48 +02:00
2023-03-27 18:19:02 +02:00
'My.Computer.Clipboard.SetText(EpisodeJson)
2022-12-27 17:04:25 +01:00
FillCREpisodes ( EpisodeJson )
2022-10-21 20:25:48 +02:00
2022-07-08 20:54:20 +02:00
2023-01-21 11:21:39 +01:00
ElseIf Main . WebbrowserURL = " https://funimation.com/js " Then
2024-01-06 14:35:22 +01:00
CB_EP0 . Items . Clear ( )
CB_EP1 . Items . Clear ( )
CB_EP0 . Text = Nothing
CB_EP1 . Text = Nothing
2022-10-01 12:13:29 +02:00
Dim ContentID As String = Nothing
2021-09-26 22:01:31 +02:00
2022-10-01 12:13:29 +02:00
For i As Integer = 0 To Main . FunimtaionSeasonList . Count - 1
2024-01-06 14:35:22 +01:00
If CB_Season . Text = Main . FunimtaionSeasonList . Item ( i ) . Title Then
2022-10-01 12:13:29 +02:00
ContentID = Main . FunimtaionSeasonList . Item ( i ) . ID
Exit For
2021-09-26 22:01:31 +02:00
End If
2022-10-01 12:13:29 +02:00
Next
2021-09-26 22:01:31 +02:00
2022-10-01 12:13:29 +02:00
If ContentID = Nothing Then
MsgBox ( " error during season selection " )
Exit Sub
End If
2021-09-26 22:01:31 +02:00
2022-10-01 12:13:29 +02:00
Dim BaseUrl ( ) As String = Main . FunimationSeasonAPIUrl . Split ( New String ( ) { " /shows/ " } , System . StringSplitOptions . RemoveEmptyEntries )
2021-05-23 22:27:56 +02:00
2022-10-01 12:13:29 +02:00
Dim EpisodeJsonURL As String = BaseUrl ( 0 ) + " /seasons/ " + ContentID + " .json "
Dim EpisodeJson As String = Nothing
Debug . WriteLine ( EpisodeJsonURL )
Try
Using client As New WebClient ( )
client . Encoding = System . Text . Encoding . UTF8
2023-04-21 17:03:00 +02:00
client . Headers . Add ( My . Settings . User_Agend . Replace ( Chr ( 34 ) , " " ) )
2022-10-01 12:13:29 +02:00
EpisodeJson = client . DownloadString ( EpisodeJsonURL )
End Using
Catch ex As Exception
Debug . WriteLine ( " error- getting EpisodeJson data " )
Debug . WriteLine ( ex . ToString )
Main . FunimationJsonBrowser = " EpisodeJson "
2023-01-07 19:04:56 +01:00
Main . LoadBrowser ( EpisodeJsonURL )
2022-10-01 12:13:29 +02:00
Exit Sub
End Try
2021-05-23 22:27:56 +02:00
2022-10-01 12:13:29 +02:00
FillFunimationEpisodes ( EpisodeJson )
2021-05-23 22:27:56 +02:00
2021-09-26 22:01:31 +02:00
2024-01-06 14:35:22 +01:00
If CB_EP0 . Items . Count > 0 Then
CB_EP0 . SelectedIndex = 0
CB_EP1 . SelectedIndex = CB_EP1 . Items . Count - 1
2022-07-08 20:54:20 +02:00
End If
2021-05-23 22:27:56 +02:00
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
2022-12-27 17:04:25 +01:00
2021-07-04 17:22:46 +02:00
Public Sub FillFunimationEpisodes ( ByVal EpisodeJson As String )
Main . FunimationEpisodeJSON = EpisodeJson
2024-01-06 14:35:22 +01:00
CB_EP0 . Enabled = True
CB_EP1 . Enabled = True
2021-07-04 17:22:46 +02:00
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 )
2024-01-06 14:35:22 +01:00
CB_EP0 . Items . Add ( " Episode " + EpisodeSplit2 ( 0 ) )
CB_EP1 . Items . Add ( " Episode " + EpisodeSplit2 ( 0 ) )
2021-07-04 17:22:46 +02:00
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
2020-09-30 18:24:45 +02:00
2019-11-10 00:16:12 +01:00
2021-09-20 20:37:57 +02:00
2022-05-22 11:01:32 +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
2021-09-20 20:37:57 +02:00
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-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
2023-01-07 19:04:56 +01:00
2020-12-13 16:11:43 +01:00
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
2022-11-10 14:31:11 +01:00
My . Settings . Pfad = Main . Pfad
My . Settings . Save ( )
2020-12-18 13:47:55 +01:00
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
2023-02-21 14:17:59 +01:00
Private Sub SubTitlesOnlyCB_SelectedIndexChanged ( sender As Object , e As EventArgs ) Handles DownloadScope . SelectedIndexChanged
Main . DownloadScope = DownloadScope . SelectedIndex
2023-02-22 14:50:53 +01:00
My . Settings . DownloadScope = Main . DownloadScope
My . Settings . Save ( )
2021-03-20 13:02:49 +01:00
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
2023-01-01 20:47:09 +01:00
If Not TextBox2 . Text = " Use Custom Name " And CBool ( InStr ( TextBox2 . Text , " ++ " ) ) = False Then
2022-05-22 11:01:32 +02:00
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
2024-01-06 14:35:22 +01:00
Private Sub CB_Dub_SelectedIndexChanged ( sender As Object , e As EventArgs ) Handles CB_Dub . SelectedIndexChanged
'MsgBox(CB_Dub.Text)
'MsgBox(Main.DubSprache.DisplayText)
If My . Settings . OverrideDub = True And CBool ( InStr ( CB_Dub . Text , Main . DubSprache . DisplayText ) ) = False Then
MessageBox . Show ( " The Duboveride might change the Dub to: " + Main . DubSprache . DisplayText , " Settings - Override enabled " , MessageBoxButtons . OK )
End If
'clear everything below the dub
CB_Season . Items . Clear ( )
CB_EP0 . Items . Clear ( )
CB_EP1 . Items . Clear ( )
'also remove display text
CB_Season . Text = Nothing
CB_EP0 . Text = Nothing
CB_EP1 . Text = Nothing
For i As Integer = 0 To Main . CR_MassSeasons . Count - 1
If Main . ConvertSubValue ( Main . CR_MassSeasons . Item ( i ) . audio_locale , ConvertSubsEnum . DisplayText ) = CB_Dub . Text Then
CB_Season . Items . Add ( " Season " + Main . CR_MassSeasons . Item ( i ) . Season )
End If
Next
CB_Season . Enabled = True
End Sub
2023-01-07 19:04:56 +01:00
2021-09-20 20:37:57 +02:00
End Class