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:
@@ -1,14 +1,12 @@
|
||||
package storageproviders
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/owncast/owncast/config"
|
||||
"github.com/owncast/owncast/core/transcoder"
|
||||
"github.com/owncast/owncast/utils"
|
||||
)
|
||||
|
||||
// LocalStorage represents an instance of the local storage provider for HLS video.
|
||||
@@ -25,7 +23,7 @@ func (s *LocalStorage) Setup() error {
|
||||
_onlineCleanupTicker = time.NewTicker(1 * time.Minute)
|
||||
go func() {
|
||||
for range _onlineCleanupTicker.C {
|
||||
transcoder.CleanupOldContent(config.PublicHLSStoragePath)
|
||||
transcoder.CleanupOldContent(config.HLSStoragePath)
|
||||
}
|
||||
}()
|
||||
return nil
|
||||
@@ -55,15 +53,5 @@ func (s *LocalStorage) MasterPlaylistWritten(localFilePath string) {
|
||||
|
||||
// Save will save a local filepath using the storage provider.
|
||||
func (s *LocalStorage) Save(filePath string, retryCount int) (string, error) {
|
||||
newPath := ""
|
||||
|
||||
// This is a hack
|
||||
if filePath == "hls/stream.m3u8" {
|
||||
newPath = filepath.Join(config.PublicHLSStoragePath, filepath.Base(filePath))
|
||||
} else {
|
||||
newPath = filepath.Join(config.WebRoot, filePath)
|
||||
}
|
||||
|
||||
err := utils.Copy(filePath, newPath)
|
||||
return newPath, err
|
||||
return filePath, nil
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ func (s *S3Storage) rewriteRemotePlaylist(filePath string) error {
|
||||
item.URI = s.host + filepath.Join("/hls", item.URI)
|
||||
}
|
||||
|
||||
publicPath := filepath.Join(config.PublicHLSStoragePath, filepath.Base(filePath))
|
||||
publicPath := filepath.Join(config.HLSStoragePath, filepath.Base(filePath))
|
||||
|
||||
newPlaylist := p.String()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user