Funimation dub setting improvements

Funimation dub setting now overrides existing tags in the url
firefox addon post method changed
This commit is contained in:
hama3254 2021-01-16 14:08:33 +01:00
parent 7e3cd83a55
commit 8e907e05d0
18 changed files with 301 additions and 142 deletions

Binary file not shown.

View File

@ -19,17 +19,17 @@ browser.tabs.query({
code: 'document.getElementsByClassName("trackVideo")[0].href' code: 'document.getElementsByClassName("trackVideo")[0].href'
}); });
funimation.then(FunimationSuccess, FunimationError); funimation.then(FunimationSuccess, FunimationError);
} else if (tab.url.includes('anime-on-demand.de/anime/')) { } else if (tab.url.includes('anime-on-demand.de/anime/')) {
document.getElementById("btn_add").hidden = true; document.getElementById("btn_add").hidden = true;
document.getElementById("btn_enable_select").hidden = true; document.getElementById("btn_enable_select").hidden = true;
document.getElementById("btn_add_mass").hidden = true; document.getElementById("btn_add_mass").hidden = true;
document.getElementById("btn_select_all").hidden = true; document.getElementById("btn_select_all").hidden = true;
document.getElementById("btn_select_none").hidden = true; document.getElementById("btn_select_none").hidden = true;
document.getElementById("btn_enable_funimation_select").hidden = true; document.getElementById("btn_enable_funimation_select").hidden = true;
document.getElementById("btn_add_funimation").hidden = true; document.getElementById("btn_add_funimation").hidden = true;
document.getElementById("btn_add_AoD").hidden = false; document.getElementById("btn_add_AoD").hidden = true; //false if implemented
} else { } else {
document.getElementById("btn_add").hidden = true; document.getElementById("btn_add").hidden = true;
@ -39,26 +39,26 @@ browser.tabs.query({
document.getElementById("btn_select_none").hidden = true; document.getElementById("btn_select_none").hidden = true;
document.getElementById("btn_enable_funimation_select").hidden = true; document.getElementById("btn_enable_funimation_select").hidden = true;
document.getElementById("btn_add_funimation").hidden = true; document.getElementById("btn_add_funimation").hidden = true;
document.getElementById("btn_add_AoD").hidden = true; document.getElementById("btn_add_AoD").hidden = true;
} }
}, console.error) }, console.error)
document.getElementById('btn_add_AoD').addEventListener('click', () => { document.getElementById('btn_add_AoD').addEventListener('click', () => {
//browser.cookies.getAllCookieStores().then((cookie) => { //browser.cookies.getAllCookieStores().then((cookie) => {
// browser.cookies.getAll({ // browser.cookies.getAll({
// name: "_aod_session" // name: "_aod_session"
// }).then((cookie) => { // }).then((cookie) => {
//console.log(cookie) //console.log(cookie)
//}, console.error) //}, console.error)
var cookies = {}; var cookies = {};
cookies.all = url => new Promise(resolve => chrome.cookies.getAll({ cookies.all = url => new Promise(resolve => chrome.cookies.getAll({
url url
}, resolve)); }, resolve));
console.log(cookies) console.log(cookies)
}); });
document.getElementById('btn_enable_select').addEventListener('click', () => { document.getElementById('btn_enable_select').addEventListener('click', () => {
@ -73,7 +73,7 @@ document.getElementById('btn_enable_select').addEventListener('click', () => {
document.getElementById("btn_add").hidden = true; document.getElementById("btn_add").hidden = true;
document.getElementById("btn_enable_funimation_select").hidden = true; document.getElementById("btn_enable_funimation_select").hidden = true;
document.getElementById("btn_add_funimation").hidden = true; document.getElementById("btn_add_funimation").hidden = true;
document.getElementById("btn_add_AoD").hidden = true; document.getElementById("btn_add_AoD").hidden = true;
}); });
document.getElementById('btn_select_all').addEventListener('click', () => { document.getElementById('btn_select_all').addEventListener('click', () => {
@ -160,7 +160,7 @@ function onExecuted(result) {
document.getElementById("btn_enable_select").hidden = true; document.getElementById("btn_enable_select").hidden = true;
document.getElementById("btn_add_funimation").hidden = true; document.getElementById("btn_add_funimation").hidden = true;
document.getElementById("btn_enable_funimation_select").hidden = true; document.getElementById("btn_enable_funimation_select").hidden = true;
document.getElementById("btn_add_AoD").hidden = true; document.getElementById("btn_add_AoD").hidden = true;
console.log(true); console.log(true);
} else { } else {
document.getElementById("btn_add").hidden = true; document.getElementById("btn_add").hidden = true;
@ -170,7 +170,7 @@ function onExecuted(result) {
document.getElementById("btn_select_none").hidden = true; document.getElementById("btn_select_none").hidden = true;
document.getElementById("btn_add_funimation").hidden = true; document.getElementById("btn_add_funimation").hidden = true;
document.getElementById("btn_enable_funimation_select").hidden = true; document.getElementById("btn_enable_funimation_select").hidden = true;
document.getElementById("btn_add_AoD").hidden = true; document.getElementById("btn_add_AoD").hidden = true;
console.log(false); console.log(false);
} }
@ -186,7 +186,7 @@ function onError(error) {
document.getElementById("btn_enable_select").hidden = true; document.getElementById("btn_enable_select").hidden = true;
document.getElementById("btn_add_funimation").hidden = true; document.getElementById("btn_add_funimation").hidden = true;
document.getElementById("btn_enable_funimation_select").hidden = true; document.getElementById("btn_enable_funimation_select").hidden = true;
document.getElementById("btn_add_AoD").hidden = true; document.getElementById("btn_add_AoD").hidden = true;
} }
function add_fun_ok(result) { function add_fun_ok(result) {
@ -197,41 +197,40 @@ function add_fun_ok(result) {
let tab = tabs[0]; // Safe to assume there will only be one resultconsole.log(tab.url); let tab = tabs[0]; // Safe to assume there will only be one resultconsole.log(tab.url);
console.log(tab.url); console.log(tab.url);
const form = document.createElement('form'); document.getElementById("btn_add_funimation").disabled = true;
form.method = 'post'; document.getElementById("btn_add_funimation").style.background = "#c9c9c9"
form.action = "http://127.0.0.1/post";
//const hiddenField = document.createElement('input'); var xhttp = new XMLHttpRequest();
//hiddenField.type = 'hidden'; xhttp.open("POST", "http://127.0.0.1/post", true);
//hiddenField.name = "FunimationHTML"; xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
//hiddenField.value = result; xhttp.send("FunimationURL=" + tab.url);
//form.appendChild(hiddenField);
const hiddenField2 = document.createElement('input'); setTimeout(function () {
hiddenField2.type = 'hidden'; document.getElementById("btn_add_funimation").style.background = "#ff8000"
hiddenField2.name = "FunimationURL"; }, 10000);
hiddenField2.value = tab.url; setTimeout(function () {
form.appendChild(hiddenField2); document.getElementById("btn_add_funimation").disabled = false;
}, 10000);
document.body.appendChild(form);
form.submit();
}, console.error) }, console.error)
} }
function add_one_ok(result) { function add_one_ok(result) {
const form = document.createElement('form'); document.getElementById("btn_add").disabled = true;
form.method = 'post'; document.getElementById("btn_add").style.background = "#c9c9c9"
form.action = "http://127.0.0.1/post";
const hiddenField = document.createElement('input'); var xhttp = new XMLHttpRequest();
hiddenField.type = 'hidden'; xhttp.open("POST", "http://127.0.0.1/post", true);
hiddenField.name = "HTMLSingle"; xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
hiddenField.value = result; xhttp.send("HTMLSingle=" + result);
form.appendChild(hiddenField);
document.body.appendChild(form); setTimeout(function () {
form.submit(); document.getElementById("btn_add").style.background = "#ff8000"
}, 10000);
setTimeout(function () {
document.getElementById("btn_add").disabled = false;
}, 10000);
} }
@ -240,18 +239,20 @@ function add_one_error(error) {
} }
function add_mass_ok(result) { function add_mass_ok(result) {
const form = document.createElement('form'); document.getElementById("btn_add_mass").disabled = true;
form.method = 'post'; document.getElementById("btn_add_mass").style.background = "#c9c9c9"
form.action = "http://127.0.0.1/post";
const hiddenField = document.createElement('input'); var xhttp = new XMLHttpRequest();
hiddenField.type = 'hidden'; xhttp.open("POST", "http://127.0.0.1/post", true);
hiddenField.name = "HTMLMass"; xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
hiddenField.value = result; xhttp.send("HTMLMass=" + result);
form.appendChild(hiddenField);
document.body.appendChild(form); setTimeout(function () {
form.submit(); document.getElementById("btn_add_mass").style.background = "#ff8000"
}, 10000);
setTimeout(function () {
document.getElementById("btn_add_mass").disabled = false;
}, 10000);
} }
@ -272,7 +273,7 @@ document.getElementById('btn_enable_funimation_select').addEventListener('click'
document.getElementById("btn_enable_select").hidden = true; document.getElementById("btn_enable_select").hidden = true;
document.getElementById("btn_add").hidden = true; document.getElementById("btn_add").hidden = true;
document.getElementById("btn_add_funimation").hidden = true; document.getElementById("btn_add_funimation").hidden = true;
document.getElementById("btn_add_AoD").hidden = true; document.getElementById("btn_add_AoD").hidden = true;
}); });
@ -285,11 +286,11 @@ function FunimationSuccess(result) {
document.getElementById("btn_select_all").hidden = false; document.getElementById("btn_select_all").hidden = false;
document.getElementById("btn_select_none").hidden = false; document.getElementById("btn_select_none").hidden = false;
document.getElementById("btn_enable_select").hidden = true; document.getElementById("btn_enable_select").hidden = true;
document.getElementById("btn_add_AoD").hidden = true; document.getElementById("btn_add_AoD").hidden = true;
document.getElementById("btn_enable_funimation_select").hidden = true; document.getElementById("btn_enable_funimation_select").hidden = true;
document.getElementById("btn_add_funimation").hidden = true; document.getElementById("btn_add_funimation").hidden = true;
document.getElementById("btn_add_AoD").hidden = true; document.getElementById("btn_add_AoD").hidden = true;
console.log(true); console.log(true);
} else { } else {
document.getElementById("btn_add").hidden = true; document.getElementById("btn_add").hidden = true;
@ -299,7 +300,7 @@ function FunimationSuccess(result) {
document.getElementById("btn_select_all").hidden = true; document.getElementById("btn_select_all").hidden = true;
document.getElementById("btn_select_none").hidden = true; document.getElementById("btn_select_none").hidden = true;
document.getElementById("btn_enable_funimation_select").hidden = false; document.getElementById("btn_enable_funimation_select").hidden = false;
document.getElementById("btn_add_AoD").hidden = true; document.getElementById("btn_add_AoD").hidden = true;
console.log(false); console.log(false);
} }
@ -315,6 +316,6 @@ function FunimationError(error) {
document.getElementById("btn_enable_select").hidden = true; document.getElementById("btn_enable_select").hidden = true;
document.getElementById("btn_add_funimation").hidden = false; document.getElementById("btn_add_funimation").hidden = false;
document.getElementById("btn_enable_funimation_select").hidden = true; document.getElementById("btn_enable_funimation_select").hidden = true;
document.getElementById("btn_add_AoD").hidden = true; document.getElementById("btn_add_AoD").hidden = true;
} }

