Probe.FullTags()

This commit is contained in:
Dan Jones 2023-09-08 21:31:13 -05:00
commit c9498340d0
4 changed files with 28 additions and 1 deletions

View file

@ -1,9 +1,11 @@
package media
import (
"encoding/json"
"codeberg.org/danjones000/strip-beats/config"
"codeberg.org/danjones000/strip-beats/utils"
"encoding/json"
"dario.cat/mergo"
"github.com/akrennmair/slice"
ffmpeg "github.com/u2takey/ffmpeg-go"
)
@ -141,6 +143,22 @@ type Tags struct {
Track string
}
func (pr Probe) FullTags() Tags {
t := pr.Format.Tags
s := pr.WantedAudioStream()
if s != nil {
mergo.Merge(&t, s.Tags)
}
for _, st := range pr.Streams {
mergo.Merge(&t, st.Tags)
}
return t
}
func (pr Probe) Title() string {
return pr.FullTags().Title
}
func ProbeFile(path string) Probe {
out, err := ffmpeg.Probe(path)
if err != nil {