Take control over your live stream video by running it yourself. Streaming + chat out of the box.
HTML activitypubbroadcastingchatdecentralizedfederationfediversegolanghacktoberfesthlslivelivestreamowncastrtmpself-hostedstreaming-videovideo
Add basic file upload retry with a hardcoded limit
Gabe Kangase63d0656ba43
diff --git a/chunkStorage.go b/chunkStorage.goindex ddb86ce9c7..16ba6dbdbb 100644--- a/chunkStorage.go+++ b/chunkStorage.go@@ -2,6 +2,6 @@ package maintype ChunkStorage interface {Setup(config Config)- Save(filePath string) string+ Save(filePath string, retryCount int) stringGenerateRemotePlaylist(playlist string, variant Variant) string}diff --git a/ipfsStorage.go b/ipfsStorage.goindex 6208dc26ef..a59bbe8104 100644--- a/ipfsStorage.go+++ b/ipfsStorage.go@@ -52,7 +52,7 @@ func (s *IPFSStorage) Setup(config Config) {s.createIPFSDirectory("./hls")}-func (s *IPFSStorage) Save(filePath string) string {+func (s *IPFSStorage) Save(filePath string, retryCount int) string {someFile, err := getUnixfsNode(filePath)defer someFile.Close()diff --git a/playlistMonitor.go b/playlistMonitor.goindex 5cd68d7671..71c865dc4f 100644--- a/playlistMonitor.go+++ b/playlistMonitor.go@@ -108,7 +108,7 @@ func monitorVideoContent(pathToMonitor string, configuration Config, storage ChunewObjectPathChannel := make(chan string, 1)go func() {- newObjectPath := storage.Save(path.Join(configuration.PrivateHLSPath, segment.RelativeUploadPath))+ newObjectPath := storage.Save(path.Join(configuration.PrivateHLSPath, segment.RelativeUploadPath), 0)newObjectPathChannel <- newObjectPath}()newObjectPath := <-newObjectPathChanneldiff --git a/s3Storage.go b/s3Storage.goindex e9b0e0d5da..72cef72241 100644--- a/s3Storage.go+++ b/s3Storage.go@@ -36,14 +36,14 @@ func (s *S3Storage) Setup(configuration Config) {s.sess = s.connectAWS()}-func (s *S3Storage) Save(filePath string) string {+func (s *S3Storage) Save(filePath string, retryCount int) string {// fmt.Println("Saving", filePath)file, err := os.Open(filePath)defer file.Close()if err != nil {- log.Fatal(err)+ log.Errorln(err)}uploader := s3manager.NewUploader(s.sess)@@ -55,7 +55,11 @@ func (s *S3Storage) Save(filePath string) string {})if err != nil {- panic(err)+ log.Errorln(err)+ if retryCount < 4 {+ log.Println("Retrying...")+ s.Save(filePath, retryCount+1)+ }}// fmt.Println("Uploaded", filePath, "to", response.Location)