Skip to content

Commit

Permalink
1.4 (#244)
Browse files Browse the repository at this point in the history
* recap & replay as default off the air games

- added recap feature for ended games
- replay set as default for live streams /w ended game (off the air)

closing issue #153

* 1.4 fix recap link when unavailable

* added proxy version to start

* 1.4.0

- added highlights
- re-added hosts support
- updated go-mlbam-proxy
- added hosts script go-mlbam-hosts
- fixed black screen issue when using the proxy and mpv player
- updated module spotify

close issue #243
close issue #153
close issue #237
close issue #228
close issue #229
close issue #233
  • Loading branch information
jwallet authored Apr 9, 2019
1 parent a36bcbd commit 1a97dcf
Show file tree
Hide file tree
Showing 32 changed files with 515 additions and 316 deletions.
422 changes: 221 additions & 201 deletions NHLGames/Controls/GameControl.Designer.vb

Large diffs are not rendered by default.

47 changes: 37 additions & 10 deletions NHLGames/Controls/GameControl.resx
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,12 @@
<metadata name="bpGameControl.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="flpSetRecording.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="btnRecap.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="btnLiveReplay.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="btnRecordOne.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lblGameStatus.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
Expand Down Expand Up @@ -2174,6 +2171,42 @@
<metadata name="lnkHome.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lnkAway.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lnkNational.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lnkFrench.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lnkThree.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lnkSix.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lnkEnd1.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lnkEnd2.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lnkRef.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lnkStar.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lblNotInSeason.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lblStreamStatus.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lnkHome.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<data name="lnkHome.BackgroundImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAAjQAAAKACAYAAACL0OJgAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
Expand Down Expand Up @@ -6217,12 +6250,6 @@
<metadata name="lnkStar.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lblNotInSeason.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="lblStreamStatus.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
Expand Down
30 changes: 23 additions & 7 deletions NHLGames/Controls/GameControl.vb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Namespace Controls
Private ReadOnly _showTeamCityAbr As Boolean
Private ReadOnly _showLiveTime As Boolean
Private ReadOnly _broadcasters As Dictionary(Of String, String)
Public LiveReplayCode As LiveStatusCodeEnum = LiveStatusCodeEnum.Live
Public LiveReplayCode As LiveStatusCodeEnum
Private _lnkUnknowns() As Button
Private _themeChar = "l"
Private _defaultBackColor = Color.FromArgb(224, 224, 224)
Expand Down Expand Up @@ -93,6 +93,8 @@ Namespace Controls
lblHomeScore.Visible = showScores
lblAwayScore.Visible = showScores
lblGameStatus.Visible = Not showScores
btnRecap.Visible = _game.Recap?.StreamUrl <> String.Empty
tt.SetToolTip(btnRecap, NHLGamesMetro.RmText.GetString("tipRecap"))

If _game.HomeScore < _game.AwayScore Then
lblHomeScore.ForeColor = Color.Gray
Expand All @@ -102,7 +104,7 @@ Namespace Controls

If showScores Then
lblPeriod.Text = gameState
If Not String.Equals(_game.GamePeriod, $"3rd", StringComparison.CurrentCultureIgnoreCase) And _game.GamePeriod <> "" Then
If Not String.Equals(_game.GamePeriod, $"3rd", StringComparison.CurrentCultureIgnoreCase) And _game.GamePeriod <> String.Empty Then
lblPeriod.Text = (gameState & $"/" &
_game.GamePeriod.
Replace($"OT", NHLGamesMetro.RmText.GetString("gamePeriodOt")).
Expand Down Expand Up @@ -274,20 +276,22 @@ Namespace Controls
Next
End If

If Not _game.IsUnplayable Then
If _game.GameState < GameStateEnum.Ended And _game.GameDate.ToLocalTime() <= Date.Today.AddDays(1) Then
If _game.IsUnplayable Then
bpGameControl.BorderColour = Color.DarkOrange
Else
If _game.IsTodaysGame Then
bpGameControl.BorderColour = Color.FromArgb(255, 0, 170, 210)
Else
bpGameControl.BorderColour = Color.FromArgb(255, 100, 100, 100)
End If
Else
bpGameControl.BorderColour = Color.DarkOrange
End If

UpdateGame(_showScores, _showLiveScores, _showSeriesRecord, _showTeamCityAbr, _showLiveTime)
End Sub

Private Sub SetWholeGamePanel()
LiveReplayCode = If(_game.IsOffTheAir, LiveStatusCodeEnum.Replay, LiveStatusCodeEnum.Live)

SetTeamLogo(picAway, $"{_game.AwayAbbrev}_{_themeChar}")
SetTeamLogo(picHome, $"{_game.HomeAbbrev}_{_themeChar}")

Expand Down Expand Up @@ -399,6 +403,15 @@ Namespace Controls
If Not args.Stream?.IsBroken Then Player.Watch(args)
End Sub

Private Sub btnRecap_Click(sender As Object, e As EventArgs) Handles btnRecap.Click
Dim args = WatchArgs()
args.GameDate = _game.GameDate
args.Stream = _game.Recap
args.GameTitle = _game.AwayAbbrev & " @ " & _game.HomeAbbrev
args.GameIsOnAir = False
Player.Watch(args)
End Sub

Private Sub lnkAway_Click(sender As Object, e As EventArgs) Handles lnkAway.Click
WatchStream(StreamTypeEnum.Away)
End Sub
Expand Down Expand Up @@ -471,6 +484,7 @@ Namespace Controls
If lnkStar IsNot Nothing Then lnkStar.Dispose()
If lblNotInSeason IsNot Nothing Then lblNotInSeason.Dispose()
If lblStreamStatus IsNot Nothing Then lblStreamStatus.Dispose()
If btnRecap IsNot Nothing Then btnRecap.Dispose()
If bpGameControl IsNot Nothing Then
bpGameControl.Controls.Clear()
bpGameControl.Dispose()
Expand All @@ -496,7 +510,7 @@ Namespace Controls
flpStreams.BackColor = Color.FromArgb(80, 80, 80)
lblPeriod.BackColor = Color.FromArgb(80, 80, 80)
lblStreamStatus.BackColor = Color.FromArgb(80, 80, 80)
lblStreamStatus.ForeColor = Color.LightGray
lblStreamStatus.ForeColor = Color.LightGray
lblAwayTeam.Theme = MetroThemeStyle.Dark
lblHomeTeam.Theme = MetroThemeStyle.Dark
lblGameStatus.Theme = MetroThemeStyle.Dark
Expand All @@ -505,6 +519,7 @@ Namespace Controls
lblHomeScore.ForeColor = Color.LightGray
lblNotInSeason.Theme = MetroThemeStyle.Dark
lblDivider.BackColor = Color.Black
btnRecap.FlatAppearance.BorderColor = Color.LightGray
For Each lnk In New Button() {lnkHome, lnkAway, lnkFrench, lnkNational, lnkEnd1, lnkEnd2, lnkRef, lnkStar, lnkThree, lnkSix}
lnk.FlatAppearance.BorderColor = Color.FromArgb(80, 80, 80)
lnk.FlatAppearance.MouseOverBackColor = Color.FromArgb(100, 100, 100)
Expand All @@ -524,6 +539,7 @@ Namespace Controls
lnkStar.BackgroundImage = ImageFetcher.GetEmbeddedImage("cam_star")
lnkThree.BackgroundImage = ImageFetcher.GetEmbeddedImage("cam3way")
lnkSix.BackgroundImage = ImageFetcher.GetEmbeddedImage("cam6way")
btnRecap.BackgroundImage = ImageFetcher.GetEmbeddedImage($"recap_{_themeChar}")
End Sub
End Class
End Namespace
8 changes: 6 additions & 2 deletions NHLGames/English.resx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
<comment>Game panel</comment>
</data>
<data name="lblOutput" xml:space="preserve">
<value>Save as</value>
<value>Output</value>
<comment>Settings tab</comment>
</data>
<data name="lblPlayer" xml:space="preserve">
Expand Down Expand Up @@ -910,7 +910,7 @@
<comment>Console</comment>
</data>
<data name="msgProxyStarting" xml:space="preserve">
<value>MLBAMProxy: Proxy is getting ready</value>
<value>MLBAMProxy: Proxy {0} is getting ready</value>
<comment>Console</comment>
</data>
<data name="msgProxyGettingReady" xml:space="preserve">
Expand Down Expand Up @@ -973,4 +973,8 @@
<value>Server unavailable</value>
<comment>Game panel</comment>
</data>
<data name="tipRecap" xml:space="preserve">
<value>Recap</value>
<comment>Game panel</comment>
</data>
</root>
13 changes: 11 additions & 2 deletions NHLGames/English1.Designer.vb

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

11 changes: 10 additions & 1 deletion NHLGames/French.Designer.vb

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

6 changes: 5 additions & 1 deletion NHLGames/French.resx
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,11 @@
<comment>Game panel</comment>
</data>
<data name="lblOutput" xml:space="preserve">
<value>Enregistrer sous</value>
<value>Sauvegarde</value>
<comment>Settings tab</comment>
</data>
<data name="tipRecap" xml:space="preserve">
<value>Résumé</value>
<comment>Game panel</comment>
</data>
</root>
4 changes: 4 additions & 0 deletions NHLGames/NHLGames.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,10 @@
<ItemGroup>
<EmbeddedResource Include="nhlgames.ico" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="res\images\recap_d.png" />
<EmbeddedResource Include="res\images\recap_l.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
3 changes: 2 additions & 1 deletion NHLGames/NHLGamesMetro.Designer.vb

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

9 changes: 7 additions & 2 deletions NHLGames/NHLGamesMetro.vb
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ Public Class NHLGamesMetro
Public Shared Tips As New Dictionary(Of Integer, String)
Public Shared MLBAMProxy As Proxy
Public Shared IsServerUp As Boolean = Nothing
Public ProxyListening As Task(Of Boolean) = Nothing
Public IsProxyListening As Task(Of Boolean) = Nothing
Public Shared IsHostsRedirectionSet As Boolean = False

<SecurityPermission(SecurityAction.Demand, Flags:=SecurityPermissionFlag.ControlAppDomain)>
Public Shared Sub Main()
Expand Down Expand Up @@ -79,7 +80,11 @@ Public Class NHLGamesMetro
FlpCalendar = flpCalendarPanel
InitializeForm.SetSettings()

MLBAMProxy = New Proxy()
If Proxy.TestHostsEntry() Then
IsHostsRedirectionSet = True
Else
MLBAMProxy = New Proxy()
End If

Await Common.CheckAppCanRun()

Expand Down
17 changes: 15 additions & 2 deletions NHLGames/Objects/Game.vb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Namespace Objects
Private _disposedValue As Boolean

Public Property StreamsDict As Dictionary(Of StreamTypeEnum, GameStream)
Public Property Recap As GameStream
Public Property StreamsUnknown As List(Of GameStream)
Public Property GameId As String
Public Property GameType As GameTypeEnum 'Get type of the game : 1 preseason, 2 regular, 3 series
Expand Down Expand Up @@ -39,6 +40,12 @@ Namespace Objects
Return String.Format(NHLGamesMetro.RmText.GetString("msgTeamVsTeam"), HomeTeam, AwayTeam)
End Function

Public ReadOnly Property IsTodaysGame As Boolean
Get
Return GameState < GameStateEnum.StreamEnded AndAlso GameDate.ToLocalTime() <= Date.Today.AddDays(1)
End Get
End Property

Public ReadOnly Property IsLive As Boolean
Get
Return GameState.Equals(GameStateEnum.InProgress) OrElse
Expand All @@ -50,8 +57,7 @@ Namespace Objects

Public ReadOnly Property IsOffTheAir As Boolean
Get
Return GameState.Equals(GameStateEnum.OffTheAir) OrElse
GameState.Equals(GameStateEnum.StreamEnded)
Return GameState.Equals(GameStateEnum.OffTheAir)
End Get
End Property

Expand All @@ -67,6 +73,13 @@ Namespace Objects
End Get
End Property

Public ReadOnly Property IsEnded As Boolean
Get
Return GameState.Equals(GameStateEnum.OffTheAir) OrElse
GameState.Equals(GameStateEnum.StreamEnded)
End Get
End Property

Public ReadOnly Property AreAnyStreamsAvailable As Boolean
Get
Return ((StreamsDict IsNot Nothing AndAlso StreamsDict.Count > 0) OrElse (StreamsUnknown IsNot Nothing AndAlso StreamsUnknown.Count > 0)) AndAlso Not IsUnplayable
Expand Down
Loading

0 comments on commit 1a97dcf

Please sign in to comment.