move ffmpeg command to seperate table
This commit is contained in:
parent
72dfd2408f
commit
cdeb266e38
20 changed files with 245 additions and 84 deletions
|
@ -20,12 +20,12 @@ func RunHealthCheck(conf config.Config, t *types.Task, data types.HealthCheckDat
|
|||
path := filepath.Join(conf.Worker.TempDir, fmt.Sprintf("%v-%v.mkv", t.ID, t.FileID))
|
||||
|
||||
// Set ffmpeg input path
|
||||
if len(data.Command.InputFiles) == 0 {
|
||||
l.ErrorContext(ctx, "FFmpeg Command has no input files")
|
||||
if len(t.FfmpegCommand.InputFiles) == 0 {
|
||||
l.ErrorContext(ctx, "FFmpeg Command has no input files", "command", t.FfmpegCommand)
|
||||
return
|
||||
}
|
||||
|
||||
data.Command.InputFiles[0].Path = path
|
||||
t.FfmpegCommand.InputFiles[0].Path = path
|
||||
|
||||
// TODO cleanup file when done
|
||||
defer func() {
|
||||
|
@ -43,7 +43,7 @@ func RunHealthCheck(conf config.Config, t *types.Task, data types.HealthCheckDat
|
|||
return
|
||||
}
|
||||
|
||||
err = runFfmpegCommand(ctx, l, conf, data.Command)
|
||||
err = runFfmpegCommand(ctx, l, conf, t.FfmpegCommand)
|
||||
if err != nil {
|
||||
l.ErrorContext(ctx, "FFmpeg Failed", "err", err)
|
||||
return
|
||||
|
|
|
@ -18,10 +18,11 @@ func StartTask(conf config.Config, data types.TaskStart) error {
|
|||
defer taskMutex.Unlock()
|
||||
|
||||
tasks[data.ID] = &types.Task{
|
||||
ID: data.ID,
|
||||
Type: data.Type,
|
||||
FileID: data.FileID,
|
||||
FileMD5: data.FileMD5,
|
||||
ID: data.ID,
|
||||
Type: data.Type,
|
||||
FileID: data.FileID,
|
||||
FileMD5: data.FileMD5,
|
||||
FfmpegCommand: data.FfmpegCommand,
|
||||
}
|
||||
|
||||
switch data.Type {
|
||||
|
|
|
@ -21,20 +21,20 @@ func RunTranscode(conf config.Config, t *types.Task, data types.TranscodeData) {
|
|||
dst_path := filepath.Join(conf.Worker.TempDir, fmt.Sprintf("dst-%v-%v.mkv", t.ID, t.FileID))
|
||||
|
||||
// Set ffmpeg input path
|
||||
if len(data.Command.InputFiles) == 0 {
|
||||
l.ErrorContext(ctx, "FFmpeg Command has no input files")
|
||||
if len(t.FfmpegCommand.InputFiles) == 0 {
|
||||
l.ErrorContext(ctx, "FFmpeg Command has no input files", "command", t.FfmpegCommand)
|
||||
return
|
||||
}
|
||||
|
||||
data.Command.InputFiles[0].Path = src_path
|
||||
t.FfmpegCommand.InputFiles[0].Path = src_path
|
||||
|
||||
// Set ffmpeg output path
|
||||
if len(data.Command.OutputFiles) == 0 {
|
||||
l.ErrorContext(ctx, "FFmpeg Command has no output files")
|
||||
if len(t.FfmpegCommand.OutputFiles) == 0 {
|
||||
l.ErrorContext(ctx, "FFmpeg Command has no output files", "command", t.FfmpegCommand)
|
||||
return
|
||||
}
|
||||
|
||||
data.Command.OutputFiles[0].Path = dst_path
|
||||
t.FfmpegCommand.OutputFiles[0].Path = dst_path
|
||||
|
||||
// TODO cleanup file when done
|
||||
defer func() {
|
||||
|
@ -62,7 +62,7 @@ func RunTranscode(conf config.Config, t *types.Task, data types.TranscodeData) {
|
|||
}
|
||||
}()
|
||||
|
||||
err = runFfmpegCommand(ctx, l, conf, data.Command)
|
||||
err = runFfmpegCommand(ctx, l, conf, t.FfmpegCommand)
|
||||
if err != nil {
|
||||
l.ErrorContext(ctx, "FFmpeg Failed", "err", err)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue