Add useless info fields for backward compatibility

This commit is contained in:
Zoe Roux 2024-08-07 23:30:25 +02:00
parent fa6609eea9
commit 286f9f7ea8
2 changed files with 13 additions and 1 deletions

View File

@ -42,6 +42,9 @@ type MediaInfo struct {
/// Version of the metadata. This can be used to invalidate older metadata from db if the extraction code has changed.
Versions Versions `json:"versions"`
// TODO: remove on next major
Video Video `json:"video"`
/// The list of videos if there are multiples.
Videos []Video `json:"videos"`
/// The list of audio tracks.
@ -96,6 +99,9 @@ type Audio struct {
/// Keyframes of this video
Keyframes *Keyframe `json:"-"`
//TODO: remove this in next major
IsForced bool `json:"isForced"`
}
type Subtitle struct {
@ -318,5 +324,8 @@ func RetriveMediaInfo(path string, sha string) (*MediaInfo, error) {
ret.MimeCodec = &container
}
}
if len(ret.Videos) > 0 {
ret.Video = ret.Videos[0]
}
return &ret, nil
}

View File

@ -187,13 +187,16 @@ func (s *MetadataService) getMetadata(path string, sha string) (*MediaInfo, erro
}
for rows.Next() {
var c Chapter
err := rows.Scan(&c.StartTime, c.EndTime, c.Name, c.Type)
err := rows.Scan(&c.StartTime, &c.EndTime, &c.Name, &c.Type)
if err != nil {
return nil, err
}
ret.Chapters = append(ret.Chapters, c)
}
if len(ret.Videos) > 0 {
ret.Video = ret.Videos[0]
}
return &ret, nil
}