jfreymuth/pulse

Structs Source && Sync have unexported field

Opened this issue · 0 comments

Hi. Why this struct fields leave unexported?

pulse/source.go

Lines 5 to 8 in 75628da

// A Source is an input device.
type Source struct {
info proto.GetSourceInfoReply
}

pulse/sink.go

Lines 5 to 8 in 75628da

// A Sink is an output device.
type Sink struct {
info proto.GetSinkInfoReply
}

For i.e. i want get sink properties like this:

func main() {

  client, err := pulse.NewClient()
  defer client.Close()
  sources, err := client.ListSources()
....
  for _, source := range sources {
		if isBluetoothDevice(client, source) {
			fmt.Printf("device name: %s", source.Name)
			fmt.Println("----------")
		}
    }
} 
func isBluetoothDevice(device interface{}) bool {
	switch device := device.(type) {
	case *pulse.Source:
		_, ok := device.Properties["device.api"]
		if device.(pulse.Source).info.Properties["device.api"] == "bluez"
			return true
		.....
	default:
		return false
	}
}

But field info unexported 😞