Skip to content

Commit

Permalink
1.5.1 Recover old streams (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwallet authored Jun 23, 2021
1 parent d17698c commit 530c025
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
15 changes: 10 additions & 5 deletions NHLGames/Objects/GameManager.vb
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,16 @@ Namespace Objects

Dim streamUrlReturned = Await Common.SendWebRequestAndGetContentAsync(gameStream.GameUrl)

'If gameStream.Game.GameDate.ToLocalTime() < DateTime.Now.AddDays(-1) Then
' Dim matches = Regex.Match(streamUrlReturned.Replace("hlslive", "hslvod"), "(.*nhl.com)(.*)(\/[a-z]{2}[0-9]{2}\/nhl\/.*)").Groups
' If matches.Count < 4 Then Return streamUrlReturned
' streamUrlReturned = $"{matches(1)}{matches(3)}"
'End If
' Recover old streams
If gameStream.Game.GameDate.ToLocalTime() < DateTime.Today.AddDays(-2) And streamUrlReturned.StartsWith("https://hlslive") Then
Dim network = gameStream.CdnParameter.ToString().ToLower()
Dim newServerUrl = streamUrlReturned _
.Replace($"hlslive-{network}.med2.med", $"hlslive-{network}.med") _
.Replace($"hlslive-{network}", $"vod-{network}-na1")
Dim matches = Regex.Match(newServerUrl, "(.*nhl.com)(.*)(\/[a-z]{2}[0-9]{2}\/)(nhl\/.*)").Groups
If matches.Count < 5 Then Return streamUrlReturned
streamUrlReturned = $"{matches(1)}/ps01/{matches(4)}"
End If

If streamUrlReturned.Equals(String.Empty) Then Return String.Empty

Expand Down
5 changes: 1 addition & 4 deletions NHLGames/Objects/GameStream.vb
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ Namespace Objects
If type = StreamTypeEnum.Unknown Then
Me.StreamTypeSelected = streamTypeSelected
End If
CdnParameter = If(game.IsEnded,
CdnTypeEnum.Akc,
ApplicationSettings.Read(Of GameWatchArguments)(SettingsEnum.DefaultWatchArgs,
New GameWatchArguments).Cdn)
CdnParameter = ApplicationSettings.Read(Of GameWatchArguments)(SettingsEnum.DefaultWatchArgs, New GameWatchArguments).Cdn
GameUrl = $"http://{NHLGamesMetro.HostName}/getM3U8.php?league=NHL&id={PlayBackId}&cdn={CdnParameter.ToString().ToLower()}&date={DateHelper.GetPacificTime(game.GameDate).ToString("yyyy-MM-dd")}"
Title = $"{game.AwayAbbrev} vs {game.HomeAbbrev} on {Network}"
End Sub
Expand Down
4 changes: 2 additions & 2 deletions NHLGames/res/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("1.5.0.0")>
<Assembly: AssemblyFileVersion("1.5.0.0")>
<Assembly: AssemblyVersion("1.5.1.0")>
<Assembly: AssemblyFileVersion("1.5.1.0")>
<Assembly: NeutralResourcesLanguage("en-CA")>

0 comments on commit 530c025

Please sign in to comment.