networkscan rewriten

networkscan rewriten
This commit is contained in:
hama3254 2020-12-18 13:47:55 +01:00
parent a428e70084
commit 0dbc0deccc
16 changed files with 135 additions and 185 deletions

Binary file not shown.

View File

@ -362,9 +362,9 @@ Partial Class Anime_Add
Me.Controls.Add(Me.Btn_min)
Me.Controls.Add(Me.Btn_Close)
Me.Controls.Add(Me.pictureBox4)
Me.Controls.Add(Me.groupBox2)
Me.Controls.Add(Me.groupBox1)
Me.Controls.Add(Me.GroupBox3)
Me.Controls.Add(Me.groupBox2)
Me.Name = "Anime_Add"
Me.Padding = New System.Windows.Forms.Padding(10, 60, 20, 20)
Me.Text = "Add Video"

View File

@ -141,43 +141,7 @@ Public Class Anime_Add
Private Sub TextBox4_DoubleClick(sender As Object, e As EventArgs) Handles TextBox4.DoubleClick
'MsgBox(DL_Path_String, MsgBoxStyle.OkOnly)
Dim FolderBrowserDialog1 As New FolderBrowserDialog()
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
@ -1260,4 +1224,43 @@ Public Class Anime_Add
PB.Image = Main.CloseImg
End Sub
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
End Class

View File

@ -53,9 +53,11 @@ Namespace My
GeckoPreferences.Default("plugin.state.flash") = 0
GeckoPreferences.Default("zoom.maxPercent") = 100
GeckoPreferences.Default("zoom.minPercent") = 100
' GeckoPreferences.Default("media.autoplay.default") = 2
'GeckoPreferences.Default("media.autoplay.block-webaudio") = False
'GeckoPreferences.Default("javascript.enabled") = False
'GeckoPreferences.Default("network.proxy.http") = "51.159.26.44"
'GeckoPreferences.Default("network.proxy.http_port") = 3128
'GeckoPreferences.Default("network.proxy.ssl") = "51.159.26.44"
'GeckoPreferences.Default("network.proxy.ssl_port") = 3128
'GeckoPreferences.Default("network.proxy.type") = 1
Return True

View File

