mostly fixes

-fixed name bug with movies (again :/ )
-fixed issue with the pause button on a finished/crashed download
-added retry function on crashed downloads
-added function to remove finished/crashed download from the main window
This commit is contained in:
hama3254 2020-07-05 14:06:15 +02:00
parent ae03595485
commit ec3f0b3bbe
17 changed files with 91 additions and 23 deletions

Binary file not shown.

View File

@ -51,7 +51,7 @@ Partial Class CRD_List_Item
' '
'bt_pause 'bt_pause
' '
Me.bt_pause.BackgroundImage = Global.Crunchyroll_Downloader.My.Resources.Resources.main_pause Me.bt_pause.BackgroundImage = Global.Crunchyroll_Downloader.My.Resources.main_pause
Me.bt_pause.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom Me.bt_pause.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom
Me.bt_pause.Location = New System.Drawing.Point(740, 15) Me.bt_pause.Location = New System.Drawing.Point(740, 15)
Me.bt_pause.Name = "bt_pause" Me.bt_pause.Name = "bt_pause"
@ -128,7 +128,7 @@ Partial Class CRD_List_Item
Me.ProgressBar1.Style = System.Windows.Forms.ProgressBarStyle.Continuous Me.ProgressBar1.Style = System.Windows.Forms.ProgressBarStyle.Continuous
Me.ProgressBar1.TabIndex = 8 Me.ProgressBar1.TabIndex = 8
' '
'Item 'CRD_List_Item
' '
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
@ -142,7 +142,7 @@ Partial Class CRD_List_Item
Me.Controls.Add(Me.bt_del) Me.Controls.Add(Me.bt_del)
Me.Controls.Add(Me.bt_pause) Me.Controls.Add(Me.bt_pause)
Me.Controls.Add(Me.PB_Thumbnail) Me.Controls.Add(Me.PB_Thumbnail)
Me.Name = "Item" Me.Name = "CRD_List_Item"
Me.Size = New System.Drawing.Size(838, 142) Me.Size = New System.Drawing.Size(838, 142)
CType(Me.PB_Thumbnail, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.PB_Thumbnail, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.bt_pause, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.bt_pause, System.ComponentModel.ISupportInitialize).EndInit()

View File

@ -16,6 +16,21 @@ Public Class CRD_List_Item
Dim MergeSubstoMP4 As Boolean = False Dim MergeSubstoMP4 As Boolean = False
Dim SaveLog As Boolean = False Dim SaveLog As Boolean = False
Dim DownloadPfad As String = Nothing Dim DownloadPfad As String = Nothing
Dim ToDispose As Boolean = False
Dim HistoryDL_URL As String
Dim HistoryDL_Pfad As String
Dim HistoryFilename As String
Dim Retry As Boolean = False
#Region "Remove from list"
Public Sub DisposeItem(ByVal Dispose As Boolean)
If Dispose = True Then
Me.Dispose()
End If
End Sub
Public Function GetToDispose() As Boolean
Return ToDispose
End Function
#End Region
#Region "Set UI" #Region "Set UI"
Public Sub SetLabelWebsite(ByVal Text As String) Public Sub SetLabelWebsite(ByVal Text As String)
Label_website.Text = Text Label_website.Text = Text
@ -100,6 +115,32 @@ Public Class CRD_List_Item
End Sub End Sub
Private Sub bt_pause_Click(sender As Object, e As EventArgs) Handles bt_pause.Click Private Sub bt_pause_Click(sender As Object, e As EventArgs) Handles bt_pause.Click
If proc.HasExited = True Then
If ProgressBar1.Value < 100 Then
MsgBox("Something is wrong here, the download process seems to have crashed", MsgBoxStyle.Exclamation)
Label_percent.Text = "Press the play button again to retry."
ProgressBar1.Value = 100
Retry = True
StatusRunning = False
ElseIf Retry = True Then
If Main.RunningDownloads < Main.MaxDL Then
Else
If MessageBox.Show("You have currtenly on your set Download limit." + vbNewLine + " You can Press OK to ignore it.", "Download maximum reached", MessageBoxButtons.OKCancel) = DialogResult.Cancel Then
Exit Sub
End If
End If
If My.Computer.FileSystem.FileExists(HistoryDL_Pfad.Replace(Chr(34), "")) Then 'Pfad = Kompeltter Pfad mit Dateinamen + ENdung
Try
My.Computer.FileSystem.DeleteFile(HistoryDL_Pfad.Replace(Chr(34), ""))
Catch ex As Exception
End Try
End If
DownloadFFMPEG(HistoryDL_URL, HistoryDL_Pfad, HistoryFilename)
StatusRunning = True
End If
Exit Sub
End If
If StatusRunning = True Then If StatusRunning = True Then
StatusRunning = False StatusRunning = False
bt_pause.BackgroundImage = My.Resources.main_pause_play bt_pause.BackgroundImage = My.Resources.main_pause_play
@ -149,6 +190,9 @@ Public Class CRD_List_Item
Public Function DownloadFFMPEG(ByVal DL_URL As String, ByVal DL_Pfad As String, ByVal Filename As String) As String Public Function DownloadFFMPEG(ByVal DL_URL As String, ByVal DL_Pfad As String, ByVal Filename As String) As String
DownloadPfad = DL_Pfad DownloadPfad = DL_Pfad
HistoryDL_URL = DL_URL
HistoryDL_Pfad = DL_Pfad
HistoryFilename = Filename
Dim exepath As String = Application.StartupPath + "\ffmpeg.exe" Dim exepath As String = Application.StartupPath + "\ffmpeg.exe"
Dim startinfo As New System.Diagnostics.ProcessStartInfo Dim startinfo As New System.Diagnostics.ProcessStartInfo
@ -321,8 +365,14 @@ Public Class CRD_List_Item
Private Sub bt_del_Click(sender As Object, e As EventArgs) Handles bt_del.Click Private Sub bt_del_Click(sender As Object, e As EventArgs) Handles bt_del.Click
If proc.HasExited Then If proc.HasExited Then
If MessageBox.Show("The Download is not running anymore, press ok to remove it from the list.", "Remove from list!", MessageBoxButtons.OKCancel) = DialogResult.Cancel Then
Exit Sub
End If
ToDispose = True
Else Else
If MessageBox.Show("Are you sure you want to cancel the Download?", "Cancel Download!", MessageBoxButtons.YesNo) = DialogResult.No Then
Exit Sub
End If
KillRunningTask() KillRunningTask()
End If End If