View File

@ -211,9 +211,9 @@ Partial Class Anime_Add
Me.pictureBox4.BackColor = System.Drawing.Color.Transparent Me.pictureBox4.BackColor = System.Drawing.Color.Transparent
Me.pictureBox4.Cursor = System.Windows.Forms.Cursors.Hand Me.pictureBox4.Cursor = System.Windows.Forms.Cursors.Hand
Me.pictureBox4.Image = Global.Crunchyroll_Downloader.My.Resources.Resources.main_button_download_default Me.pictureBox4.Image = Global.Crunchyroll_Downloader.My.Resources.Resources.main_button_download_default
Me.pictureBox4.Location = New System.Drawing.Point(42, 231) Me.pictureBox4.Location = New System.Drawing.Point(46, 231)
Me.pictureBox4.Name = "pictureBox4" Me.pictureBox4.Name = "pictureBox4"
Me.pictureBox4.Size = New System.Drawing.Size(537, 50) Me.pictureBox4.Size = New System.Drawing.Size(538, 50)
Me.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage Me.pictureBox4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
Me.pictureBox4.TabIndex = 42 Me.pictureBox4.TabIndex = 42
Me.pictureBox4.TabStop = False Me.pictureBox4.TabStop = False
@ -362,9 +362,9 @@ Partial Class Anime_Add
Me.Controls.Add(Me.Btn_min) Me.Controls.Add(Me.Btn_min)
Me.Controls.Add(Me.Btn_Close) Me.Controls.Add(Me.Btn_Close)
Me.Controls.Add(Me.pictureBox4) Me.Controls.Add(Me.pictureBox4)
Me.Controls.Add(Me.groupBox1)
Me.Controls.Add(Me.GroupBox3) Me.Controls.Add(Me.GroupBox3)
Me.Controls.Add(Me.groupBox2) Me.Controls.Add(Me.groupBox2)
Me.Controls.Add(Me.groupBox1)
Me.Name = "Anime_Add" Me.Name = "Anime_Add"
Me.Padding = New System.Windows.Forms.Padding(10, 60, 20, 20) Me.Padding = New System.Windows.Forms.Padding(10, 60, 20, 20)
Me.Text = "Add Video" Me.Text = "Add Video"

