feat(meta): allow read tags from streams

This commit is contained in:
Unlock Music Dev 2022-12-06 01:32:02 +08:00
parent 9856f52070
commit 3857ba91a6
No known key found for this signature in database
GPG Key ID: 95202E10D3413A1D

View File

@ -27,6 +27,17 @@ func (r *Result) getTagByKey(key string) string {
return v
}
}
for _, stream := range r.Streams { // try to find in streams
if stream.CodecType != "audio" {
continue
}
for k, v := range stream.Tags {
if key == strings.ToLower(k) {
return v
}
}
}
return ""
}
func (r *Result) GetTitle() string {
@ -81,6 +92,7 @@ type Stream struct {
StartTime string `json:"start_time"`
BitRate string `json:"bit_rate"`
Disposition *ProbeDisposition `json:"disposition"`
Tags map[string]string `json:"tags"`
}
type ProbeDisposition struct {