Skip to content

Commit

Permalink
added download path and offset
Browse files Browse the repository at this point in the history
  • Loading branch information
timtester123 committed Dec 6, 2020
1 parent 64c54b1 commit 869e7f1
Show file tree
Hide file tree
Showing 5 changed files with 161 additions and 35 deletions.
6 changes: 6 additions & 0 deletions M3U_IPTV_CatchUp_Downloader/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
<setting name="DownloadPath" serializeAs="String">
<value />
</setting>
<setting name="offset_b" serializeAs="String">
<value />
</setting>
<setting name="offset_a" serializeAs="String">
<value />
</setting>
</M3U_IPTV_CatchUp_Downloader.My.MySettings>
</userSettings>
</configuration>
125 changes: 93 additions & 32 deletions M3U_IPTV_CatchUp_Downloader/Form1.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 32 additions & 3 deletions M3U_IPTV_CatchUp_Downloader/Form1.vb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Imports System.IO
Imports System.Net

Imports System.Text.RegularExpressions

Public Class Form1

Expand Down Expand Up @@ -38,12 +38,16 @@ Public Class Form1
My.Settings.EPG_URL = TextBox_EPG_URL.Text
My.Settings.M3U_URL = TextBox_M3U_URL.Text
My.Settings.DownloadPath = TextBox_Download_Path.Text
My.Settings.offset_a = TextBox_offset_a.Text
My.Settings.offset_b = TextBox_offset_b.Text
My.Settings.Save()
End Sub
Private Sub load_settings()
Dim M3U_URL As String = My.Settings.M3U_URL
Dim EPG_URL As String = My.Settings.EPG_URL
Dim DownloadPath As String = My.Settings.DownloadPath
Dim offset_a As String = My.Settings.offset_a
Dim offset_b As String = My.Settings.offset_b
TextBox_EPG_URL.Text = EPG_URL
TextBox_M3U_URL.Text = M3U_URL

Expand All @@ -53,6 +57,18 @@ Public Class Form1
TextBox_Download_Path.Text = DownloadPath
End If

If offset_a = "" Then
TextBox_offset_a.Text = 2
Else
TextBox_offset_a.Text = offset_a
End If
If offset_b = "" Then
TextBox_offset_b.Text = 2
Else
TextBox_offset_b.Text = offset_b
End If




M3U_URL_Download(TextBox_M3U_URL.Text)
Expand Down Expand Up @@ -304,13 +320,16 @@ Public Class Form1
Dim base_URL As String = ""
get_User_PW_Channel(channel_Nr, base_URL, USER, PW, URL)

Dim offset_a As Integer = TextBox_offset_a.Text
Dim offset_b As Integer = TextBox_offset_b.Text

'EPG Data
Dim start_time As DateTime = startTime(ListBox.SelectedIndex)
start_time = start_time.AddMinutes(-2) ' start x minutes before
start_time = start_time.AddMinutes(offset_b * -1) ' start x minutes before
Dim stop_time As DateTime = stopTime(ListBox.SelectedIndex)
title = Titles(ListBox.SelectedIndex)
Dim elapsedTime As TimeSpan = DateTime.Parse(stop_time).Subtract(start_time)
Dim elapsedTime_min As Integer = elapsedTime.TotalMinutes + 2 ' x minutes after
Dim elapsedTime_min As Integer = elapsedTime.TotalMinutes + offset_b ' x minutes after
start_time_str = start_time.ToString("yyyy-MM-dd:HH-mm")
'CatchUp URL
Dim timeshift_URL As String = base_URL & "/streaming/timeshift.php?username=" & USER & "&password=" & PW & "&stream=" & channel_Nr & "&start=" & start_time_str & "&duration=" & elapsedTime_min
Expand Down Expand Up @@ -446,4 +465,14 @@ Public Class Form1
Dim DownloadPath As String = FolderBrowserDialog_DownloadPath.SelectedPath
TextBox_Download_Path.Text = DownloadPath
End Sub

Private Sub TextBox_offset_b_TextChanged(sender As Object, e As EventArgs) Handles TextBox_offset_b.TextChanged
Dim digitsOnly As Regex = New Regex("[^\d]")
TextBox_offset_b.Text = digitsOnly.Replace(TextBox_offset_b.Text, "")
End Sub

Private Sub TextBox_offset_a_TextChanged(sender As Object, e As EventArgs) Handles TextBox_offset_a.TextChanged
Dim digitsOnly As Regex = New Regex("[^\d]")
TextBox_offset_a.Text = digitsOnly.Replace(TextBox_offset_a.Text, "")
End Sub
End Class
24 changes: 24 additions & 0 deletions M3U_IPTV_CatchUp_Downloader/My Project/Settings.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions M3U_IPTV_CatchUp_Downloader/My Project/Settings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,11 @@
<Setting Name="DownloadPath" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="offset_b" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="offset_a" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

0 comments on commit 869e7f1

Please sign in to comment.