Chapters option, cookie override removed

Chapters are now an option and disabled by default
Cookies are no longer applied to the browser
This commit is contained in:
hama3254 2022-10-25 18:05:57 +02:00
parent e659df955a
commit b8c64a9a0d
5 changed files with 159 additions and 103 deletions

Binary file not shown.

View File

@ -66,25 +66,25 @@ Public Class Anime_Add
If Main.CR_etp_rt IsNot Nothing And etp_rt = False Then
Main.CR_Cookies = "Cookie: " + "etp_rt" + "=" + Main.CR_etp_rt + ";" + Main.CR_Cookies.Replace("Cookie: ", "")
Dim etp_rt_cookie As New CefSharp.Cookie
etp_rt_cookie.Name = "etp_rt"
etp_rt_cookie.Value = Main.CR_etp_rt
etp_rt_cookie.HttpOnly = True
etp_rt_cookie.Domain = ".crunchyroll.com"
Debug.WriteLine("Set etp_rt_cookie: " + CM.SetCookieAsync("http://www.crunchyroll.com", etp_rt_cookie).Result.ToString)
End If
'If Main.CR_etp_rt IsNot Nothing And etp_rt = False Then
' Main.CR_Cookies = "Cookie: " + "etp_rt" + "=" + Main.CR_etp_rt + ";" + Main.CR_Cookies.Replace("Cookie: ", "")
' Dim etp_rt_cookie As New CefSharp.Cookie
' etp_rt_cookie.Name = "etp_rt"
' etp_rt_cookie.Value = Main.CR_etp_rt
' etp_rt_cookie.HttpOnly = True
' etp_rt_cookie.Domain = ".crunchyroll.com"
' Debug.WriteLine("Set etp_rt_cookie: " + CM.SetCookieAsync("http://www.crunchyroll.com", etp_rt_cookie).Result.ToString)
'End If
If Main.CR_ajs_user_id IsNot Nothing And ajs_user_id = False Then
Main.CR_Cookies = Main.CR_Cookies + "ajs_user_id" + "=" + Main.CR_ajs_user_id + ";"
Dim ajs_user_id_cookie As New CefSharp.Cookie
ajs_user_id_cookie.Name = "__cf_bm"
ajs_user_id_cookie.Value = Main.CR_ajs_user_id
ajs_user_id_cookie.HttpOnly = True
ajs_user_id_cookie.Domain = ".crunchyroll.com"
Debug.WriteLine("Set ajs_user_id_cookie: " + CM.SetCookieAsync("http://www.crunchyroll.com", ajs_user_id_cookie).Result.ToString)
End If
'If Main.CR_ajs_user_id IsNot Nothing And ajs_user_id = False Then
' Main.CR_Cookies = Main.CR_Cookies + "ajs_user_id" + "=" + Main.CR_ajs_user_id + ";"
' Dim ajs_user_id_cookie As New CefSharp.Cookie
' ajs_user_id_cookie.Name = "__cf_bm"
' ajs_user_id_cookie.Value = Main.CR_ajs_user_id
' ajs_user_id_cookie.HttpOnly = True
' ajs_user_id_cookie.Domain = ".crunchyroll.com"
' Debug.WriteLine("Set ajs_user_id_cookie: " + CM.SetCookieAsync("http://www.crunchyroll.com", ajs_user_id_cookie).Result.ToString)
'End If

View File

