func (sdb *SiftDB) expandMediaPlayerSpecs(le *types.MediaPlayer) error { specs, err := sdb.getMediaPlayerSpecs(le.Make, le.Model) if err != nil { return err } le.Specs = specs return nil }
func getMediaPlayerTx(tx *sqlx.Tx, dbc Component, exFlags ExpansionFlags) (types.MediaPlayer, error) { dbMP, err := getDBMediaPlayerTx(tx, dbc.ID, dbc, exFlags) if err != nil { return types.MediaPlayer{}, fmt.Errorf("error getting media player with id %v: %v", dbc.ID, err) } mp := types.MediaPlayer{ BaseComponent: dbToBaseComponent(dbc), State: types.MediaPlayerState{ PlayState: dbMP.PlayState, MediaType: dbMP.MediaType, Source: dbMP.Source, }, } if exFlags&(ExpandAll|exFlags&ExpandSpecs) != 0 { mp.Specs = &types.MediaPlayerSpecs{ SupportedAudioTypes: dbMP.SupportedAudioTypes, SupportedVideoTypes: dbMP.SupportedVideoTypes, } } return mp, nil }