Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.DS_Store
ffmpeg/
go/
low-latency-preview
utils/__MACOSX/
utils/lsar
utils/unar
utils/unarMac.zip
www/
logs/
4 changes: 2 additions & 2 deletions buildEncoderAndServerMacOS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ go/bin/go build

rm -r -f www/

mkdir www
mkdir -p www logs

rm -r -f low-latency-preview-master
rm -r -f low-latency-preview-master
2 changes: 1 addition & 1 deletion buildEncoderAndServerUbuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ go/bin/go build

rm -r -f www logs

mkdir www logs
mkdir -p www logs

wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz

Expand Down
2 changes: 1 addition & 1 deletion launchEncoderTestPattern.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if [ -z "$2" ]; then
STREAMID="1234"
echo "Target Path not specified, assuming ${STREAMID}..."
else
STREAMID="$1"
STREAMID="$2"
fi

echo Oh 💩 here we go!
Expand Down
2 changes: 1 addition & 1 deletion launchServer.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash

go/bin/go run main.go "./www" 2>logs/server.log &
go/bin/go run main.go "./www" ${1} 2>logs/server.log &
129 changes: 0 additions & 129 deletions logs/encode.log

This file was deleted.

7,940 changes: 2 additions & 7,938 deletions logs/server.log

Large diffs are not rendered by default.

15 changes: 11 additions & 4 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,19 @@ import (
)

func main() {

// TODO: This needs a better way of handling arguments
flag.Parse()
args := flag.Args()
if len(args) != 1 || args[0] == "" {
utils.GetMainLogger().Errorf("Usage: need base dir\n")
if len(args) == 0 || args[0] == "" {
utils.GetMainLogger().Errorf("Usage: run main.go BASE_PATH [LISTEN_HOST_PORT (Default=:8080)]\n")
return
}

bindString := ":8080"
if len(args) >= 2 {
bindString = args[1]
}

filePath, err := filepath.Abs(args[0])
if err != nil {
Expand Down Expand Up @@ -54,6 +61,6 @@ func main() {
r.Handle("/ldash/{folder}/{name:[a-zA-Z0-9/_-]+}.{name:[a-zA-Z0-9/_-]+}", file_deleteHandler).Methods("DELETE")
r.Handle("/ldashplay/{folder}/{name:[a-zA-Z0-9/_-]+}.{name:[a-zA-Z0-9/_-]+}", dash_playHandler)

utils.GetMainLogger().Infof("start server\n")
log.Fatal(http.ListenAndServe(":8080", r))
utils.GetMainLogger().Infof("start server on %s\n", bindString)
log.Fatal(http.ListenAndServe(bindString, r))
}