View File

@ -48,6 +48,11 @@ Public Class Anime_Add
Me.StyleManager = Manager Me.StyleManager = Manager
Btn_Close.Image = Main.CloseImg Btn_Close.Image = Main.CloseImg
Btn_min.Image = Main.MinImg Btn_min.Image = Main.MinImg
ListBox1.BackColor = Main.BackColorValue
ListBox1.ForeColor = Main.ForeColorValue
Try Try
Me.Icon = My.Resources.icon Me.Icon = My.Resources.icon
Catch ex As Exception Catch ex As Exception
@ -158,16 +163,49 @@ Public Class Anime_Add
Try Try
If CBool(InStr(textBox1.Text, "crunchyroll.com")) Or CBool(InStr(textBox1.Text, "funimation.com")) Then 'Or CBool(InStr(textBox1.Text, "anime-on-demand.de")) Then If CBool(InStr(textBox1.Text, "crunchyroll.com")) Or CBool(InStr(textBox1.Text, "funimation.com")) Then 'Or CBool(InStr(textBox1.Text, "anime-on-demand.de")) Then
If InStr(textBox1.Text, "funimation.com") Then If InStr(textBox1.Text, "funimation.com") Then
If InStr(textBox1.Text, "lang=") Then If Main.DubFunimation = "Disabled" Then
Else Else
If InStr(textBox1.Text, "?") Then If InStr(textBox1.Text, "?lang=") Then
Dim ClearUri As String() = textBox1.Text.Split(New String() {"?lang="}, System.StringSplitOptions.RemoveEmptyEntries)
If ClearUri.Count > 1 Then
If InStr(ClearUri(1), "&") Then
Dim ClearUri2 As String() = ClearUri(1).Split(New String() {"&"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim Parms As String = Nothing
For i As Integer = 0 To ClearUri2.Count - 1
Parms = Parms + "&" + ClearUri2(i)
Next
textBox1.Text = ClearUri(0) + "?lang=" + Main.DubFunimation + Parms
Else
textBox1.Text = ClearUri(0) + "?lang=" + Main.DubFunimation
End If
Else
textBox1.Text = ClearUri(0) + "?lang=" + Main.DubFunimation
End If
ElseIf InStr(textBox1.Text, "&lang=") Then
Dim ClearUri As String() = textBox1.Text.Split(New String() {"&lang="}, System.StringSplitOptions.RemoveEmptyEntries)
If ClearUri.Count > 1 Then
If InStr(ClearUri(1), "&") Then
Dim ClearUri2 As String() = ClearUri(1).Split(New String() {"&"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim Parms As String = Nothing
For i As Integer = 1 To ClearUri2.Count - 1
Parms = Parms + "&" + ClearUri2(i)
Next
textBox1.Text = ClearUri(0) + "&lang=" + Main.DubFunimation + Parms
Else
textBox1.Text = ClearUri(0) + "&lang=" + Main.DubFunimation
End If
Else
textBox1.Text = ClearUri(0) + "&lang=" + Main.DubFunimation
End If
ElseIf InStr(textBox1.Text, "?") Then
textBox1.AppendText("&lang=" + Main.DubFunimation) textBox1.AppendText("&lang=" + Main.DubFunimation)
Else Else
textBox1.AppendText("?lang=" + Main.DubFunimation) textBox1.AppendText("?lang=" + Main.DubFunimation)
End If End If
End If End If
End If End If
If StatusLabel.Text = "Status: waiting for episode selection" Then If StatusLabel.Text = "Status: waiting for episode selection" Then
@ -604,8 +642,53 @@ Public Class Anime_Add
If GroupBox3.Visible = True Then If GroupBox3.Visible = True Then
If InStr(ListBox1.GetItemText(ListBox1.Items(0)), "funimation.com") Then If InStr(ListBox1.GetItemText(ListBox1.Items(0)), "funimation.com") Then
If Main.Funimation_Grapp_RDY = True Then If Main.Funimation_Grapp_RDY = True Then
Dim UriUsed As String = ListBox1.GetItemText(ListBox1.Items(0))
If Main.DubFunimation = "Disabled" Then
Else
If InStr(UriUsed, "?lang=") Then
Dim ClearUri As String() = UriUsed.Split(New String() {"?lang="}, System.StringSplitOptions.RemoveEmptyEntries)
If ClearUri.Count > 1 Then
If InStr(ClearUri(1), "&") Then
Dim ClearUri2 As String() = ClearUri(1).Split(New String() {"&"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim Parms As String = Nothing
For i As Integer = 0 To ClearUri2.Count - 1
Parms = Parms + "&" + ClearUri2(i)
Next
UriUsed = ClearUri(0) + "?lang=" + Main.DubFunimation + Parms
Else
UriUsed = ClearUri(0) + "?lang=" + Main.DubFunimation
End If
Else
UriUsed = ClearUri(0) + "?lang=" + Main.DubFunimation
End If
ElseIf InStr(UriUsed, "&lang=") Then
Dim ClearUri As String() = UriUsed.Split(New String() {"&lang="}, System.StringSplitOptions.RemoveEmptyEntries)
If ClearUri.Count > 1 Then
If InStr(ClearUri(1), "&") Then
Dim ClearUri2 As String() = ClearUri(1).Split(New String() {"&"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim Parms As String = Nothing
For i As Integer = 1 To ClearUri2.Count - 1
Parms = Parms + "&" + ClearUri2(i)
Next
UriUsed = ClearUri(0) + "&lang=" + Main.DubFunimation + Parms
Else
UriUsed = ClearUri(0) + "&lang=" + Main.DubFunimation
End If
Else
UriUsed = ClearUri(0) + "&lang=" + Main.DubFunimation
End If
ElseIf InStr(UriUsed, "?") Then
UriUsed = UriUsed + "&lang=" + Main.DubFunimation
Else
UriUsed = UriUsed + "?lang=" + Main.DubFunimation
End If
End If
Main.Funimation_Grapp_RDY = False Main.Funimation_Grapp_RDY = False
GeckoFX.WebBrowser1.Navigate(ListBox1.GetItemText(ListBox1.Items(0))) GeckoFX.WebBrowser1.Navigate(UriUsed)
ListBox1.Items.Remove(ListBox1.Items(0)) ListBox1.Items.Remove(ListBox1.Items(0))
Main.b = False Main.b = False
StatusLabel.Text = "Status: loading ..." StatusLabel.Text = "Status: loading ..."

View File

@ -17,13 +17,13 @@ Public Class Main
Public DarkModeValue As Boolean = False Public DarkModeValue As Boolean = False
Public invalids As Char() = System.IO.Path.GetInvalidFileNameChars() Public invalids As Char() = System.IO.Path.GetInvalidFileNameChars()
Dim ServerThread As Thread
Public ErrorTolerance As Integer = 0 Public ErrorTolerance As Integer = 0
Public liList As New List(Of String) Public liList As New List(Of String)
Public HTMLString As String = My.Resources.Startuphtml Public HTMLString As String = My.Resources.Startuphtml
Public RunServer As Boolean = True 'Public RunServer As Boolean = True
Public ListBoxList As New List(Of String) Public ListBoxList As New List(Of String)
Dim ItemList As New List(Of CRD_List_Item) Dim ItemList As New List(Of CRD_List_Item)
Public RunningDownloads As Integer = 0 Public RunningDownloads As Integer = 0
@ -142,15 +142,20 @@ Public Class Main
Public CloseImg As Bitmap = My.Resources.main_del Public CloseImg As Bitmap = My.Resources.main_del
Public MinImg As Bitmap = My.Resources.main_mini Public MinImg As Bitmap = My.Resources.main_mini
Public BackColorValue As Color = Color.FromArgb(243, 243, 243)
Public ForeColorValue As Color = SystemColors.WindowText
Public Sub DarkMode() Public Sub DarkMode()
ListView1.BackColor = Color.FromArgb(50, 50, 50) ListView1.BackColor = Color.FromArgb(50, 50, 50)
CloseImg = My.Resources.main_close_dark CloseImg = My.Resources.main_close_dark
MinImg = My.Resources.main_mini_dark MinImg = My.Resources.main_mini_dark
Btn_min.Image = MinImg Btn_min.Image = MinImg
Btn_Close.Image = CloseImg Btn_Close.Image = CloseImg
BackColorValue = Color.FromArgb(50, 50, 50)
ForeColorValue = Color.FromArgb(243, 243, 243)
End Sub End Sub
Public Sub LightMode() Public Sub LightMode()
BackColorValue = Color.FromArgb(243, 243, 243)
ForeColorValue = SystemColors.WindowText
ListView1.BackColor = SystemColors.Control ListView1.BackColor = SystemColors.Control
CloseImg = My.Resources.main_close CloseImg = My.Resources.main_close
MinImg = My.Resources.main_mini MinImg = My.Resources.main_mini
@ -330,10 +335,10 @@ Public Class Main
End Try End Try
If StartServer = True Then If StartServer = True Then
Timer3.Enabled = True Timer3.Enabled = True
Dim t As New Thread(AddressOf ServerStart) ServerThread = New Thread(AddressOf ServerStart)
t.Priority = ThreadPriority.Normal ServerThread.Priority = ThreadPriority.Normal
t.IsBackground = True ServerThread.IsBackground = True
t.Start() ServerThread.Start()
End If End If
@ -1812,12 +1817,16 @@ Public Class Main
For i As Integer = 0 To ListView1.Items.Count - 1 For i As Integer = 0 To ListView1.Items.Count - 1
ItemList(i).KillRunningTask() ItemList(i).KillRunningTask()
Next Next
RunServer = False 'RunServer = False
tcpListener.Stop()
RemoveTempFiles() RemoveTempFiles()
Me.Close() Me.Close()
End If End If
Else Else
RunServer = False 'RunServer = False
tcpListener.Stop()
Timer3.Enabled = False
RemoveTempFiles() RemoveTempFiles()
Me.Close() Me.Close()
End If End If
@ -2801,6 +2810,9 @@ Public Class Main
Debug.WriteLine("Web server started at: " & serverIP.ToString() & ":" & Port) Debug.WriteLine("Web server started at: " & serverIP.ToString() & ":" & Port)
ProcessThread() ProcessThread()
Catch abort As ThreadAbortException
Exit Sub
Catch ex As Exception Catch ex As Exception
MsgBox(ex.ToString()) MsgBox(ex.ToString())
@ -2821,6 +2833,8 @@ Public Class Main
' Set Thread for each Web Browser Connection ' Set Thread for each Web Browser Connection
Dim clientThread As New Thread(Sub() Me.ProcessRequest(clientSocket)) Dim clientThread As New Thread(Sub() Me.ProcessRequest(clientSocket))
clientThread.Start() clientThread.Start()
Catch abort As ThreadAbortException
Exit Sub
Catch ex As Exception Catch ex As Exception
Debug.WriteLine(ex.ToString()) Debug.WriteLine(ex.ToString())
'If clientSocket.Connected Then 'If clientSocket.Connected Then
@ -2837,6 +2851,7 @@ Public Class Main
Try Try
' Receive HTTP Request from Web Browser ' Receive HTTP Request from Web Browser
bytes = clientSocket.Receive(recvBytes, 0, clientSocket.Available, SocketFlags.None) bytes = clientSocket.Receive(recvBytes, 0, clientSocket.Available, SocketFlags.None)
htmlReq = Encoding.UTF8.GetString(recvBytes, 0, bytes) htmlReq = Encoding.UTF8.GetString(recvBytes, 0, bytes)
'MsgBox(htmlReq) 'MsgBox(htmlReq)
'My.Computer.FileSystem.WriteAllText(Application.StartupPath + "\log.txt", htmlReq + vbNewLine, True) 'My.Computer.FileSystem.WriteAllText(Application.StartupPath + "\log.txt", htmlReq + vbNewLine, True)
@ -2859,7 +2874,6 @@ Public Class Main
Return Nothing Return Nothing
End Function)) End Function))
#Region "CR Einzeln" #Region "CR Einzeln"
If InStr(htmlReq, "HTMLSingle=") Then If InStr(htmlReq, "HTMLSingle=") Then
Debug.WriteLine("Single episode mode - Crunchyroll") Debug.WriteLine("Single episode mode - Crunchyroll")
@ -2904,7 +2918,7 @@ Public Class Main
End If End If
End If End If
strRequest = rootPath & "Post_Single_Sucess.html" 'PostPage strRequest = rootPath & "Post_Single_Sucess.html" 'PostPage
sendHTMLResponse(strRequest, clientSocket) SendHTMLResponse(strRequest, clientSocket)
Else Else
Me.Invoke(New Action(Function() Me.Invoke(New Action(Function()
Me.Text = "Status: no video found" Me.Text = "Status: no video found"
@ -2914,14 +2928,15 @@ Public Class Main
Dim ErrorPage As String = My.Resources.Post_error_Top + "no video found" + My.Resources.Post_error_Bottom Dim ErrorPage As String = My.Resources.Post_error_Top + "no video found" + My.Resources.Post_error_Bottom
My.Computer.FileSystem.WriteAllText(Application.StartupPath + "\WebInterface\error_Page.html", ErrorPage, False) My.Computer.FileSystem.WriteAllText(Application.StartupPath + "\WebInterface\error_Page.html", ErrorPage, False)
strRequest = rootPath & "error_Page.html" 'PostPage strRequest = rootPath & "error_Page.html" 'PostPage
sendHTMLResponse(strRequest, clientSocket) SendHTMLResponse(strRequest, clientSocket)
End If End If
Catch abort As ThreadAbortException
Exit Sub
Catch ex As Exception Catch ex As Exception
Dim ErrorPage As String = My.Resources.Post_error_Top + ex.ToString + My.Resources.Post_error_Bottom Dim ErrorPage As String = My.Resources.Post_error_Top + ex.ToString + My.Resources.Post_error_Bottom
My.Computer.FileSystem.WriteAllText(Application.StartupPath + "\WebInterface\error_Page.html", ErrorPage, False) My.Computer.FileSystem.WriteAllText(Application.StartupPath + "\WebInterface\error_Page.html", ErrorPage, False)
strRequest = rootPath & "error_Page.html" 'PostPage strRequest = rootPath & "error_Page.html" 'PostPage
sendHTMLResponse(strRequest, clientSocket) SendHTMLResponse(strRequest, clientSocket)
End Try End Try
#End Region #End Region
#Region "mass-dl" #Region "mass-dl"
@ -2960,12 +2975,14 @@ Public Class Main
End Function)) End Function))
End If End If
strRequest = rootPath & "Post_Mass_Sucess.html" 'PostPage strRequest = rootPath & "Post_Mass_Sucess.html" 'PostPage
sendHTMLResponse(strRequest, clientSocket) SendHTMLResponse(strRequest, clientSocket)
Catch abort As ThreadAbortException
Exit Sub
Catch ex As Exception Catch ex As Exception
Dim ErrorPage As String = My.Resources.Post_error_Top + ex.ToString + My.Resources.Post_error_Bottom Dim ErrorPage As String = My.Resources.Post_error_Top + ex.ToString + My.Resources.Post_error_Bottom
My.Computer.FileSystem.WriteAllText(Application.StartupPath + "\WebInterface\error_Page.html", ErrorPage, False) My.Computer.FileSystem.WriteAllText(Application.StartupPath + "\WebInterface\error_Page.html", ErrorPage, False)
strRequest = rootPath & "error_Page.html" 'PostPage strRequest = rootPath & "error_Page.html" 'PostPage
sendHTMLResponse(strRequest, clientSocket) SendHTMLResponse(strRequest, clientSocket)
End Try End Try
#End Region #End Region
#Region "funimation Einzeln" #Region "funimation Einzeln"
@ -2981,6 +2998,53 @@ Public Class Main
Dim URLSplit() As String = htmlReq.Split(New String() {"FunimationURL="}, System.StringSplitOptions.RemoveEmptyEntries) Dim URLSplit() As String = htmlReq.Split(New String() {"FunimationURL="}, System.StringSplitOptions.RemoveEmptyEntries)
WebbrowserURL = UrlDecode(URLSplit(1)) WebbrowserURL = UrlDecode(URLSplit(1))
If InStr(WebbrowserURL, "funimation.com") Then
If DubFunimation = "Disabled" Then
Else
If InStr(WebbrowserURL, "?lang=") Then
Dim ClearUri As String() = WebbrowserURL.Split(New String() {"?lang="}, System.StringSplitOptions.RemoveEmptyEntries)
If ClearUri.Count > 1 Then
If InStr(ClearUri(1), "&") Then
Dim ClearUri2 As String() = ClearUri(1).Split(New String() {"&"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim Parms As String = Nothing
For i As Integer = 0 To ClearUri2.Count - 1
Parms = Parms + "&" + ClearUri2(i)
Next
WebbrowserURL = ClearUri(0) + "?lang=" + DubFunimation + Parms
Else
WebbrowserURL = ClearUri(0) + "?lang=" + DubFunimation
End If
Else
WebbrowserURL = ClearUri(0) + "?lang=" + DubFunimation
End If
ElseIf InStr(WebbrowserURL, "&lang=") Then
Dim ClearUri As String() = WebbrowserURL.Split(New String() {"&lang="}, System.StringSplitOptions.RemoveEmptyEntries)
If ClearUri.Count > 1 Then
If InStr(ClearUri(1), "&") Then
Dim ClearUri2 As String() = ClearUri(1).Split(New String() {"&"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim Parms As String = Nothing
For i As Integer = 1 To ClearUri2.Count - 1
Parms = Parms + "&" + ClearUri2(i)
Next
WebbrowserURL = ClearUri(0) + "&lang=" + DubFunimation + Parms
Else
WebbrowserURL = ClearUri(0) + "&lang=" + DubFunimation
End If
Else
WebbrowserURL = ClearUri(0) + "&lang=" + DubFunimation
End If
ElseIf InStr(WebbrowserURL, "?") Then
WebbrowserURL = WebbrowserURL + "&lang=" + DubFunimation
Else
WebbrowserURL = WebbrowserURL + "?lang=" + DubFunimation
End If
End If
End If
If Funimation_Grapp_RDY = True Then If Funimation_Grapp_RDY = True Then
If RunningDownloads >= MaxDL Then If RunningDownloads >= MaxDL Then
If ListBoxList.Contains(WebbrowserURL) = False Then If ListBoxList.Contains(WebbrowserURL) = False Then
@ -3018,12 +3082,14 @@ Public Class Main
End If End If
End If End If
strRequest = rootPath & "Post_Single_Sucess.html" 'PostPage strRequest = rootPath & "Post_Single_Sucess.html" 'PostPage
sendHTMLResponse(strRequest, clientSocket) SendHTMLResponse(strRequest, clientSocket)
Catch abort As ThreadAbortException
Exit Sub
Catch ex As Exception Catch ex As Exception
Dim ErrorPage As String = My.Resources.Post_error_Top + ex.ToString + My.Resources.Post_error_Bottom Dim ErrorPage As String = My.Resources.Post_error_Top + ex.ToString + My.Resources.Post_error_Bottom
My.Computer.FileSystem.WriteAllText(Application.StartupPath + "\WebInterface\error_Page.html", ErrorPage, False) My.Computer.FileSystem.WriteAllText(Application.StartupPath + "\WebInterface\error_Page.html", ErrorPage, False)
strRequest = rootPath & "error_Page.html" 'PostPage strRequest = rootPath & "error_Page.html" 'PostPage
sendHTMLResponse(strRequest, clientSocket) SendHTMLResponse(strRequest, clientSocket)
End Try End Try
#End Region #End Region
@ -3052,6 +3118,8 @@ Public Class Main
sendHTMLResponse(strRequest, clientSocket) sendHTMLResponse(strRequest, clientSocket)
End If End If
Catch abort As ThreadAbortException
Exit Sub
Catch ex As Exception Catch ex As Exception
Debug.WriteLine(ex.ToString()) Debug.WriteLine(ex.ToString())
Dim ErrorPage As String = My.Resources.Post_error_Top + ex.ToString + My.Resources.Post_error_Bottom Dim ErrorPage As String = My.Resources.Post_error_Top + ex.ToString + My.Resources.Post_error_Bottom
@ -3077,9 +3145,9 @@ Public Class Main
' Set HTML Header ' Set HTML Header
Dim htmlHeader As String = Dim htmlHeader As String =
"HTTP/1.0 200 OK" & ControlChars.CrLf & "HTTP/1.0 200 OK" & ControlChars.CrLf &
"Server: WebServer 1.0" & ControlChars.CrLf & "Server: CRD 1.0" & ControlChars.CrLf &
"Content-Length: " & respByte.Length & ControlChars.CrLf & "Content-Length: " & respByte.Length & ControlChars.CrLf &
"Content-Type: " & getContentType(httpRequest) & "Content-Type: " & GetContentType(httpRequest) &
ControlChars.CrLf & ControlChars.CrLf ControlChars.CrLf & ControlChars.CrLf
' The content Length of HTML Header ' The content Length of HTML Header
Dim headerByte() As Byte = Encoding.UTF8.GetBytes(htmlHeader) Dim headerByte() As Byte = Encoding.UTF8.GetBytes(htmlHeader)
@ -3111,7 +3179,8 @@ Public Class Main
clientSocket.Shutdown(SocketShutdown.Both) clientSocket.Shutdown(SocketShutdown.Both)
clientSocket.Close() clientSocket.Close()
End If End If
Catch abort As ThreadAbortException
Exit Sub
Catch ex As Exception Catch ex As Exception
'Debug.WriteLine(ex.ToString()) 'Debug.WriteLine(ex.ToString())
If clientSocket.Connected Then If clientSocket.Connected Then

View File

@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben: ' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("3.7.2.1")> <Assembly: AssemblyVersion("3.7.3")>
<Assembly: AssemblyFileVersion("3.7.2.1")> <Assembly: AssemblyFileVersion("3.7.3")>
<Assembly: NeutralResourcesLanguage("en")> <Assembly: NeutralResourcesLanguage("en")>

View File

@ -42,8 +42,16 @@
<i class="checkmark"></i> <i class="checkmark"></i>
</div> </div>
<h1>Failed!</h1> <h1>Failed!</h1>
<p>System.IndexOutOfRangeException: Der Index war außerhalb des Arraybereichs. <p>System.IO.IOException: Der Prozess kann nicht auf die Datei "D:\Projecte\Crunchyroll Downloader - v3.0-final\Crunchyroll-Downloader-v3.0\Crunchyroll Downloader\bin\x86\Debug\test2.log" zugreifen, da sie von einem anderen Prozess verwendet wird.
bei Crunchyroll_Downloader.Main.ProcessRequest(Socket clientSocket) in D:\Projecte\Crunchyroll Downloader - v3.0-final\Crunchyroll-Downloader-v3.0 - UI\Crunchyroll Downloader\Main.vb:Zeile 2629.</p> bei System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
bei System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
bei System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
bei System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
bei System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
bei System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding)
bei Microsoft.VisualBasic.FileIO.FileSystem.WriteAllText(String file, String text, Boolean append, Encoding encoding)
bei Microsoft.VisualBasic.MyServices.FileSystemProxy.WriteAllText(String file, String text, Boolean append)
bei Crunchyroll_Downloader.Main.ProcessRequest(Socket clientSocket) in D:\Projecte\Crunchyroll Downloader - v3.0-final\Crunchyroll-Downloader-v3.0\Crunchyroll Downloader\Main.vb:Zeile 2851.</p>
</div> </div>
</body> </body>
</html> </html>

View File

@ -133,6 +133,7 @@ Partial Class Einstellungen
Me.Label4 = New MetroFramework.Controls.MetroLabel() Me.Label4 = New MetroFramework.Controls.MetroLabel()
Me.Label6 = New MetroFramework.Controls.MetroLabel() Me.Label6 = New MetroFramework.Controls.MetroLabel()
Me.Label5 = New MetroFramework.Controls.MetroLabel() Me.Label5 = New MetroFramework.Controls.MetroLabel()
Me.BackgroundWorker1 = New System.ComponentModel.BackgroundWorker()
CType(Me.pictureBox1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.pictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.pictureBox4, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.pictureBox4, System.ComponentModel.ISupportInitialize).BeginInit()
Me.TabPage4.SuspendLayout() Me.TabPage4.SuspendLayout()
@ -935,10 +936,10 @@ Partial Class Einstellungen
Me.TabPage1.HorizontalScrollbarBarColor = True Me.TabPage1.HorizontalScrollbarBarColor = True
Me.TabPage1.HorizontalScrollbarHighlightOnWheel = False Me.TabPage1.HorizontalScrollbarHighlightOnWheel = False
Me.TabPage1.HorizontalScrollbarSize = 10 Me.TabPage1.HorizontalScrollbarSize = 10
Me.TabPage1.Location = New System.Drawing.Point(4, 44) Me.TabPage1.Location = New System.Drawing.Point(4, 35)
Me.TabPage1.Name = "TabPage1" Me.TabPage1.Name = "TabPage1"
Me.TabPage1.Padding = New System.Windows.Forms.Padding(3) Me.TabPage1.Padding = New System.Windows.Forms.Padding(3)
Me.TabPage1.Size = New System.Drawing.Size(493, 452) Me.TabPage1.Size = New System.Drawing.Size(493, 461)
Me.TabPage1.TabIndex = 0 Me.TabPage1.TabIndex = 0
Me.TabPage1.Text = " Main" Me.TabPage1.Text = " Main"
Me.TabPage1.VerticalScrollbar = True Me.TabPage1.VerticalScrollbar = True
@ -1524,6 +1525,9 @@ Partial Class Einstellungen
Me.Label5.Text = "Created by hama3254" Me.Label5.Text = "Created by hama3254"
Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
' '
'BackgroundWorker1
'
'
'Einstellungen 'Einstellungen
' '
Me.ApplyImageInvert = True Me.ApplyImageInvert = True
@ -1706,4 +1710,5 @@ Partial Class Einstellungen
Friend WithEvents Fun_Dub_Over As MetroFramework.Controls.MetroComboBox Friend WithEvents Fun_Dub_Over As MetroFramework.Controls.MetroComboBox
Friend WithEvents CR_Filename As MetroFramework.Controls.MetroComboBox Friend WithEvents CR_Filename As MetroFramework.Controls.MetroComboBox
Public WithEvents LastVersion As MetroFramework.Controls.MetroLabel Public WithEvents LastVersion As MetroFramework.Controls.MetroLabel
Friend WithEvents BackgroundWorker1 As System.ComponentModel.BackgroundWorker
End Class End Class

View File

@ -126,8 +126,8 @@
<metadata name="MenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="MenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>118, 20</value> <value>118, 20</value>
</metadata> </metadata>
<metadata name="MenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="BackgroundWorker1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>118, 20</value> <value>332, 20</value>
</metadata> </metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>60</value> <value>60</value>

View File

@ -16,48 +16,8 @@ Public Class Einstellungen
Private Sub Einstellungen_Load(sender As Object, e As EventArgs) Handles MyBase.Load Private Sub Einstellungen_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Label6.Text = "You have: v" + Application.ProductVersion.ToString Label6.Text = "You have: v" + Application.ProductVersion.ToString
BackgroundWorker1.RunWorkerAsync()
Try
Dim client0 As New WebClient
client0.Encoding = Encoding.UTF8
client0.Headers.Add(My.Resources.ffmpeg_user_agend.Replace(Chr(34), ""))
Dim str0 As String = client0.DownloadString("https://api.github.com/repos/hama3254/Crunchyroll-Downloader-v3.0/releases")
Dim GitHubLastIsPre() As String = str0.Split(New String() {Chr(34) + "prerelease" + Chr(34) + ": "}, System.StringSplitOptions.RemoveEmptyEntries)
Dim LastNonPreRelase As Integer = 0
For i As Integer = 1 To GitHubLastIsPre.Count - 1
Dim GitHubLastIsPre1() As String = GitHubLastIsPre(i).Split(New String() {","}, System.StringSplitOptions.RemoveEmptyEntries)
If GitHubLastIsPre1(0) = "false" Then
LastNonPreRelase = i
Exit For
End If
Next
Dim GitHubLastTag() As String = str0.Split(New String() {Chr(34) + "tag_name" + Chr(34) + ": " + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
Dim GitHubLastTag1() As String = GitHubLastTag(LastNonPreRelase).Split(New String() {Chr(34) + ","}, System.StringSplitOptions.RemoveEmptyEntries)
LastVersion.Text = "last release: " + GitHubLastTag1(0)
'Dim v1 As String = Application.ProductVersion
'Dim v2 As String = GitHubLastTag1(0)
'Dim version1 = New Version(v1)
'Dim version2 = New Version(v2)
'Dim result = version1.CompareTo(version2)
'If result > 0 Then
' Console.WriteLine("version1 is greater")
'ElseIf result < 0 Then
' 'Console.WriteLine("version2 is greater")
'Else
' 'Console.WriteLine("versions are equal")
'End If
Catch ex As Exception
Debug.WriteLine(ex.ToString)
End Try
'CR_Anime_Folge = CR_Name_Staffel0_Folge1(1) 'CR_Anime_Folge = CR_Name_Staffel0_Folge1(1)
'If GitHubLastTag1(0) 'If GitHubLastTag1(0)
@ -904,6 +864,39 @@ Public Class Einstellungen
End If End If
End Sub End Sub
Private Sub BackgroundWorker1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Try
Dim client0 As New WebClient
client0.Encoding = Encoding.UTF8
client0.Headers.Add(My.Resources.ffmpeg_user_agend.Replace(Chr(34), ""))
Dim str0 As String = client0.DownloadString("https://api.github.com/repos/hama3254/Crunchyroll-Downloader-v3.0/releases")
Dim GitHubLastIsPre() As String = str0.Split(New String() {Chr(34) + "prerelease" + Chr(34) + ": "}, System.StringSplitOptions.RemoveEmptyEntries)
Dim LastNonPreRelase As Integer = 0
For i As Integer = 1 To GitHubLastIsPre.Count - 1
Dim GitHubLastIsPre1() As String = GitHubLastIsPre(i).Split(New String() {","}, System.StringSplitOptions.RemoveEmptyEntries)
If GitHubLastIsPre1(0) = "false" Then
LastNonPreRelase = i
Exit For
End If
Next
Dim GitHubLastTag() As String = str0.Split(New String() {Chr(34) + "tag_name" + Chr(34) + ": " + Chr(34)}, System.StringSplitOptions.RemoveEmptyEntries)
Dim GitHubLastTag1() As String = GitHubLastTag(LastNonPreRelase).Split(New String() {Chr(34) + ","}, System.StringSplitOptions.RemoveEmptyEntries)
Me.Invoke(New Action(Function()
LastVersion.Text = "last release: " + GitHubLastTag1(0)
Return Nothing
End Function))
Catch ex As Exception
Debug.WriteLine(ex.ToString)
End Try
End Sub