Remove invalid fonts array when there is no fonts

This commit is contained in:
Zoe Roux 2024-01-24 01:28:24 +01:00
parent c3e8f87562
commit 6ec387e724

View File

@ -195,6 +195,11 @@ func GetInfo(path string) (*MediaInfo, error) {
chapters_begin := ParseUint(mi.Parameter(mediainfo.StreamMenu, 0, "Chapters_Pos_Begin"))
chapters_end := ParseUint(mi.Parameter(mediainfo.StreamMenu, 0, "Chapters_Pos_End"))
attachments := strings.Split(mi.Parameter(mediainfo.StreamGeneral, 0, "Attachments"), " / ")
if len(attachments) == 1 && attachments[0] == "" {
attachments = make([]string, 0)
}
return &MediaInfo{
Sha: sha,
Path: path,
@ -260,7 +265,7 @@ func GetInfo(path string) (*MediaInfo, error) {
}
}),
Fonts: Map(
strings.Split(mi.Parameter(mediainfo.StreamGeneral, 0, "Attachments"), " / "),
attachments,
func(font string, _ int) string {
return fmt.Sprintf("/video/%s/attachment/%s", sha, font)
}),