@ -148,6 +148,7 @@ Public Class Main
Public DefaultSubFunimation As String = "Disabled"
Public DefaultSubCR As String = "Disabled"
Public DubMode As Boolean = True
Public CR_Chapters As Boolean = False
#Region "Sprachen Vairablen"
Public URL_Invaild As String = "something is wrong here..."
Dim DL_Path_String As String = "Please choose download directory."
@ -391,6 +392,7 @@ Public Class Main
settings.CefCommandLineArgs.Add("disable-gpu-vsync")
settings.CefCommandLineArgs.Add("disable-d3d11")
settings.CefCommandLineArgs.Add("disable-gpu-rasterization")
settings.UserAgent = My.Resources.ffmpeg_user_agend.Replace("User-Agent: ", "").Replace(Chr(34), "")
settings.DisableGpuAcceleration()
'settings.CefCommandLineArgs("autoplay-policy") = "no-user-gesture-required"
settings.LogFile = Path.Combine(Application.StartupPath, "lib", "browser.log")
@ -511,6 +513,12 @@ Public Class Main
Catch ex As Exception
End Try
Try
Dim rkg As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\CRDownloader")
CR_Chapters = CBool(Integer.Parse(rkg.GetValue("CR_Chapters").ToString))
Catch ex As Exception
End Try
Try
Dim rkg As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\CRDownloader")
KeepCache = CBool(Integer.Parse(rkg.GetValue("Keep_Cache").ToString))
@ -1286,7 +1294,7 @@ Public Class Main
End If
If CBool(InStr(SeasonJson, "curl:")) = True Then
MsgBox("Error- Getting data")
MsgBox("Error - Getting SeasonJson data")
Exit Sub
End If
SeasonJson = CleanJSON(SeasonJson)
@ -1371,7 +1379,7 @@ Public Class Main
End If
If CBool(InStr(ObjectJson, "curl:")) = True Then
MsgBox("Error- Getting data")
MsgBox("Error - Getting ObjectJson data")
Exit Sub
End If
@ -1571,94 +1579,97 @@ Public Class Main
#End Region
#Region "Chapters"
'MsgBox(ObjectsURLBuilder4(0))
Dim ChaptersUrl As String = "https://static.crunchyroll.com/datalab-intro-v2/" + ObjectsURLBuilder4(0) + ".json"
Dim ChaptersJson 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), ""))
' ChaptersJson = client.DownloadString(ChaptersUrl)
' End Using
'Catch ex As Exception
' Debug.WriteLine("no Chapter data... ignoring")
'End Try
ChaptersJson = Curl(ChaptersUrl)
If CBool(InStr(ChaptersJson, "curl:")) = True Then
ChaptersJson = Curl(ChaptersUrl)
End If
If CBool(InStr(ChaptersJson, "curl:")) = True Then
ChaptersJson = Nothing
Debug.WriteLine("no Chapter data... ignoring")
End If
'Debug.WriteLine("ChaptersJson: " + ChaptersJson)
'Debug.WriteLine("ChaptersUrl: " + ChaptersUrl)
'MsgBox(ChaptersJson)
Dim Mdata_File As String = Application.StartupPath + "\" + ObjectsURLBuilder4(0) + "-mdata.txt"
If ChaptersJson IsNot Nothing Then
Dim StartTime As String() = ChaptersJson.Split(New String() {Chr(34) + "startTime" + Chr(34) + ": "}, System.StringSplitOptions.RemoveEmptyEntries)
Dim StartTime2 As String() = StartTime(1).Split(New String() {","}, System.StringSplitOptions.RemoveEmptyEntries)
Dim StartTime3 As String() = StartTime2(0).Split(New String() {"."}, System.StringSplitOptions.RemoveEmptyEntries)
Dim StartTime4 As String = StartTime3(1)
For i As Integer = StartTime4.Length To 2
StartTime4 = StartTime4 + "0"
Next
Dim StartTime_ms As String = StartTime3(0) + StartTime4
If CR_Chapters = True Then
Dim EndTime As String() = ChaptersJson.Split(New String() {Chr(34) + "endTime" + Chr(34) + ": "}, System.StringSplitOptions.RemoveEmptyEntries)
Dim EndTime2 As String() = EndTime(1).Split(New String() {","}, System.StringSplitOptions.RemoveEmptyEntries)
Dim EndTime3 As String() = EndTime2(0).Split(New String() {"."}, System.StringSplitOptions.RemoveEmptyEntries)
Dim ChaptersUrl As String = "https://static.crunchyroll.com/datalab-intro-v2/" + ObjectsURLBuilder4(0) + ".json"
Dim ChaptersJson 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), ""))
' ChaptersJson = client.DownloadString(ChaptersUrl)
' End Using
'Catch ex As Exception
' Debug.WriteLine("no Chapter data... ignoring")
'End Try
ChaptersJson = Curl(ChaptersUrl)
If CBool(InStr(ChaptersJson, "curl:")) = True Then
ChaptersJson = Curl(ChaptersUrl)
End If
If CBool(InStr(ChaptersJson, "curl:")) = True Then
ChaptersJson = Nothing
Debug.WriteLine("no Chapter data... ignoring")
End If
'Debug.WriteLine("ChaptersJson: " + ChaptersJson)
'Debug.WriteLine("ChaptersUrl: " + ChaptersUrl)
'MsgBox(ChaptersJson)
If ChaptersJson IsNot Nothing Then
Dim StartTime As String() = ChaptersJson.Split(New String() {Chr(34) + "startTime" + Chr(34) + ": "}, System.StringSplitOptions.RemoveEmptyEntries)
Dim StartTime2 As String() = StartTime(1).Split(New String() {","}, System.StringSplitOptions.RemoveEmptyEntries)
Dim StartTime3 As String() = StartTime2(0).Split(New String() {"."}, System.StringSplitOptions.RemoveEmptyEntries)
Dim StartTime4 As String = StartTime3(1)
For i As Integer = StartTime4.Length To 2
StartTime4 = StartTime4 + "0"
Next
Dim StartTime_ms As String = StartTime3(0) + StartTime4
Dim EndTime As String() = ChaptersJson.Split(New String() {Chr(34) + "endTime" + Chr(34) + ": "}, System.StringSplitOptions.RemoveEmptyEntries)
Dim EndTime2 As String() = EndTime(1).Split(New String() {","}, System.StringSplitOptions.RemoveEmptyEntries)
Dim EndTime3 As String() = EndTime2(0).Split(New String() {"."}, System.StringSplitOptions.RemoveEmptyEntries)
Dim EndTime4 As String = EndTime3(1)
Dim AfterTime As String = Nothing
For i As Integer = EndTime4.Length To 2
If EndTime4.Length = 2 Then
AfterTime = EndTime4 + "1"
End If
EndTime4 = EndTime4 + "0"
Next
Dim EndTime_ms As String = EndTime3(0) + EndTime4
Dim AfterTime_ms As String = EndTime3(0) + AfterTime
Dim Metadata As String = Nothing
If CInt(CR_episode_duration_ms) < CInt(StartTime_ms) Then
'Totaly invalid...
ElseIf CInt(CR_episode_duration_ms) < CInt(EndTime_ms) Then
'it's not an Intro it's an outro
Dim DeCh As Integer = CInt(StartTime_ms) - 1
Metadata = My.Resources.ffmpeg_metadata_out.Replace("[Titel]", CR_FilenName).Replace("[Start-1]", DeCh.ToString).Replace("[Start]", StartTime_ms).Replace("[duration_ms]", CR_episode_duration_ms)
Else
Metadata = My.Resources.ffmpeg_metadata.Replace("[Titel]", CR_FilenName).Replace("[Start]", StartTime_ms).Replace("[END]", EndTime_ms).Replace("[after]", AfterTime_ms).Replace("[duration_ms]", CR_episode_duration_ms)
Dim EndTime4 As String = EndTime3(1)
Dim AfterTime As String = Nothing
For i As Integer = EndTime4.Length To 2
If EndTime4.Length = 2 Then
AfterTime = EndTime4 + "1"
End If
EndTime4 = EndTime4 + "0"
Next
Dim EndTime_ms As String = EndTime3(0) + EndTime4
Dim AfterTime_ms As String = EndTime3(0) + AfterTime
Dim Metadata As String = Nothing
If CInt(CR_episode_duration_ms) < CInt(StartTime_ms) Then
'Totaly invalid...
ElseIf CInt(CR_episode_duration_ms) < CInt(EndTime_ms) Then
'it's not an Intro it's an outro
Dim DeCh As Integer = CInt(StartTime_ms) - 1
Metadata = My.Resources.ffmpeg_metadata_out.Replace("[Titel]", CR_FilenName).Replace("[Start-1]", DeCh.ToString).Replace("[Start]", StartTime_ms).Replace("[duration_ms]", CR_episode_duration_ms)
Else
Metadata = My.Resources.ffmpeg_metadata.Replace("[Titel]", CR_FilenName).Replace("[Start]", StartTime_ms).Replace("[END]", EndTime_ms).Replace("[after]", AfterTime_ms).Replace("[duration_ms]", CR_episode_duration_ms)
If Metadata = Nothing Then
Else
Dim utf8WithoutBom2 As New System.Text.UTF8Encoding(False)
Using sink As New StreamWriter(Mdata_File, False, utf8WithoutBom2)
sink.WriteLine(Metadata)
CR_MetadataUsage = True
End Using
End If
End If
If Metadata = Nothing Then
Else
Dim utf8WithoutBom2 As New System.Text.UTF8Encoding(False)
Using sink As New StreamWriter(Mdata_File, False, utf8WithoutBom2)
sink.WriteLine(Metadata)
CR_MetadataUsage = True
End Using
End If
End If
#End Region
#Region "VideoJson"
Dim VideoJson As String = Nothing
@ -1670,8 +1681,9 @@ Public Class Main
End If
If CBool(InStr(VideoJson, "curl:")) = True Then
ChaptersJson = Nothing
Debug.WriteLine("no Chapter data... ignoring")
VideoJson = Nothing
MsgBox("Error - Getting VideoJson data")
Exit Sub
End If

