speed up duration checks
This commit is contained in:
parent
259df8d257
commit
3dc30c3b98
1 changed files with 7 additions and 0 deletions
|
@ -434,6 +434,13 @@ func (v *YoutubeVideo) Sync(daemon *jsonrpc.Client, params SyncParams, existingV
|
||||||
|
|
||||||
func (v *YoutubeVideo) downloadAndPublish(daemon *jsonrpc.Client, params SyncParams) (*SyncSummary, error) {
|
func (v *YoutubeVideo) downloadAndPublish(daemon *jsonrpc.Client, params SyncParams) (*SyncSummary, error) {
|
||||||
var err error
|
var err error
|
||||||
|
videoDuration, err := duration.FromString(v.youtubeInfo.ContentDetails.Duration)
|
||||||
|
if err != nil {
|
||||||
|
return nil, errors.Err(err)
|
||||||
|
}
|
||||||
|
if videoDuration.ToDuration() > time.Duration(v.maxVideoLength*60)*time.Minute {
|
||||||
|
return nil, errors.Err("video is too long to process")
|
||||||
|
}
|
||||||
for {
|
for {
|
||||||
err = v.download()
|
err = v.download()
|
||||||
if err != nil && strings.Contains(err.Error(), "HTTP Error 429") {
|
if err != nil && strings.Contains(err.Error(), "HTTP Error 429") {
|
||||||
|
|
Loading…
Reference in a new issue