parent
95c0ba95cc
commit
294d179089
28
guessit.go
28
guessit.go
|
@ -34,13 +34,37 @@ type Match struct {
|
|||
Container string `json:"container,omitempty"`
|
||||
|
||||
// Audio
|
||||
AudioChannels string `json:"audio_channels,omitempty"`
|
||||
AudioCodec string `json:"audio_codec,omitempty"`
|
||||
AudioChannels string `json:"audio_channels,omitempty"`
|
||||
AudioCodec []string `json:"audio_codec,omitempty"`
|
||||
|
||||
// Other
|
||||
Other []string `json:"other,omitempty"`
|
||||
}
|
||||
|
||||
func (u *Match) UnmarshalJSON(data []byte) error {
|
||||
fmt.Println(u)
|
||||
type Alias Match
|
||||
aux := &struct {
|
||||
AudioCodec interface{} `json:"audio_codec,omitempty"`
|
||||
*Alias
|
||||
}{
|
||||
Alias: (*Alias)(u),
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(data, &aux); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
switch ac := aux.AudioCodec.(type) {
|
||||
case string:
|
||||
u.AudioCodec = append(u.AudioCodec, ac)
|
||||
case []string:
|
||||
u.AudioCodec = ac
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g GuessitConfig) PipInstall() (err error) {
|
||||
args := []string{"-m", "pip", "install", "guessit"}
|
||||
cmd := exec.Command(g.Python, args...)
|
||||
|
|
Loading…
Reference in New Issue