Skip to content

Commit b9804c6

Browse files
committed
chore(deps): updated
1 parent 007ca6c commit b9804c6

File tree

6 files changed

+50
-127
lines changed

6 files changed

+50
-127
lines changed

Gopkg.lock

Lines changed: 0 additions & 62 deletions
This file was deleted.

Gopkg.toml

Lines changed: 0 additions & 46 deletions
This file was deleted.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2020 Riltech
3+
Copyright (c) 2024 Riltech Software Ltd.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

go.mod

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module github.com/riltech/streamer
2+
3+
go 1.22.5
4+
5+
require (
6+
github.com/Roverr/hotstreak v1.1.0
7+
github.com/google/uuid v1.6.0
8+
github.com/natefinch/lumberjack v2.0.0+incompatible
9+
)
10+
11+
require (
12+
github.com/BurntSushi/toml v1.4.0 // indirect
13+
github.com/davecgh/go-spew v1.1.1 // indirect
14+
github.com/stretchr/testify v1.7.0 // indirect
15+
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
16+
gopkg.in/yaml.v2 v2.4.0 // indirect
17+
)

go.sum

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
2+
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
3+
github.com/Roverr/hotstreak v1.1.0 h1:qdzWw2qaKHzMwrOJddugoUuZ2s5P3jaczshr4G0+Nz0=
4+
github.com/Roverr/hotstreak v1.1.0/go.mod h1:Oi7GVkiu2+pso+arTwxFuC0YV0QcMSVJ41MkqvK7GVk=
5+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
6+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
7+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
8+
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
9+
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
10+
github.com/natefinch/lumberjack v2.0.0+incompatible h1:4QJd3OLAMgj7ph+yZTuX13Ld4UpgHp07nNdFX7mqFfM=
11+
github.com/natefinch/lumberjack v2.0.0+incompatible/go.mod h1:Wi9p2TTF5DG5oU+6YfsmYQpsTIOm0B1VNzQg9Mw6nPk=
12+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
13+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
14+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
15+
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
16+
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
17+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
18+
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
19+
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
20+
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
21+
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
22+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
23+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

main.go

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package streamer
22

33
import (
44
"fmt"
5+
"log/slog"
56
"os"
67
"os/exec"
78
"path/filepath"
@@ -11,7 +12,6 @@ import (
1112

1213
"github.com/google/uuid"
1314
"github.com/natefinch/lumberjack"
14-
"github.com/sirupsen/logrus"
1515

1616
"github.com/Roverr/hotstreak"
1717
)
@@ -56,7 +56,7 @@ func NewStream(
5656
path := fmt.Sprintf("%s/%s", storingDirectory, id)
5757
err := os.MkdirAll(path, os.ModePerm)
5858
if err != nil {
59-
logrus.Error(err)
59+
slog.Error("error creating directory", "error", err)
6060
return nil, ""
6161
}
6262
process := NewProcess(keepFiles, audio)
@@ -95,7 +95,7 @@ func NewStream(
9595
Running: false,
9696
WaitTimeOut: waitTimeOut,
9797
}
98-
logrus.Debugf("%s store path created | Stream", stream.StorePath)
98+
slog.Debug("stream store path created", "path", stream.StorePath)
9999
return &stream, id
100100
}
101101

@@ -111,13 +111,10 @@ func (strm *Stream) Start() *sync.WaitGroup {
111111
indexPath := fmt.Sprintf("%s/index.m3u8", strm.StorePath)
112112
// Run the transcoding, resolve stream if it errors out
113113
go func() {
114-
logrus.Debugf("%s is starting FFMPEG process | Stream", strm.ID)
114+
slog.Debug("starting FFMPEG process", "id", strm.ID)
115115
if err := strm.CMD.Run(); err != nil {
116116
once.Do(func() {
117-
logrus.Errorf("%s process could not start. | Stream\n Error: %s",
118-
strm.ID,
119-
err,
120-
)
117+
slog.Error("process could not start", "id", strm.ID, "error", err)
121118
strm.Running = false
122119
strm.Mux.Unlock()
123120
wg.Done()
@@ -133,10 +130,7 @@ func (strm *Stream) Start() *sync.WaitGroup {
133130
continue
134131
}
135132
once.Do(func() {
136-
logrus.Debugf("%s - %s successfully started - index.m3u8 found | Stream",
137-
strm.ID,
138-
strm.OriginalURI,
139-
)
133+
slog.Debug("successfully started", "id", strm.ID, "uri", strm.OriginalURI)
140134
strm.Running = true
141135
strm.Mux.Unlock()
142136
wg.Done()
@@ -148,10 +142,7 @@ func (strm *Stream) Start() *sync.WaitGroup {
148142
go func() {
149143
<-time.After(strm.WaitTimeOut)
150144
once.Do(func() {
151-
logrus.Errorf(
152-
"%s process starting timed out | Stream",
153-
strm.ID,
154-
)
145+
slog.Error("process starting timed out", "id", strm.ID)
155146
strm.Running = false
156147
strm.Mux.Unlock()
157148
wg.Done()
@@ -188,9 +179,9 @@ func (strm *Stream) Stop() error {
188179
strm.Running = false
189180
if !strm.KeepFiles {
190181
defer func() {
191-
logrus.Debugf("%s directory is being removed | Stream", strm.StorePath)
182+
slog.Debug("directory is being removed", "path", strm.StorePath)
192183
if err := os.RemoveAll(strm.StorePath); err != nil {
193-
logrus.Error(err)
184+
slog.Error("error removing directory", "error", err)
194185
}
195186
}()
196187
}

0 commit comments

Comments
 (0)