Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df08d42d9b | ||
|
|
1b55033bb8 | ||
|
|
1331e5769f |
No files matched your search
@@ -66,12 +66,13 @@ func GetNextIP(ipv6 bool) (string, error) {
|
||||
return nextIP, nil
|
||||
}
|
||||
|
||||
func releaseIP(ip string) {
|
||||
func ReleaseIP(ip string) {
|
||||
ipMutex.Lock()
|
||||
defer ipMutex.Unlock()
|
||||
ipLastUsed[ip] = time.Now()
|
||||
ipInUse[ip] = false
|
||||
}
|
||||
|
||||
func getLeastUsedIP(ipPool []string) string {
|
||||
nextIP := ""
|
||||
veryLastUse := time.Now()
|
||||
|
||||
+11
-5
@@ -210,17 +210,19 @@ func (v *YoutubeVideo) download(useIPv6 bool) error {
|
||||
case <-v.stopGroup.Ch():
|
||||
return errors.Err("interrupted by user")
|
||||
default:
|
||||
time.Sleep(20 * time.Second)
|
||||
sourceAddress, err = ipManager.GetNextIP(useIPv6)
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
time.Sleep(ipManager.IPCooldownPeriod)
|
||||
sourceAddress, err = ipManager.GetNextIP(useIPv6)
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return errors.Err(err)
|
||||
}
|
||||
}
|
||||
defer ipManager.ReleaseIP(sourceAddress)
|
||||
if useIPv6 {
|
||||
log.Infof("using IPv6: %s", sourceAddress)
|
||||
ytdlArgs = append(ytdlArgs,
|
||||
@@ -272,6 +274,10 @@ func (v *YoutubeVideo) download(useIPv6 bool) error {
|
||||
_ = v.delete()
|
||||
return errors.Err("video is too long to process")
|
||||
}
|
||||
if strings.Contains(string(outLog), "File is larger than max-filesize") {
|
||||
_ = v.delete()
|
||||
return errors.Err("the video is too big to sync, skipping for now")
|
||||
}
|
||||
if string(errorLog) != "" {
|
||||
log.Printf("Command finished with error: %v", errors.Err(string(errorLog)))
|
||||
_ = v.delete()
|
||||
|
||||
Reference in new issue
Block a user