mirror of
https://github.com/teacat/chaturbate-dvr.git
synced 2025-10-29 16:59:59 +00:00
Fixing dropping frames
This commit is contained in:
parent
08d2455d5c
commit
2911eb217e
23
main.go
23
main.go
@ -214,11 +214,18 @@ func fetchSegment(master *os.File, segment *m3u8.MediaSegment, baseURL string, f
|
||||
break
|
||||
}
|
||||
//
|
||||
b, _ := ioutil.ReadFile(fmt.Sprintf("%s~%d.ts", filename, index-1))
|
||||
if _, err := master.Write(b); err != nil {
|
||||
panic(err)
|
||||
if retry > 3 {
|
||||
//
|
||||
b, _ := ioutil.ReadFile(fmt.Sprintf("%s~%d.ts", filename, index))
|
||||
master.Write(b)
|
||||
//
|
||||
os.Remove(fmt.Sprintf("%s~%d.ts", filename, index))
|
||||
return
|
||||
}
|
||||
//
|
||||
b, _ := ioutil.ReadFile(fmt.Sprintf("%s~%d.ts", filename, index-1))
|
||||
master.Write(b)
|
||||
//
|
||||
os.Remove(fmt.Sprintf("%s~%d.ts", filename, index-1))
|
||||
}
|
||||
|
||||
@ -237,8 +244,8 @@ func endpoint(c *cli.Context) error {
|
||||
continue
|
||||
}
|
||||
// Otherwise we keep checking the channel status until the user is online.
|
||||
log.Printf("%s is offlined, check again after 1 minutes...", c.String("username"))
|
||||
<-time.After(time.Minute * 1)
|
||||
log.Printf("%s is offlined, check again after %d minutes...", c.String("username"), c.Int("interval"))
|
||||
<-time.After(time.Minute * time.Duration(c.Int("interval")))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@ -258,6 +265,12 @@ func main() {
|
||||
Value: "",
|
||||
Usage: "video quality with `high`, `medium` and `low`",
|
||||
},
|
||||
&cli.IntFlag{
|
||||
Name: "interval",
|
||||
Aliases: []string{"i"},
|
||||
Value: 1,
|
||||
Usage: "minutes to check if a channel goes online or not",
|
||||
},
|
||||
},
|
||||
Name: "chaturbate-dvr",
|
||||
Usage: "watching a specified chaturbate channel and auto saved to local file",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user