Go Gettable, Setting output path also from mediafile

This commit is contained in:
Rohit Garg
2018-05-23 14:44:14 +05:30
parent f0143213f2
commit 65793ce83b
5 changed files with 41 additions and 28 deletions

View File

@@ -3,11 +3,11 @@ package transcoder
import (
"errors"
"os"
"goffmpeg/models"
"github.com/xfrr/goffmpeg/models"
"os/exec"
"fmt"
"goffmpeg/ffmpeg"
"goffmpeg/utils"
"github.com/xfrr/goffmpeg/ffmpeg"
"github.com/xfrr/goffmpeg/utils"
"bytes"
"encoding/json"
"bufio"
@@ -18,7 +18,6 @@ import (
type Transcoder struct {
process *exec.Cmd
outputPath string
mediafile *models.Mediafile
configuration ffmpeg.Configuration
}
@@ -27,10 +26,6 @@ func (t *Transcoder) SetProccess(v *exec.Cmd) {
t.process = v
}
func (t *Transcoder) SetOutputPath(v string) {
t.outputPath = v
}
func (t *Transcoder) SetMediaFile(v *models.Mediafile) {
t.mediafile = v
}
@@ -45,10 +40,6 @@ func (t Transcoder) Process() *exec.Cmd {
return t.process
}
func (t Transcoder) OutputPath() string {
return t.outputPath
}
func (t Transcoder) MediaFile() *models.Mediafile {
return t.mediafile
}
@@ -70,8 +61,6 @@ func (t Transcoder) GetCommand() string {
rcommand += media.ToStrCommand()
rcommand += " \"" + t.outputPath + "\""
return rcommand
}
@@ -126,9 +115,9 @@ func (t *Transcoder) Initialize(inputPath string, outputPath string) (error) {
MediaFile := new(models.Mediafile)
MediaFile.SetMetadata(Metadata)
MediaFile.SetInputPath(inputPath)
MediaFile.SetOutputPath(outputPath)
// Set transcoder configuration
t.SetOutputPath(outputPath)
t.SetMediaFile(MediaFile)
t.SetConfiguration(configuration)