View File

@ -151,6 +151,8 @@ Partial Class Einstellungen
Me.Label5 = New MetroFramework.Controls.MetroLabel()
Me.BackgroundWorker1 = New System.ComponentModel.BackgroundWorker()
Me.Btn_Save = New System.Windows.Forms.Button()
Me.GroupBox20 = New System.Windows.Forms.GroupBox()
Me.ChB_Chapters = New MetroFramework.Controls.MetroCheckBox()
CType(Me.pictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.GroupBox14.SuspendLayout()
Me.SoftSubs.SuspendLayout()
@ -188,6 +190,7 @@ Partial Class Einstellungen
Me.GroupBox8.SuspendLayout()
Me.TabPage7.SuspendLayout()
CType(Me.PictureBox7, System.ComponentModel.ISupportInitialize).BeginInit()
Me.GroupBox20.SuspendLayout()
Me.SuspendLayout()
'
'ToolTip1
@ -1106,7 +1109,7 @@ Partial Class Einstellungen
Me.TabControl1.FontWeight = MetroFramework.MetroTabControlWeight.Regular
Me.TabControl1.Location = New System.Drawing.Point(22, 60)
Me.TabControl1.Name = "TabControl1"
Me.TabControl1.SelectedIndex = 1
Me.TabControl1.SelectedIndex = 3
Me.TabControl1.Size = New System.Drawing.Size(509, 567)
Me.TabControl1.TabIndex = 0
Me.TabControl1.UseSelectable = True
@ -1120,9 +1123,9 @@ Partial Class Einstellungen
Me.MetroTabPage2.HorizontalScrollbarBarColor = True
Me.MetroTabPage2.HorizontalScrollbarHighlightOnWheel = False
Me.MetroTabPage2.HorizontalScrollbarSize = 10
Me.MetroTabPage2.Location = New System.Drawing.Point(4, 35)
Me.MetroTabPage2.Location = New System.Drawing.Point(4, 44)
Me.MetroTabPage2.Name = "MetroTabPage2"
Me.MetroTabPage2.Size = New System.Drawing.Size(501, 528)
Me.MetroTabPage2.Size = New System.Drawing.Size(501, 519)
Me.MetroTabPage2.TabIndex = 8
Me.MetroTabPage2.Text = "Naming"
Me.MetroTabPage2.VerticalScrollbarBarColor = True
@ -1311,6 +1314,7 @@ Partial Class Einstellungen
'
'MetroTabPage1
'
Me.MetroTabPage1.Controls.Add(Me.GroupBox20)
Me.MetroTabPage1.Controls.Add(Me.GroupBox19)
Me.MetroTabPage1.Controls.Add(Me.GroupBox14)
Me.MetroTabPage1.Controls.Add(Me.GB_SubLanguage)
@ -1318,9 +1322,9 @@ Partial Class Einstellungen
Me.MetroTabPage1.HorizontalScrollbarBarColor = True
Me.MetroTabPage1.HorizontalScrollbarHighlightOnWheel = False
Me.MetroTabPage1.HorizontalScrollbarSize = 10
Me.MetroTabPage1.Location = New System.Drawing.Point(4, 35)
Me.MetroTabPage1.Location = New System.Drawing.Point(4, 44)
Me.MetroTabPage1.Name = "MetroTabPage1"
Me.MetroTabPage1.Size = New System.Drawing.Size(501, 528)
Me.MetroTabPage1.Size = New System.Drawing.Size(501, 519)
Me.MetroTabPage1.TabIndex = 7
Me.MetroTabPage1.Text = "Crunchyroll"
Me.MetroTabPage1.VerticalScrollbarBarColor = True
@ -1732,6 +1736,30 @@ Partial Class Einstellungen
Me.Btn_Save.TabIndex = 9
Me.Btn_Save.UseVisualStyleBackColor = False
'
'GroupBox20
'
Me.GroupBox20.BackColor = System.Drawing.Color.Transparent
Me.GroupBox20.Controls.Add(Me.ChB_Chapters)
Me.GroupBox20.Font = New System.Drawing.Font("Arial", 9.75!)
Me.GroupBox20.ForeColor = System.Drawing.Color.Black
Me.GroupBox20.Location = New System.Drawing.Point(3, 385)
Me.GroupBox20.Name = "GroupBox20"
Me.GroupBox20.Size = New System.Drawing.Size(490, 62)
Me.GroupBox20.TabIndex = 34
Me.GroupBox20.TabStop = False
Me.GroupBox20.Text = "Chapters"
'
'ChB_Chapters
'
Me.ChB_Chapters.AutoSize = True
Me.ChB_Chapters.FontSize = MetroFramework.MetroCheckBoxSize.Medium
Me.ChB_Chapters.Location = New System.Drawing.Point(158, 23)
Me.ChB_Chapters.Name = "ChB_Chapters"
Me.ChB_Chapters.Size = New System.Drawing.Size(145, 19)
Me.ChB_Chapters.TabIndex = 5
Me.ChB_Chapters.Text = "enable CR Chapters"
Me.ChB_Chapters.UseSelectable = True
'
'Einstellungen
'
Me.ApplyImageInvert = True
@ -1798,6 +1826,8 @@ Partial Class Einstellungen
Me.GroupBox8.PerformLayout()
Me.TabPage7.ResumeLayout(False)
CType(Me.PictureBox7, System.ComponentModel.ISupportInitialize).EndInit()
Me.GroupBox20.ResumeLayout(False)
Me.GroupBox20.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
@ -1931,4 +1961,6 @@ Partial Class Einstellungen
Friend WithEvents GroupBox19 As GroupBox
Friend WithEvents DubMode As MetroFramework.Controls.MetroCheckBox
Friend WithEvents CB_Merge As MetroFramework.Controls.MetroComboBox
Friend WithEvents GroupBox20 As GroupBox
Friend WithEvents ChB_Chapters As MetroFramework.Controls.MetroCheckBox
End Class

View File

@ -61,6 +61,10 @@ Public Class Einstellungen
DubMode.Checked = True
End If
If Main.CR_Chapters = True Then
ChB_Chapters.Checked = True
End If
If Main.DarkModeValue = True Then
DarkMode.Checked = True
GroupBoxColor(Color.FromArgb(150, 150, 150))
@ -392,6 +396,14 @@ Public Class Einstellungen
rk.SetValue("DubMode", 0, RegistryValueKind.String)
End If
If ChB_Chapters.Checked = True Then
Main.CR_Chapters = True
rk.SetValue("CR_Chapters", 1, RegistryValueKind.String)
Else
Main.CR_Chapters = False
rk.SetValue("CR_Chapters", 0, RegistryValueKind.String)
End If
If KodiSupport.Checked = True Then
Main.KodiNaming = True
rk.SetValue("KodiSupport", 1, RegistryValueKind.String)