Skip to content

Commit

Permalink
chore(deps): updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Roverr committed Jul 24, 2024
1 parent 007ca6c commit b9804c6
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 127 deletions.
62 changes: 0 additions & 62 deletions Gopkg.lock

This file was deleted.

46 changes: 0 additions & 46 deletions Gopkg.toml

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 Riltech
Copyright (c) 2024 Riltech Software Ltd.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
17 changes: 17 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module github.com/riltech/streamer

go 1.22.5

require (
github.com/Roverr/hotstreak v1.1.0
github.com/google/uuid v1.6.0
github.com/natefinch/lumberjack v2.0.0+incompatible
)

require (
github.com/BurntSushi/toml v1.4.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/stretchr/testify v1.7.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
23 changes: 23 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/Roverr/hotstreak v1.1.0 h1:qdzWw2qaKHzMwrOJddugoUuZ2s5P3jaczshr4G0+Nz0=
github.com/Roverr/hotstreak v1.1.0/go.mod h1:Oi7GVkiu2+pso+arTwxFuC0YV0QcMSVJ41MkqvK7GVk=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM=
github.com/natefinch/lumberjack v2.0.0+incompatible/go.mod h1:Wi9p2TTF5DG5oU+6YfsmYQpsTIOm0B1VNzQg9Mw6nPk=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
27 changes: 9 additions & 18 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package streamer

import (
"fmt"
"log/slog"
"os"
"os/exec"
"path/filepath"
Expand All @@ -11,7 +12,6 @@ import (

"github.com/google/uuid"
"github.com/natefinch/lumberjack"
"github.com/sirupsen/logrus"

"github.com/Roverr/hotstreak"
)
Expand Down Expand Up @@ -56,7 +56,7 @@ func NewStream(
path := fmt.Sprintf("%s/%s", storingDirectory, id)
err := os.MkdirAll(path, os.ModePerm)
if err != nil {
logrus.Error(err)
slog.Error("error creating directory", "error", err)
return nil, ""
}
process := NewProcess(keepFiles, audio)
Expand Down Expand Up @@ -95,7 +95,7 @@ func NewStream(
Running: false,
WaitTimeOut: waitTimeOut,
}
logrus.Debugf("%s store path created | Stream", stream.StorePath)
slog.Debug("stream store path created", "path", stream.StorePath)
return &stream, id
}

Expand All @@ -111,13 +111,10 @@ func (strm *Stream) Start() *sync.WaitGroup {
indexPath := fmt.Sprintf("%s/index.m3u8", strm.StorePath)
// Run the transcoding, resolve stream if it errors out
go func() {
logrus.Debugf("%s is starting FFMPEG process | Stream", strm.ID)
slog.Debug("starting FFMPEG process", "id", strm.ID)
if err := strm.CMD.Run(); err != nil {
once.Do(func() {
logrus.Errorf("%s process could not start. | Stream\n Error: %s",
strm.ID,
err,
)
slog.Error("process could not start", "id", strm.ID, "error", err)
strm.Running = false
strm.Mux.Unlock()
wg.Done()
Expand All @@ -133,10 +130,7 @@ func (strm *Stream) Start() *sync.WaitGroup {
continue
}
once.Do(func() {
logrus.Debugf("%s - %s successfully started - index.m3u8 found | Stream",
strm.ID,
strm.OriginalURI,
)
slog.Debug("successfully started", "id", strm.ID, "uri", strm.OriginalURI)
strm.Running = true
strm.Mux.Unlock()
wg.Done()
Expand All @@ -148,10 +142,7 @@ func (strm *Stream) Start() *sync.WaitGroup {
go func() {
<-time.After(strm.WaitTimeOut)
once.Do(func() {
logrus.Errorf(
"%s process starting timed out | Stream",
strm.ID,
)
slog.Error("process starting timed out", "id", strm.ID)
strm.Running = false
strm.Mux.Unlock()
wg.Done()
Expand Down Expand Up @@ -188,9 +179,9 @@ func (strm *Stream) Stop() error {
strm.Running = false
if !strm.KeepFiles {
defer func() {
logrus.Debugf("%s directory is being removed | Stream", strm.StorePath)
slog.Debug("directory is being removed", "path", strm.StorePath)
if err := os.RemoveAll(strm.StorePath); err != nil {
logrus.Error(err)
slog.Error("error removing directory", "error", err)
}
}()
}
Expand Down

0 comments on commit b9804c6

Please sign in to comment.