fix stop pattern
fix noretry string fix youtube-dl param
This commit is contained in:
parent
a3fcd67611
commit
6f486717da
3 changed files with 10 additions and 18 deletions
|
@ -22,14 +22,12 @@ var ipLastUsed map[string]time.Time
|
|||
var ipMutex sync.Mutex
|
||||
var stopper = stop.New()
|
||||
|
||||
func SignalShutdown() {
|
||||
stopper.Stop()
|
||||
}
|
||||
|
||||
func GetNextIP(ipv6 bool) (string, error) {
|
||||
ipMutex.Lock()
|
||||
defer ipMutex.Unlock()
|
||||
if len(ipv4Pool) < 1 || len(ipv6Pool) < 1 {
|
||||
throttledIPs = make(map[string]bool)
|
||||
ipLastUsed = make(map[string]time.Time)
|
||||
addrs, err := net.InterfaceAddrs()
|
||||
if err != nil {
|
||||
return "", errors.Err(err)
|
||||
|
@ -94,18 +92,12 @@ func SetIpThrottled(ip string, stopGrp *stop.Group) {
|
|||
go func() {
|
||||
defer stopper.Done()
|
||||
unbanTimer := time.NewTimer(unbanTimeout)
|
||||
for {
|
||||
select {
|
||||
case <-unbanTimer.C:
|
||||
throttledIPs[ip] = false
|
||||
log.Printf("%s set back to not throttled", ip)
|
||||
return
|
||||
case <-stopGrp.Ch():
|
||||
unbanTimer.Stop()
|
||||
return
|
||||
default:
|
||||
time.Sleep(5 * time.Second)
|
||||
}
|
||||
select {
|
||||
case <-unbanTimer.C:
|
||||
throttledIPs[ip] = false
|
||||
log.Printf("%s set back to not throttled", ip)
|
||||
case <-stopGrp.Ch():
|
||||
unbanTimer.Stop()
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
|
|
@ -667,7 +667,7 @@ func (s *Sync) startWorker(workerNum int) {
|
|||
} else if s.MaxTries > 1 {
|
||||
errorsNoRetry := []string{
|
||||
"non 200 status code received",
|
||||
" reason: 'This video contains content from",
|
||||
"This video contains content from",
|
||||
"dont know which claim to update",
|
||||
"uploader has not made this video available in your country",
|
||||
"download error: AccessDenied: Access Denied",
|
||||
|
|
|
@ -196,7 +196,7 @@ func (v *YoutubeVideo) download(useIPv6 bool) error {
|
|||
"--max-filesize",
|
||||
fmt.Sprintf("%dM", v.maxVideoSize),
|
||||
"--match-filter",
|
||||
fmt.Sprintf("'duration <= %d'", int(math.Round(v.maxVideoLength*3600))),
|
||||
fmt.Sprintf("duration <= %d", int(math.Round(v.maxVideoLength*3600))),
|
||||
"-fbestvideo[ext=mp4][height<=1080]+bestaudio[ext!=webm]",
|
||||
"-o" + strings.TrimRight(v.getFullPath(), ".mp4"),
|
||||
"--merge-output-format",
|
||||
|
|
Loading…
Reference in a new issue