|
|
@ -1,14 +1,8 @@ |
|
|
|
package config |
|
|
|
package config |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
|
|
|
|
"os/exec" |
|
|
|
|
|
|
|
"strings" |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func getDefaults() config { |
|
|
|
func getDefaults() config { |
|
|
|
defaults := config{} |
|
|
|
defaults := config{} |
|
|
|
defaults.WebServerPort = 8080 |
|
|
|
defaults.WebServerPort = 8080 |
|
|
|
defaults.FFMpegPath = getDefaultFFMpegPath() |
|
|
|
|
|
|
|
defaults.VideoSettings.ChunkLengthInSeconds = 4 |
|
|
|
defaults.VideoSettings.ChunkLengthInSeconds = 4 |
|
|
|
defaults.Files.MaxNumberInPlaylist = 5 |
|
|
|
defaults.Files.MaxNumberInPlaylist = 5 |
|
|
|
defaults.YP.Enabled = false |
|
|
|
defaults.YP.Enabled = false |
|
|
@ -25,23 +19,3 @@ func getDefaults() config { |
|
|
|
|
|
|
|
|
|
|
|
return defaults |
|
|
|
return defaults |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func getDefaultFFMpegPath() string { |
|
|
|
|
|
|
|
// First look to see if ffmpeg is in the current working directory
|
|
|
|
|
|
|
|
localCopy := "./ffmpeg" |
|
|
|
|
|
|
|
hasLocalCopyError := verifyFFMpegPath(localCopy) |
|
|
|
|
|
|
|
if hasLocalCopyError == nil { |
|
|
|
|
|
|
|
// No error, so all is good. Use the local copy.
|
|
|
|
|
|
|
|
return localCopy |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cmd := exec.Command("which", "ffmpeg") |
|
|
|
|
|
|
|
out, err := cmd.CombinedOutput() |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
panic("Unable to determine path to ffmpeg. Please specify it in the config file.") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
path := strings.TrimSpace(string(out)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return path |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|