Skip to content
This repository has been archived by the owner on Feb 21, 2023. It is now read-only.

Commit

Permalink
Add some additional error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarbuzzi committed Jan 15, 2021
1 parent 1ff254a commit b6f7082
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tvd.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func getAccessData(vodID int, clientID string) (AuthGQLResponse, error) {
}
if len(ar.Data.VideoPlaybackAccessToken.Signature) == 0 || len(ar.Data.VideoPlaybackAccessToken.Value) == 0 {
log.Printf("response: %s\n", rspData)
return ar, fmt.Errorf("error: sig and/or token were empty: %+v", ar)
return ar, fmt.Errorf("error: sig and/or token were empty; response body: %+v", ar)
}

log.Printf("access token: %+v\n", ar)
Expand Down Expand Up @@ -300,6 +300,7 @@ func getStreamOptions(vodID int, ar AuthGQLResponse) (map[string]string, error)

p, listType, err := m3u8.DecodeFrom(rsp.Body, true)
if err != nil {
log.Printf("failed to decode m3u8: %s\n", err.Error())
return nil, err
}

Expand All @@ -316,6 +317,7 @@ func getStreamOptions(vodID int, ar AuthGQLResponse) (map[string]string, error)

}
default:
log.Println("m3u8 playlist was not the expected 'master' format")
return nil, fmt.Errorf("m3u8 playlist was not the expected 'master' format")
}

Expand All @@ -342,6 +344,7 @@ func getChunks(streamURL string) ([]Chunk, int, error) {

p, listType, err := m3u8.DecodeFrom(rsp.Body, true)
if err != nil {
log.Printf("failed to decode m3u8: %s\n", err.Error())
return nil, 0, err
}

Expand All @@ -362,6 +365,7 @@ func getChunks(streamURL string) ([]Chunk, int, error) {
chunks = append(chunks, Chunk{Name: s.URI, Length: s.Duration, URL: chunkURL})
}
default:
log.Println("m3u8 playlist was not the expected 'media' format")
return nil, 0, fmt.Errorf("m3u8 playlist was not the expected 'media' format")
}

Expand Down

0 comments on commit b6f7082

Please sign in to comment.