Skip to content

Commit 5824734

Browse files
Fix bug where customized video was not created
1 parent 83bb6e8 commit 5824734

File tree

5 files changed

+47
-22
lines changed

5 files changed

+47
-22
lines changed

Dockerfile

+6
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,17 @@ RUN mkdir $THREADFIN_CONF && chmod a+rwX $THREADFIN_CONF && mkdir $THREADFIN_TEM
7373
# For VLC
7474
RUN sed -i 's/geteuid/getppid/' /usr/bin/vlc
7575

76+
# Add threadfin group and user
77+
RUN addgroup -S threadfin -g ${THREADFIN_GID} && adduser -S threadfin -G threadfin -u ${THREADFIN_UID} -g ${THREADFIN_GID} -s /bin/sh
78+
7679
# Configure container volume mappings
7780
VOLUME $THREADFIN_CONF
7881
VOLUME $THREADFIN_TEMP
7982

8083
EXPOSE $THREADFIN_PORT
8184

85+
# Set user
86+
USER threadfin
87+
8288
# Run the Threadfin executable
8389
ENTRYPOINT ${THREADFIN_BIN}/threadfin -port=${THREADFIN_PORT} -config=${THREADFIN_CONF} -debug=${THREADFIN_DEBUG} -branch=${THREADFIN_BRANCH}

go.mod

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ require (
77
github.com/gorilla/websocket v1.5.3
88
github.com/hashicorp/go-version v1.7.0
99
github.com/koron/go-ssdp v0.0.4
10-
golang.org/x/text v0.17.0
10+
golang.org/x/text v0.18.0
1111
)
1212

1313
require (
14-
golang.org/x/net v0.26.0 // indirect
15-
golang.org/x/sys v0.21.0 // indirect
14+
golang.org/x/net v0.29.0 // indirect
15+
golang.org/x/sys v0.25.0 // indirect
1616
)

go.sum

+6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@ github.com/koron/go-ssdp v0.0.4 h1:1IDwrghSKYM7yLf7XCzbByg2sJ/JcNOZRXS2jczTwz0=
88
github.com/koron/go-ssdp v0.0.4/go.mod h1:oDXq+E5IL5q0U8uSBcoAXzTzInwy5lEgC91HoKtbmZk=
99
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
1010
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
11+
golang.org/x/net v0.29.0 h1:5ORfpBpCs4HzDYoodCDBbwHzdR5UrLBZ3sOnUJmFoHo=
12+
golang.org/x/net v0.29.0/go.mod h1:gLkgy8jTGERgjzMic6DS9+SP0ajcu6Xu3Orq/SpETg0=
1113
golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws=
1214
golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
15+
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
16+
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
1317
golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc=
1418
golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
19+
golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224=
20+
golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=

src/buffer.go

+31-18
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ func createAlternativNoMoreStreamsVideo(pathToFile string) (error) {
6565

6666
}
6767
if len(cmd.Args) > 0 {
68-
fmt.Println("Executing command:", cmd.String())
69-
68+
showInfo("Streaming Status:Creating video from uploaded image for a customized no more stream video")
7069
err := cmd.Run()
7170
if err != nil {
7271
return err
@@ -198,26 +197,40 @@ func bufferingStream(playlistID, streamingURL, backupStreamingURL1, backupStream
198197
var contentOk, customizedVideo bool
199198

200199
imageFileList, err := os.ReadDir(System.Folder.Custom)
200+
if err != nil {
201+
ShowError(err, 0)
202+
}
203+
// Check if a customized video is available and use it if so
204+
fileList, err := os.ReadDir(System.Folder.Video)
201205
if err == nil {
202-
// Check if a customized video is available and use it if so
203-
fileList, err := os.ReadDir(System.Folder.Video)
204-
if err == nil {
205-
if len(fileList) == 1 {
206-
content, err = os.ReadFile(System.Folder.Video + fileList[0].Name())
207-
if err == nil {
208-
contentOk = true
209-
customizedVideo = true
210-
} else {
211-
ShowError(err, 0) // log error
212-
return
206+
var createContent = false
207+
switch len(fileList) {
208+
case 0: // If no customized video is available create one
209+
createContent = true
210+
case 1: // Is there only one file, use it
211+
break
212+
default:
213+
// remove all found files
214+
for _, file := range fileList {
215+
os.Remove(System.Folder.Video + file.Name())
216+
}
217+
createContent = true
218+
}
219+
if createContent {
220+
if len(imageFileList) > 0 {
221+
err := createAlternativNoMoreStreamsVideo(System.Folder.Custom + imageFileList[0].Name())
222+
if err != nil {
223+
ShowError(err, 0)
213224
}
214225
}
226+
}
227+
content, err = os.ReadFile(System.Folder.Video + "stream-limit.ts")
228+
if err == nil {
229+
contentOk = true
230+
customizedVideo = true
215231
} else {
216-
err := createAlternativNoMoreStreamsVideo(System.Folder.Custom + imageFileList[0].Name())
217-
if err == nil {
218-
contentOk = true
219-
customizedVideo = true
220-
}
232+
ShowError(err, 0) // log error
233+
return
221234
}
222235
}
223236

threadfin.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ var GitHub = GitHubStruct{Branch: "Main", User: "marcelGoerentz", Repo: "Threadf
4242
const Name = "Threadfin"
4343

4444
// Version : Version, die Build Nummer wird in der main func geparst.
45-
const Version = "1.5.0-beta"
45+
const Version = "1.5.1-beta"
4646

4747
// DBVersion : Datanbank Version
4848
const DBVersion = "0.5.0"

0 commit comments

Comments
 (0)