View File

@ -371,7 +371,10 @@ Public Class GeckoFX
End Sub End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
'Main.WebbrowserURL = WebBrowser1.Url.ToString
'Main.WebbrowserText = WebBrowser1.Document.Body.OuterHtml
'Main.WebbrowserTitle = WebBrowser1.DocumentTitle
'Main.GrappURL()
Try Try
My.Computer.Clipboard.SetText(WebBrowser1.Url.ToString) My.Computer.Clipboard.SetText(WebBrowser1.Url.ToString)
MsgBox("copied: " + Chr(34) + WebBrowser1.Url.ToString + Chr(34)) MsgBox("copied: " + Chr(34) + WebBrowser1.Url.ToString + Chr(34))

View File

@ -59,6 +59,21 @@ Public Class Login
Dim Request0 As HttpWebRequest = CType(WebRequest.Create("https://api.crunchyroll.com/login.0.json"), HttpWebRequest) Dim Request0 As HttpWebRequest = CType(WebRequest.Create("https://api.crunchyroll.com/login.0.json"), HttpWebRequest)
Request0.Method = "POST" Request0.Method = "POST"
Request0.ContentType = "application/x-www-form-urlencoded" Request0.ContentType = "application/x-www-form-urlencoded"
If GeckoFX.keks = Nothing Then
MsgBox("No active Cookie found!", MsgBoxStyle.Exclamation)
Me.Close()
Exit Sub
'GeckoFX.WebBrowser1.Navigate("https://www.crunchyroll.com/")
'Pause(2)
'Dim c As String = GeckoFX.WebBrowser1.Document.Cookie.ToString
'MsgBox(c)
'Dim cookieGrapp7() As String = c.Split(New String() {"session_id="}, System.StringSplitOptions.RemoveEmptyEntries)
'Dim cookieGrapp8() As String = cookieGrapp7(1).Split(New String() {";"}, System.StringSplitOptions.RemoveEmptyEntries)
'MsgBox(cookieGrapp8(0))
'GeckoFX.keks = cookieGrapp8(0)
''Console.WriteLine()
End If
Dim Post0 As String = "account=" + LoginID.Text + "&password=" + Password.Text + "&session_id=" + GeckoFX.keks Dim Post0 As String = "account=" + LoginID.Text + "&password=" + Password.Text + "&session_id=" + GeckoFX.keks
Dim byteArray0() As Byte = Encoding.UTF8.GetBytes(Post0) Dim byteArray0() As Byte = Encoding.UTF8.GetBytes(Post0)
Request0.ContentLength = byteArray0.Length Request0.ContentLength = byteArray0.Length
@ -71,6 +86,7 @@ Public Class Login
Dim ServerResponse0 As String = reader0.ReadToEnd() Dim ServerResponse0 As String = reader0.ReadToEnd()
If InStr(ServerResponse0, My.Resources.LoginSuccess) Then If InStr(ServerResponse0, My.Resources.LoginSuccess) Then
Else Else
MsgBox(Post0)
MsgBox(ServerResponse0) MsgBox(ServerResponse0)
End If End If
reader0.Close() reader0.Close()

View File

