Skip to content

Commit

Permalink
add better logging for debug
Browse files Browse the repository at this point in the history
  • Loading branch information
iloveicedgreentea committed Aug 28, 2023
1 parent b1628cf commit 0b3251b
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
13 changes: 13 additions & 0 deletions ezbeq/ezbeq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,19 @@ func TestSearchCatalog(t *testing.T) {
expectedDigest: "f7e8c32e58b372f1ea410165607bc1f6b3f589a832fda87edaa32a17715438f7",
expectedMvAdjust: 0.0,
},
{
// spiderman universe
m: models.SearchRequest{
TMDB: "56292",
Year: 2011,
Codec: "TrueHD 7.1",
PreferredAuthor: "none",
Edition: "",
},
expectedEdition: "",
expectedDigest: "f7e8c32e58b372f1ea410165607bc1f6b3f589a832fda87edaa32a17715438f7",
expectedMvAdjust: 0.0,
},
}

for _, tc := range tt {
Expand Down
3 changes: 2 additions & 1 deletion handlers/plex_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ func waitForHDMISync(wg *sync.WaitGroup, skipActions *bool, haClient *homeassist
log.Debug("Running HDMI sync wait")
defer func() {
// play item no matter what
// TODO: fix plex api
err := PlexClient.PlayPlex()
if err != nil {
log.Errorf("Error playing plex: %v", err)
Expand Down Expand Up @@ -239,7 +240,7 @@ func mediaPlay(client *plex.PlexClient, vip *viper.Viper, beqClient *ezbeq.BeqCl
// if not using denoncodec, do this in background
if !useDenonCodec {
wg.Add(1)
// TODO: get this working
// TODO: test this
// sets skipActions to false on completion
go waitForHDMISync(wg, skipActions, haClient, client, vip)
}
Expand Down
13 changes: 11 additions & 2 deletions plex/plex.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ type PlexClient struct {
Port string
HTTPClient http.Client
ImdbClient *http.Client
MachineID string
MediaType string
// TODO: set this as input in config? d90a13e4567bf9eaa3999225997a32d65ee38d6f
MachineID string
MediaType string
}

// return a new instance of a plex client
Expand Down Expand Up @@ -260,10 +261,18 @@ func (c *PlexClient) GetAudioCodec(data models.MediaContainer) (string, error) {
// loop instead of index because of edge case with two or more video streams
for _, val := range data.Video.Media.Part.Stream {
if val.StreamType == "2" {
log.Debugf("Found codecs: %s, %s", val.DisplayTitle, val.ExtendedDisplayTitle)
return MapPlexToBeqAudioCodec(val.DisplayTitle, val.ExtendedDisplayTitle), nil
}
}

if plexAudioCodec == "" {
log.Error("did not find codec from plex metadata")
log.Error("Dumping stream data")
log.Error(data.Video.Media.Part.Stream)
return "", errors.New("no codec found")
}

return plexAudioCodec, nil
}

Expand Down

0 comments on commit 0b3251b

Please sign in to comment.