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
'
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.Location = New System.Drawing.Point(740, 15)
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.TabIndex = 8
'
'Item
'CRD_List_Item
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
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_pause)
Me.Controls.Add(Me.PB_Thumbnail)
Me.Name = "Item"
Me.Name = "CRD_List_Item"
Me.Size = New System.Drawing.Size(838, 142)
CType(Me.PB_Thumbnail, 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 SaveLog As Boolean = False
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"
Public Sub SetLabelWebsite(ByVal Text As String)
Label_website.Text = Text
@ -100,6 +115,32 @@ Public Class CRD_List_Item
End Sub
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
StatusRunning = False
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
DownloadPfad = DL_Pfad
HistoryDL_URL = DL_URL
HistoryDL_Pfad = DL_Pfad
HistoryFilename = Filename
Dim exepath As String = Application.StartupPath + "\ffmpeg.exe"
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
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
If MessageBox.Show("Are you sure you want to cancel the Download?", "Cancel Download!", MessageBoxButtons.YesNo) = DialogResult.No Then
Exit Sub
End If
KillRunningTask()
End If

View File

@ -371,7 +371,10 @@ Public Class GeckoFX
End Sub
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
My.Computer.Clipboard.SetText(WebBrowser1.Url.ToString)
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)
Request0.Method = "POST"
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 byteArray0() As Byte = Encoding.UTF8.GetBytes(Post0)
Request0.ContentLength = byteArray0.Length
@ -71,6 +86,7 @@ Public Class Login
Dim ServerResponse0 As String = reader0.ReadToEnd()
If InStr(ServerResponse0, My.Resources.LoginSuccess) Then
Else
MsgBox(Post0)
MsgBox(ServerResponse0)
End If
reader0.Close()

View File

@ -1070,21 +1070,13 @@ Public Class Main
End Function))
#Region "Name von Crunchyroll"
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 = "-"
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)
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
If CR_Title = Nothing Then
CR_Title = CR_Name_by_Titel_2(i).Trim()
@ -1093,7 +1085,9 @@ Public Class Main
End If
Next
End If
'Else
'End If
CR_FilenName = CR_Title
CR_FilenName_Backup = CR_Title
'MsgBox(CR_FilenName)
@ -1157,9 +1151,10 @@ Public Class Main
End If
Return Nothing
End Function))
'MsgBox(CR_FilenName)
CR_FilenName = System.Text.RegularExpressions.Regex.Replace(CR_FilenName, "[^\w\\-]", " ")
CR_FilenName = RemoveExtraSpaces(CR_FilenName)
'MsgBox(CR_FilenName)
If SubfolderValue = Nothing Then
Pfad2 = Pfad + "\" + CR_FilenName + ".mp4"
Else
@ -1588,13 +1583,17 @@ Public Class Main
End Function
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Try
Dim ItemDownloadingTrue As Integer = 0
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, 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
Catch ex As Exception
@ -1808,7 +1807,7 @@ Public Class Main
Private Sub Main_MouseDoubleClick(sender As Object, e As MouseEventArgs) Handles Me.MouseDoubleClick
'Login.Show()
Login.Show()
End Sub
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:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("3.3")>
<Assembly: AssemblyFileVersion("3.3")>
<Assembly: AssemblyVersion("3.3.1")>
<Assembly: AssemblyFileVersion("3.3.1")>
<Assembly: NeutralResourcesLanguage("en")>