Simplify HLS storage paths (#1393)
* Remove private vs public HLS paths and add a HLS controller. Closes #875 * Use http.ServeFile instead
This commit is contained in:
@@ -59,7 +59,7 @@ func (s *FileWriterReceiverService) uploadHandler(w http.ResponseWriter, r *http
|
||||
}
|
||||
|
||||
path := r.URL.Path
|
||||
writePath := filepath.Join(config.PrivateHLSStoragePath, path)
|
||||
writePath := filepath.Join(config.HLSStoragePath, path)
|
||||
|
||||
var buf bytes.Buffer
|
||||
defer r.Body.Close()
|
||||
|
||||
@@ -233,19 +233,8 @@ func NewTranscoder() *Transcoder {
|
||||
transcoder.currentStreamOutputSettings = data.GetStreamOutputVariants()
|
||||
transcoder.currentLatencyLevel = data.GetStreamLatencyLevel()
|
||||
transcoder.codec = getCodec(data.GetVideoCodec())
|
||||
|
||||
var outputPath string
|
||||
if data.GetS3Config().Enabled {
|
||||
// Segments are not available via the local HTTP server
|
||||
outputPath = config.PrivateHLSStoragePath
|
||||
} else {
|
||||
// Segments are available via the local HTTP server
|
||||
outputPath = config.PublicHLSStoragePath
|
||||
}
|
||||
|
||||
transcoder.segmentOutputPath = outputPath
|
||||
// Playlists are available via the local HTTP server
|
||||
transcoder.playlistOutputPath = config.PublicHLSStoragePath
|
||||
transcoder.segmentOutputPath = config.HLSStoragePath
|
||||
transcoder.playlistOutputPath = config.HLSStoragePath
|
||||
|
||||
transcoder.input = "pipe:0" // stdin
|
||||
|
||||
|
||||
@@ -94,27 +94,16 @@ func handleTranscoderMessage(message string) {
|
||||
|
||||
func createVariantDirectories() {
|
||||
// Create private hls data dirs
|
||||
utils.CleanupDirectory(config.PublicHLSStoragePath)
|
||||
utils.CleanupDirectory(config.PrivateHLSStoragePath)
|
||||
utils.CleanupDirectory(config.HLSStoragePath)
|
||||
|
||||
if len(data.GetStreamOutputVariants()) != 0 {
|
||||
for index := range data.GetStreamOutputVariants() {
|
||||
if err := os.MkdirAll(path.Join(config.PrivateHLSStoragePath, strconv.Itoa(index)), 0750); err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
dir := path.Join(config.PublicHLSStoragePath, strconv.Itoa(index))
|
||||
log.Traceln("Creating", dir)
|
||||
if err := os.MkdirAll(dir, 0750); err != nil {
|
||||
if err := os.MkdirAll(path.Join(config.HLSStoragePath, strconv.Itoa(index)), 0750); err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
dir := path.Join(config.PrivateHLSStoragePath, strconv.Itoa(0))
|
||||
log.Traceln("Creating", dir)
|
||||
if err := os.MkdirAll(dir, 0750); err != nil {
|
||||
log.Fatalln(err)
|
||||
}
|
||||
dir = path.Join(config.PublicHLSStoragePath, strconv.Itoa(0))
|
||||
dir := path.Join(config.HLSStoragePath, strconv.Itoa(0))
|
||||
log.Traceln("Creating", dir)
|
||||
if err := os.MkdirAll(dir, 0750); err != nil {
|
||||
log.Fatalln(err)
|
||||
|
||||
Reference in New Issue
Block a user