Support Other fully.

master v0.0.12
Stein Ivar Berghei 2023-08-11 18:51:40 +02:00
parent 74fdf1601a
commit b81c62af15
1 changed files with 8 additions and 0 deletions

View File

@ -45,6 +45,7 @@ func (u *Match) UnmarshalJSON(data []byte) error {
type Alias Match type Alias Match
aux := &struct { aux := &struct {
AudioCodec interface{} `json:"audio_codec,omitempty"` AudioCodec interface{} `json:"audio_codec,omitempty"`
Other interface{} `json:"other,omitempty"`
*Alias *Alias
}{ }{
Alias: (*Alias)(u), Alias: (*Alias)(u),
@ -61,6 +62,13 @@ func (u *Match) UnmarshalJSON(data []byte) error {
u.AudioCodec = ac u.AudioCodec = ac
} }
switch oth := aux.AudioCodec.(type) {
case string:
u.AudioCodec = append(u.AudioCodec, oth)
case []string:
u.AudioCodec = oth
}
return nil return nil
} }