File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ package parser
33import (
44 "io"
55 "os/exec"
6- "path/filepath"
76 "sync"
87
98 l "github.com/go-olive/olive/src/log"
@@ -45,9 +44,6 @@ func (p *ffmpeg) Type() string {
4544}
4645
4746func (p * ffmpeg ) Parse (streamURL string , out string ) (err error ) {
48- ext := filepath .Ext (out )
49- out = out [0 :len (out )- len (ext )] + ".flv"
50-
5147 l .Logger .WithFields (logrus.Fields {
5248 // "streamURL": streamURL,
5349 "out" : out ,
Original file line number Diff line number Diff line change 11package parser
22
33import (
4- "path/filepath"
5-
64 "github.com/go-olive/flv"
75 l "github.com/go-olive/olive/src/log"
86 "github.com/sirupsen/logrus"
@@ -25,9 +23,6 @@ func (this *customFlv) New() Parser {
2523}
2624
2725func (this * customFlv ) Parse (streamURL string , out string ) (err error ) {
28- ext := filepath .Ext (out )
29- out = out [0 :len (out )- len (ext )] + ".flv"
30-
3126 l .Logger .WithFields (logrus.Fields {
3227 // "streamURL": streamURL,
3328 "out" : out ,
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ package parser
33import (
44 "io"
55 "os/exec"
6- "path/filepath"
76 "sync"
87
98 l "github.com/go-olive/olive/src/log"
@@ -42,9 +41,6 @@ func (s *streamlink) Type() string {
4241
4342// streamlink -o "a.mp4" https://www.twitch.tv/nnabi best -f
4443func (s * streamlink ) Parse (streamURL string , out string ) (err error ) {
45- ext := filepath .Ext (out )
46- out = out [0 :len (out )- len (ext )] + ".flv"
47-
4844 l .Logger .WithFields (logrus.Fields {
4945 // "streamURL": streamURL,
5046 "out" : out ,
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ package parser
33import (
44 "io"
55 "os/exec"
6- "path/filepath"
76 "sync"
87
98 l "github.com/go-olive/olive/src/log"
@@ -42,9 +41,6 @@ func (p *ytdlp) Type() string {
4241
4342// yt-dlp -f "bv[height=1080]+ba/b" https://www.youtube.com/watch?v=f6PdkucL1hk
4443func (p * ytdlp ) Parse (streamURL string , out string ) (err error ) {
45- ext := filepath .Ext (out )
46- out = out [0 :len (out )- len (ext )] + ".mp4"
47-
4844 l .Logger .WithFields (logrus.Fields {
4945 // "streamURL": streamURL,
5046 "out" : out ,
Original file line number Diff line number Diff line change @@ -199,6 +199,15 @@ func (r *recorder) record() error {
199199 }
200200 out = filepath .Join (saveDir , out )
201201
202+ switch r .parser .Type () {
203+ case "yt-dlp" :
204+ ext := filepath .Ext (out )
205+ out = out [0 :len (out )- len (ext )] + ".mp4"
206+ default :
207+ ext := filepath .Ext (out )
208+ out = out [0 :len (out )- len (ext )] + ".flv"
209+ }
210+
202211 r .startTime = time .Now ()
203212 r .out = out
204213
You can’t perform that action at this time.
0 commit comments