Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
timtester123 committed Apr 21, 2021
1 parent dc6c7ba commit 2a6197a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 9 deletions.
36 changes: 29 additions & 7 deletions M3U_VOD_Downloader/Form1.vb
Original file line number Diff line number Diff line change
Expand Up @@ -246,22 +246,44 @@ Public Class Form1
Label_status.Text = left_files & "/" & total_files & " " & akt_file & " " & e.ProgressPercentage & " %" & " " & Math.Round(e.BytesReceived / 1000000, 2) & " MB / " & Math.Round(e.TotalBytesToReceive / 1000000, 2) & " MB" & " " & (e.BytesReceived / (DirectCast(e.UserState, Stopwatch).ElapsedMilliseconds / 1000) / (1024 * 1024)).ToString("0.000 MB/s")

End Sub

Dim TryAgain As Boolean = False

Private Sub client_DownloadCompleted() Handles downloader.DownloadFileCompleted
left_files = left_files + 1
If Downloads_URLS.Count > 0 Then
Downloads_URLS.RemoveAt(0)
Downloads_DownloadFiles.RemoveAt(0)
If Downloads_URLS.Count > 0 Then
akt_file = Path.GetFileName(Downloads_DownloadFiles(0))

If Downloads_DownloadFiles.Count > 0 Then
'Check File Size
Dim LocalFile As String = Downloads_DownloadFiles(0)
If My.Computer.FileSystem.GetFileInfo(LocalFile).Length = 0 And TryAgain = False Then 'FileSize = 0
TryAgain = True
Label_status.Text = "Download failed, waiting 5 Seconds for a retry."
Application.DoEvents()
System.Threading.Thread.Sleep(5000)
downloader.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)")
downloader.DownloadFileAsync(New Uri(Downloads_URLS(0)), Downloads_DownloadFiles(0), Stopwatch.StartNew)
Else
'Everything ok starting next download
TryAgain = False
left_files = left_files + 1
If Downloads_URLS.Count > 0 Then
Downloads_URLS.RemoveAt(0)
Downloads_DownloadFiles.RemoveAt(0)
If Downloads_URLS.Count > 0 Then
akt_file = Path.GetFileName(Downloads_DownloadFiles(0))
downloader.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)")
downloader.DownloadFileAsync(New Uri(Downloads_URLS(0)), Downloads_DownloadFiles(0), Stopwatch.StartNew)
End If
End If
End If
End If

'download complete
If Downloads_URLS.Count = 0 Then
Label_status.Text = "Download complete"
Button_Download.Text = "Download"
Button_to_queue.Enabled = False
End If


End Sub


Expand Down
4 changes: 2 additions & 2 deletions M3U_VOD_Downloader/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' indem Sie "*" wie unten gezeigt eingeben:
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("1.7.0.1")>
<Assembly: AssemblyFileVersion("1.7.0.1")>
<Assembly: AssemblyVersion("1.7.0.2")>
<Assembly: AssemblyFileVersion("1.7.0.2")>

0 comments on commit 2a6197a

Please sign in to comment.