@ -496,7 +496,7 @@ Public Class CRD_List_Item
Try
Me.Invoke(New Action(Function()
ProgressBar1.Value = prozent
ProgressBar1.Value = prozent 'ThreadList.Count.ToString + " " +
Label_percent.Text = DataRateString + "MB\s " + Math.Round(FinishedSize / 1048576, 2, MidpointRounding.AwayFromZero).ToString + "MB/" + Math.Round(AproxFinalSize, 2, MidpointRounding.AwayFromZero).ToString + "MB " + prozent.ToString + "%"
Return Nothing
@ -639,7 +639,7 @@ Public Class CRD_List_Item
If Threads < 2 Then
Threads = 2
End If
'Threads = 16
'Threads = textLenght.Length / 20
Dim di As New IO.DirectoryInfo(Pfad2)
For i As Integer = 0 To textLenght.Length - 1
If InStr(textLenght(i), ".ts") Then

View File

@ -545,156 +545,96 @@ Public Class GeckoFX
Dim logFileReader As StreamReader = New StreamReader(logFileStream)
logFileStream.SetLength(0)
'WebBrowser1.Navigate(TextBox1.Text)
Main.WebbrowserURL = WebBrowser1.Url.ToString
Main.WebbrowserText = WebBrowser1.Document.Body.OuterHtml
Main.b = True
Main.UserBowser = True
For i As Integer = 20 To 0 Step -1
Pause(1)
Button2.Text = "network scan is in progess " + Math.Abs(i).ToString
Next
If InStr(Main.WebbrowserURL, "anime-on-demand.de/anime/") Then
Main.WebbrowserTitle = WebBrowser1.Document.GetElementsByClassName("jw-title-primary").First.TextContent
If Main.Debug2 = True Then
MsgBox(Main.WebbrowserTitle)
End If
'Main.Thumbnail = WebBrowser1.Document.GetElementsByClassName("fullwidth-image anime-top-image").First.TextContent
Main.WebbrowserURL = WebBrowser1.Url.ToString
Main.WebbrowserText = WebBrowser1.Document.Body.OuterHtml
Main.WebbrowserTitle = WebBrowser1.DocumentTitle
Dim SubtitleName As String = Main.WebbrowserTitle.Replace(" - Watch on VRV", "").Replace("Free Streaming", "").Replace("Tubi", "")
SubtitleName = Main.RemoveExtraSpaces(System.Text.RegularExpressions.Regex.Replace(SubtitleName, "[^\w\\-]", " "))
Dim SubtitlePfad As String = Main.Pfad + "\" + SubtitleName
Dim LogText As String = logFileReader.ReadToEnd
Dim Requests() As String = LogText.Split(New String() {"I/nsHttp http request ["}, System.StringSplitOptions.RemoveEmptyEntries)
Dim client0 As New WebClient
client0.Encoding = Encoding.UTF8
If WebBrowser1.Document.Cookie = Nothing Then
Else
Main.WebbrowserTitle = WebBrowser1.DocumentTitle
client0.Headers.Add(HttpRequestHeader.Cookie, WebBrowser1.Document.Cookie)
End If
Dim line As String = Nothing
Dim HTMLString As String = Nothing
line = logFileReader.ReadLine
For i As Integer = 1 To Requests.Count - 1
Dim Requests2() As String = Requests(i).Split(New String() {"I/nsHttp ]"}, System.StringSplitOptions.RemoveEmptyEntries)
While (line IsNot Nothing)
line = logFileReader.ReadLine
If InStr(line, ".m3u8") Then 'm3u8?
Dim Temp_String As String = Nothing
Temp_String = line
If HTMLString = Nothing Then
HTMLString = line
Else
HTMLString = HTMLString + vbNewLine + line
If InStr(Requests2(0), " GET ") Then
Dim URLPath() As String = Requests2(0).Split(New String() {" GET "}, System.StringSplitOptions.RemoveEmptyEntries)
Dim URLPath2() As String = URLPath(1).Split(New String() {" HTTP/"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim URLHost1() As String = Requests2(0).Split(New String() {" Host: "}, System.StringSplitOptions.RemoveEmptyEntries)
Dim URLHost2() As String = URLHost1(1).Split(New String() {vbNewLine}, System.StringSplitOptions.RemoveEmptyEntries)
Dim RequestURL As String = "https://" + URLHost2(0) + URLPath2(0)
If InStr(Requests2(0), ".m3u8") Then
Dim str0 As String = client0.DownloadString(RequestURL)
If InStr(str0, "#EXTM3U") Then
Main.m3u8List.Add(RequestURL)
End If
ElseIf InStr(Requests2(0), ".mpd") Then
Main.mpdList.Add(RequestURL)
ElseIf InStr(Requests2(0), ".txt") Then
Main.txtList.Add(RequestURL)
client0.DownloadFileAsync(New Uri(RequestURL), SubtitlePfad + ".txt")
ElseIf InStr(Requests2(0), ".vtt") Then
Main.txtList.Add(RequestURL)
client0.DownloadFileAsync(New Uri(RequestURL), SubtitlePfad + ".vtt")
ElseIf InStr(Requests2(0), ".srt") Then
Main.txtList.Add(RequestURL)
client0.DownloadFileAsync(New Uri(RequestURL), SubtitlePfad + ".srt")
ElseIf InStr(Requests2(0), ".ass") Then
Main.txtList.Add(RequestURL)
client0.DownloadFileAsync(New Uri(RequestURL), SubtitlePfad + ".ass")
ElseIf InStr(Requests2(0), ".ssa") Then
Main.txtList.Add(RequestURL)
client0.DownloadFileAsync(New Uri(RequestURL), SubtitlePfad + ".ssa")
ElseIf InStr(Requests2(0), ".dfxp") Then
Main.txtList.Add(RequestURL)
client0.DownloadFileAsync(New Uri(RequestURL), SubtitlePfad + ".dfxp")
End If
For i As Integer = 0 To 10
line = logFileReader.ReadLine
If InStr(line, " Host: ") Then
HTMLString = HTMLString + vbNewLine + line
Main.m3u8List.Add(Temp_String + vbNewLine.ToString + line.ToString)
End If
Next
ElseIf InStr(line, ".txt") Then
Dim Temp_String As String = Nothing
Temp_String = line
For i As Integer = 0 To 10
line = logFileReader.ReadLine
If InStr(line, " Host: ") Then
Main.txtList.Add(Temp_String + vbNewLine + line)
End If
Next
ElseIf InStr(line, ".vtt") Then
Dim Temp_String As String = Nothing
Temp_String = line
For i As Integer = 0 To 10
line = logFileReader.ReadLine
If InStr(line, " Host: ") Then
Main.txtList.Add(Temp_String + vbNewLine + line)
End If
Next
ElseIf InStr(line, ".mpd") Then
Dim Temp_String As String = Nothing
Temp_String = line
For i As Integer = 0 To 10
line = logFileReader.ReadLine
If InStr(line, " Host: ") Then
Main.mpdList.Add(Temp_String + vbNewLine + line)
End If
Next
End If
End While
logFileReader.Close()
logFileStream.Close()
'MsgBox(HTMLString)
If InStr(HTMLString, ".m3u8") Then 'm3u8?
Button2.Text = "found m3u8"
Main.LogBrowserData = False
GeckoPreferences.Default("logging.config.LOG_FILE") = "gecko-network.txt"
GeckoPreferences.Default("logging.nsHttp") = 0
Dim URL As String = Nothing
Dim HTMLSplit() As String = HTMLString.Split(New String() {vbNewLine}, System.StringSplitOptions.RemoveEmptyEntries)
For i As Integer = 0 To HTMLSplit.Count - 1
If InStr(HTMLSplit(i), ".m3u8") Then 'm3u8?
Dim URLPart2() As String = HTMLSplit(i).Split(New String() {" GET "}, System.StringSplitOptions.RemoveEmptyEntries)
Dim URLPart2Split2() As String = URLPart2(1).Split(New String() {" HTTP/"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim URLPart1() As String = HTMLSplit(i + 1).Split(New String() {" Host: "}, System.StringSplitOptions.RemoveEmptyEntries)
Main.NonCR_URL = "https://" + URLPart1(1) + URLPart2Split2(0)
'MsgBox(Main.NonCR_URL)
'RichTextBox1.Text = RichTextBox1.Text + vbNewLine + URL_Final
Main.FFMPEG_Reso(Main.NonCR_URL)
t = New Thread(AddressOf Main.Grapp_non_CR)
t.Priority = ThreadPriority.Normal
t.IsBackground = True
t.Start()
Button2.Text = "Start network scan"
Exit For
End If
Next
ElseIf Main.mpdList.Count > 0 Then 'InStr(HTMLString, ".mpd?") Then
HTMLString = Main.mpdList.Item(0)
Button2.Text = "found mpd!"
Main.LogBrowserData = False
GeckoPreferences.Default("logging.config.LOG_FILE") = "gecko-network.txt"
GeckoPreferences.Default("logging.nsHttp") = 0
Dim URL As String = Nothing
Dim HTMLSplit() As String = HTMLString.Split(New String() {vbNewLine}, System.StringSplitOptions.RemoveEmptyEntries)
For i As Integer = 0 To HTMLSplit.Count - 1
If InStr(HTMLSplit(i), ".mpd?") Then
Dim URLPart2() As String = HTMLSplit(i).Split(New String() {" GET "}, System.StringSplitOptions.RemoveEmptyEntries)
Dim URLPart2Split2() As String = URLPart2(1).Split(New String() {" HTTP/"}, System.StringSplitOptions.RemoveEmptyEntries)
Dim URLPart1() As String = HTMLSplit(i + 1).Split(New String() {" Host: "}, System.StringSplitOptions.RemoveEmptyEntries)
Main.NonCR_URL = "https://" + URLPart1(1) + URLPart2Split2(0)
'MsgBox(Main.NonCR_URL)
'RichTextBox1.Text = RichTextBox1.Text + vbNewLine + URL_Final
Main.FFMPEG_Reso(Main.NonCR_URL)
t = New Thread(AddressOf Main.Grapp_non_CR)
t.Priority = ThreadPriority.Normal
t.IsBackground = True
t.Start()
Button2.Text = "Start network scan"
Exit For
End If
Next
Next
If Main.m3u8List.Count > 0 Then
Main.NonCR_URL = Main.m3u8List.Item(0)
Main.FFMPEG_Reso(Main.NonCR_URL)
t = New Thread(AddressOf Main.Grapp_non_CR)
t.Priority = ThreadPriority.Normal
t.IsBackground = True
t.Start()
Button2.Text = "Start network scan"
ElseIf Main.mpdList.Count > 0 Then
Main.NonCR_URL = Main.mpdList.Item(0)
Main.FFMPEG_Reso(Main.NonCR_URL)
t = New Thread(AddressOf Main.Grapp_non_CR)
t.Priority = ThreadPriority.Normal
t.IsBackground = True
t.Start()
Button2.Text = "Start network scan"
End If
'If Main.txtList.Count > 0 Then 'InStr(HTMLString, ".mpd?") Then
' HTMLString = Main.mpdList.Item(0)
' 'Button2.Text = "found mpd!"
' Main.LogBrowserData = False
' GeckoPreferences.Default("logging.config.LOG_FILE") = "gecko-network.txt"
' GeckoPreferences.Default("logging.nsHttp") = 0
' Dim URL As String = Nothing
' Dim HTMLSplit() As String = HTMLString.Split(New String() {vbNewLine}, System.StringSplitOptions.RemoveEmptyEntries)
' For i As Integer = 0 To HTMLSplit.Count - 1
' If InStr(HTMLSplit(i), ".mpd?") Then
' Dim URLPart2() As String = HTMLSplit(i).Split(New String() {" GET "}, System.StringSplitOptions.RemoveEmptyEntries)
' Dim URLPart2Split2() As String = URLPart2(1).Split(New String() {" HTTP/"}, System.StringSplitOptions.RemoveEmptyEntries)
' Dim URLPart1() As String = HTMLSplit(i + 1).Split(New String() {" Host: "}, System.StringSplitOptions.RemoveEmptyEntries)
' Main.NonCR_URL = "https://" + URLPart1(1) + URLPart2Split2(0)
' 'MsgBox(Main.NonCR_URL)
' 'RichTextBox1.Text = RichTextBox1.Text + vbNewLine + URL_Final
' Main.FFMPEG_Reso(Main.NonCR_URL)
' t = New Thread(AddressOf Main.Grapp_non_CR)
' t.Priority = ThreadPriority.Normal
' t.IsBackground = True
' t.Start()
' Button2.Text = "Start network scan"
' Exit For
' End If
' Next
'End If
ScanTrue = False
Button2.Enabled = True
Catch ex As Exception

View File

@ -375,6 +375,7 @@ Public Class Main
Try
Dim rkg As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\CRDownloader")
UseQueue = CBool(Integer.Parse(rkg.GetValue("QueueMode").ToString))
'MsgBox(UseQueue.ToString)
Catch ex As Exception
End Try
@ -599,7 +600,11 @@ Public Class Main
'Item.SetLocations(r.Y)
'MsgBox("test " + r.Y.ToString)
Item.Visible = True
Item.StartDownload(URL_DL, Pfad_DL, Pfad_DL, HybridMode)
Dim TempHybridMode As Boolean = HybridMode
If InStr(URL_DL, ".mpd") Then
TempHybridMode = False
End If
Item.StartDownload(URL_DL, Pfad_DL, Pfad_DL, TempHybridMode)
End Sub
#Region "Manga DL"
Public Sub MangaListItemAdd(ByVal NameP2 As String, ByVal ThumbnialURL As String, ByVal BaseURL As String, ByVal SiteList As List(Of String))
@ -755,10 +760,10 @@ Public Class Main
Exit For
Else
'MsgBox(e)
Await Task.Delay(2000)
Await Task.Delay(1000)
End If
Else
Await Task.Delay(2000)
Await Task.Delay(5000)
End If
Next
If Anime_Add.Mass_DL_Cancel = False Then
@ -1880,7 +1885,7 @@ Public Class Main
For s As Integer = 0 To ListView1.Items.Count - 1
Dim r As Rectangle = ListView1.Items.Item(s).Bounds
ItemList(s).SetBounds(r.X, r.Y, ListView1.Width, r.Height)
ItemList(s).SetTheme(Manager.Theme)
If ItemList(s).GetToDispose() = True Then
ItemList(s).DisposeItem(ItemList(s).GetToDispose())
ItemList.RemoveAt(s)
@ -1922,8 +1927,8 @@ Public Class Main
'Else
ResoAvalibe = ResoAvalibe + vbNewLine + ZeileReso2(ZeileReso2.Count - 1).Trim + ":--:" + ZeileReso4(1)
'End If
ElseIf InStr(e.Data, "Duration:") Then
ResoAvalibe = Nothing
'ElseIf InStr(e.Data, "Duration:") Then
' ResoAvalibe = Nothing
ElseIf InStr(e.Data, "At least one output file must be specified") Then
ResoSearchRunning = False
End If
@ -1996,6 +2001,7 @@ Public Class Main
Dim Video_FilenName As String = Video_Title
Video_FilenName = System.Text.RegularExpressions.Regex.Replace(Video_FilenName, "[^\w\\-]", " ")
Video_FilenName = RemoveExtraSpaces(Video_FilenName + ".mp4")
Pfad_DL = Chr(34) + Pfad + "\" + Video_FilenName + Chr(34)
#End Region
#Region "thumbnail"
@ -2108,7 +2114,6 @@ Public Class Main
Try
Dim ItemDownloadingCount As Integer = 0
For i As Integer = 0 To ListView1.Items.Count - 1
ItemList(i).SetTheme(Manager.Theme)
If ItemList(i).GetIsStatusFinished() = False Then
ItemDownloadingCount = ItemDownloadingCount + 1
End If

View File

@ -443,7 +443,7 @@ Public Class Einstellungen
If ListViewAdd_True.Checked = True Then
rk.SetValue("QueueMode", 1, RegistryValueKind.String)
Main.UseQueue = True
ElseIf ListViewAdd_True.Checked = False Then
rk.SetValue("QueueMode", 0, RegistryValueKind.String)
Main.UseQueue = False