Compare commits
3 Commits
Author | SHA1 | Date |
---|---|---|
|
c4f1163a94 | |
|
7b4bf1563c | |
|
7d34e678ac |
11
guessit.go
11
guessit.go
|
@ -15,6 +15,7 @@ type GuessitConfig struct {
|
||||||
|
|
||||||
type Guessit struct {
|
type Guessit struct {
|
||||||
GuessitConfig
|
GuessitConfig
|
||||||
|
DefaultOptions []string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Match struct {
|
type Match struct {
|
||||||
|
@ -32,6 +33,7 @@ type Match struct {
|
||||||
// Video
|
// Video
|
||||||
ScreenSize string `json:"screen_size,omitempty"`
|
ScreenSize string `json:"screen_size,omitempty"`
|
||||||
Container string `json:"container,omitempty"`
|
Container string `json:"container,omitempty"`
|
||||||
|
VideoCodec string `json:"video_codec,omitempty"`
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
AudioChannels string `json:"audio_channels,omitempty"`
|
AudioChannels string `json:"audio_channels,omitempty"`
|
||||||
|
@ -62,11 +64,11 @@ func (u *Match) UnmarshalJSON(data []byte) error {
|
||||||
u.AudioCodec = ac
|
u.AudioCodec = ac
|
||||||
}
|
}
|
||||||
|
|
||||||
switch oth := aux.AudioCodec.(type) {
|
switch oth := aux.Other.(type) {
|
||||||
case string:
|
case string:
|
||||||
u.AudioCodec = append(u.AudioCodec, oth)
|
u.Other = append(u.Other, oth)
|
||||||
case []string:
|
case []string:
|
||||||
u.AudioCodec = oth
|
u.Other = oth
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -104,11 +106,12 @@ func New(conf GuessitConfig) (Guessit, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Guessit{conf}, nil
|
return Guessit{conf, []string{}}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g Guessit) Guessit(s string, options ...string) (out Match, err error) {
|
func (g Guessit) Guessit(s string, options ...string) (out Match, err error) {
|
||||||
args := []string{"-m", "guessit", s}
|
args := []string{"-m", "guessit", s}
|
||||||
|
args = append(args, g.DefaultOptions...)
|
||||||
args = append(args, options...)
|
args = append(args, options...)
|
||||||
args = append(args, "--json")
|
args = append(args, "--json")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue