Skip to content

Commit

Permalink
Added F1 Live Channel
Browse files Browse the repository at this point in the history
- Rudimentary fix for SoMuchForSubtlety#218
  • Loading branch information
MarkusTheOrt committed Mar 25, 2022
1 parent 1da537d commit bdf4178
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 15 deletions.
30 changes: 17 additions & 13 deletions internal/ui/nodeV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,23 +101,27 @@ func (s *UIState) v2PerspectiveNodes(v f1tv.ContentContainer) []*tview.TreeNode
SetColor(color).
SetReference(&NodeMetadata{nodeType: PlayableNode, metadata: meta2})


node.SetSelectedFunc(func() {
node.SetSelectedFunc(nil)
playbackNodes := s.getPlaybackNodes(meta2, func() (string, error) { return s.v2.GetPerspectivePlaybackURL(f1tv.BIG_SCREEN_HLS, p.PlaybackURL) })
appendNodes(node, playbackNodes...)
})
perspectives[i+1] = node
switch(p.PrettyName()) {
case "World Feed":
perspectives[0] = node
break
case "F1 Live":
case "Pit Lane":
perspectives[1] = node
break
case "Data Channel":
perspectives[2] = node
break
default:
perspectives[i] = node
}
}
node := tview.NewTreeNode("World Feed").
SetColor(activeTheme.ItemNodeColor).
SetReference(&NodeMetadata{nodeType: PlayableNode, metadata: meta})
node.SetSelectedFunc(func() {
node.SetSelectedFunc(nil)
playbackNodes := s.getPlaybackNodes(meta, func() (string, error) { return s.v2.GetPlaybackURL(f1tv.BIG_SCREEN_HLS, v.Metadata.ContentID) })
appendNodes(node, playbackNodes...)
})
perspectives[0] = node

multicommands := s.v2MultiCommandNodes(streams, v)

return append(multicommands, perspectives...)
Expand Down Expand Up @@ -210,14 +214,14 @@ func findPerspectiveByName(name string, perspectives []f1tv.AdditionalStream, ma
return nil, &perspective, nil
}
}
if strings.EqualFold(name, "World Feed") {
if strings.EqualFold(name, "F1 Live") {
return &mainStream, nil, nil
}
r, err := regexp.Compile(name)
if err != nil {
return nil, nil, notFound
}
if r.MatchString("World Feed") {
if r.MatchString("F1 Live") {
return &mainStream, nil, nil
}
return nil, nil, notFound
Expand Down
6 changes: 5 additions & 1 deletion pkg/f1tv/v2/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const (

playbackRequestPath = "/1.0/R/ENG/%v/ALL/CONTENT/PLAY?contentId=%d"
playbackPerspectiveRequestPath = "/1.0/R/ENG/%v/ALL/%s"
contentDetailsPath = "/2.0/R/ENG/%v/ALL/CONTENT/VIDEO/%d/F1_TV_Pro_Annual/14"
contentDetailsPath = "/3.0/R/ENG/%v/ALL/CONTENT/VIDEO/%d/F1_TV_Pro_Annual/14"
categoryPagePath = "/2.0/R/ENG/%v/ALL/PAGE/%v/F1_TV_Pro_Annual/2"

apiKey = "fCUCjWrKPu9ylJwRAv8BpGLEgiAuThx7"
Expand Down Expand Up @@ -217,6 +217,10 @@ func (f *F1TV) GetPageContent(id PageID) ([]TopContainer, []RemoteContent, error

func (s AdditionalStream) PrettyName() string {
switch s.Title {
case "F1 LIVE":
return "F1 Live"
case "INTERNATIONAL":
return "World Feed"
case "PIT LANE":
return "Pit Lane"
case "TRACKER":
Expand Down
2 changes: 1 addition & 1 deletion pkg/f1tv/v2/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func Test_assbmleURL(t *testing.T) {
urlPath: contentDetailsPath,
format: WEB_DASH,
args: []interface{}{1000003910},
result: "https://f1tv.formula1.com/2.0/R/ENG/WEB_DASH/ALL/CONTENT/VIDEO/1000003910/F1_TV_Pro_Annual/14",
result: "https://f1tv.formula1.com/3.0/R/ENG/WEB_DASH/ALL/CONTENT/VIDEO/1000005112/F1_TV_Pro_Annual/14",
},
}

Expand Down

0 comments on commit bdf4178

Please sign in to comment.