@ -1070,22 +1070,14 @@ Public Class Main
End Function)) End Function))
#Region "Name von Crunchyroll" #Region "Name von Crunchyroll"
If TextBox2_Text = Nothing Or TextBox2_Text = "Name of the Anime" Then If TextBox2_Text = Nothing Or TextBox2_Text = "Name of the Anime" Then
'MsgBox("True")
'Dim Bug_Deutsch As String = "-"
'If CBool(InStr(WebbrowserTitle, "Anschauen auf Crunchyroll")) Then
' Bug_Deutsch = ":"
'End If
'Dim CR_Name_by_Titel_2 As String() = WebbrowserTitle.Split(New String() {Bug_Deutsch}, System.StringSplitOptions.RemoveEmptyEntries)
'CR_FilenName = CR_Name_by_Titel_2(0).Trim() '+ " " + CR_Name_by_Script2(0).Trim
Dim Bug_Deutsch As String = "-" Dim Bug_Deutsch As String = "-"
If CBool(InStr(WebbrowserTitle, "Anschauen auf Crunchyroll")) Then If CBool(InStr(WebbrowserTitle, "Anschauen auf Crunchyroll")) Then
Bug_Deutsch = ":" Bug_Deutsch = ":"
End If End If
Dim CR_Name_by_Titel_2 As String() = WebbrowserTitle.Split(New String() {Bug_Deutsch}, System.StringSplitOptions.RemoveEmptyEntries) Dim CR_Name_by_Titel_2 As String() = WebbrowserTitle.Split(New String() {Bug_Deutsch}, System.StringSplitOptions.RemoveEmptyEntries)
Dim CR_Title As String = Nothing Dim CR_Title As String = Nothing
If CR_Name_by_Titel_2.Count > 2 Then 'If CR_Name_by_Titel_2.Count > 2 Then
For i As Integer = 0 To CR_Name_by_Titel_2.Count - 2 For i As Integer = 0 To CR_Name_by_Titel_2.Count - 2
If CR_Title = Nothing Then If CR_Title = Nothing Then
CR_Title = CR_Name_by_Titel_2(i).Trim() CR_Title = CR_Name_by_Titel_2(i).Trim()
Else Else
@ -1093,7 +1085,9 @@ Public Class Main
End If End If
Next Next
End If 'Else
'End If
CR_FilenName = CR_Title CR_FilenName = CR_Title
CR_FilenName_Backup = CR_Title CR_FilenName_Backup = CR_Title
'MsgBox(CR_FilenName) 'MsgBox(CR_FilenName)
@ -1157,9 +1151,10 @@ Public Class Main
End If End If
Return Nothing Return Nothing
End Function)) End Function))
'MsgBox(CR_FilenName)
CR_FilenName = System.Text.RegularExpressions.Regex.Replace(CR_FilenName, "[^\w\\-]", " ") CR_FilenName = System.Text.RegularExpressions.Regex.Replace(CR_FilenName, "[^\w\\-]", " ")
CR_FilenName = RemoveExtraSpaces(CR_FilenName) CR_FilenName = RemoveExtraSpaces(CR_FilenName)
'MsgBox(CR_FilenName)
If SubfolderValue = Nothing Then If SubfolderValue = Nothing Then
Pfad2 = Pfad + "\" + CR_FilenName + ".mp4" Pfad2 = Pfad + "\" + CR_FilenName + ".mp4"
Else Else
@ -1588,13 +1583,17 @@ Public Class Main
End Function End Function
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Try Try
Dim ItemDownloadingTrue As Integer = 0
For s As Integer = 0 To ListView1.Items.Count - 1 For s As Integer = 0 To ListView1.Items.Count - 1
Dim r As Rectangle = ListView1.Items.Item(s).Bounds Dim r As Rectangle = ListView1.Items.Item(s).Bounds
ItemList(s).SetBounds(r.X, r.Y, r.Width, r.Height) ItemList(s).SetBounds(r.X, r.Y, r.Width, r.Height)
If ItemList(s).GetToDispose() = True Then
ItemList(s).DisposeItem(ItemList(s).GetToDispose())
ItemList.RemoveAt(s)
ListView1.Items.RemoveAt(s)
End If
Next Next
Catch ex As Exception Catch ex As Exception
@ -1808,7 +1807,7 @@ Public Class Main
Private Sub Main_MouseDoubleClick(sender As Object, e As MouseEventArgs) Handles Me.MouseDoubleClick Private Sub Main_MouseDoubleClick(sender As Object, e As MouseEventArgs) Handles Me.MouseDoubleClick
'Login.Show() Login.Show()
End Sub End Sub
Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick

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.3")> <Assembly: AssemblyVersion("3.3.1")>
<Assembly: AssemblyFileVersion("3.3")> <Assembly: AssemblyFileVersion("3.3.1")>
<Assembly: NeutralResourcesLanguage("en")> <Assembly: NeutralResourcesLanguage("en")>