Clip and Video share VideoFile

This commit is contained in:
Carl Pearson
2024-11-05 05:39:49 -07:00
parent 41d69c2fa4
commit ad7445b6f6
3 changed files with 27 additions and 13 deletions

View File

@@ -654,16 +654,18 @@ func startDownload(originalID uint, videoURL string, audioOnly bool) {
}
video := media.Video{
MediaFile: media.MediaFile{
Length: mediaMeta.length,
Size: mediaMeta.size,
Filename: dlFilename,
VideoFile: media.VideoFile{
MediaFile: media.MediaFile{
Length: mediaMeta.length,
Size: mediaMeta.size,
Filename: dlFilename,
},
FPS: mediaMeta.fps,
Width: mediaMeta.width,
Height: mediaMeta.height,
},
OriginalID: originalID,
Source: "original",
FPS: mediaMeta.fps,
Width: mediaMeta.width,
Height: mediaMeta.height,
}
log.Debugln("create Video", video)
if db.Create(&video).Error != nil {

View File

@@ -19,6 +19,13 @@ type MediaFile struct {
Filename string
}
type VideoFile struct {
MediaFile
Width uint
Height uint
FPS float64
}
type Audio struct {
gorm.Model
MediaFile
@@ -30,11 +37,14 @@ type Audio struct {
type Video struct {
gorm.Model
MediaFile
VideoFile
OriginalID uint // Original.ID
Source string // "original", "transcode"
Width uint
Height uint
FPS float64
Status Status
}
type Clip struct {
gorm.Model
VideoFile
OriginalID uint // Original.ID
}

View File

@@ -81,8 +81,10 @@ func videoToVideo(sem chan struct{}, transID uint, srcFilepath string) {
// create video record
video := media.Video{
MediaFile: media.MediaFile{
Filename: dstFilename,
VideoFile: media.VideoFile{
MediaFile: media.MediaFile{
Filename: dstFilename,
},
},
OriginalID: orig.ID, Source: "transcode",
}