parent
95c0ba95cc
commit
294d179089
26
guessit.go
26
guessit.go
|
@ -35,12 +35,36 @@ type Match struct {
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
AudioChannels string `json:"audio_channels,omitempty"`
|
AudioChannels string `json:"audio_channels,omitempty"`
|
||||||
AudioCodec string `json:"audio_codec,omitempty"`
|
AudioCodec []string `json:"audio_codec,omitempty"`
|
||||||
|
|
||||||
// Other
|
// Other
|
||||||
Other []string `json:"other,omitempty"`
|
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) {
|
func (g GuessitConfig) PipInstall() (err error) {
|
||||||
args := []string{"-m", "pip", "install", "guessit"}
|
args := []string{"-m", "pip", "install", "guessit"}
|
||||||
cmd := exec.Command(g.Python, args...)
|
cmd := exec.Command(g.Python, args...)
|
||||||
|
|
Loading…
Reference in New Issue