Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
lbry
ytsync
Commits
1760935e
Commit
1760935e
authored
Jul 22, 2019
by
ci
Browse files
don't retry missing fragments
lower syncing quality for now
parent
60f2585f
Changes
1
Hide whitespace changes
Inline
Side-by-side
sources/youtubeVideo.go
View file @
1760935e
...
...
@@ -190,16 +190,25 @@ func (v *YoutubeVideo) download(useIPv6 bool) error {
log
.
Debugln
(
v
.
id
+
" already exists at "
+
videoPath
)
return
nil
}
qualities
:=
[]
string
{
//"1080",
"720"
,
"480"
,
"320"
,
}
qualityIndex
:=
0
ytdlArgs
:=
[]
string
{
"--no-progress"
,
"--max-filesize"
,
fmt
.
Sprintf
(
"%dM"
,
v
.
maxVideoSize
),
"--match-filter"
,
fmt
.
Sprintf
(
"duration <= %d"
,
int
(
math
.
Round
(
v
.
maxVideoLength
*
3600
))),
"-fbestvideo[ext=mp4][height<=
1080
]+bestaudio[ext!=webm]"
,
"-fbestvideo[ext=mp4][height<=
"
+
qualities
[
qualityIndex
]
+
"
]+bestaudio[ext!=webm]"
,
"-o"
+
strings
.
TrimSuffix
(
v
.
getFullPath
(),
".mp4"
),
"--merge-output-format"
,
"--abort-on-unavailable-fragment"
,
"--fragment-retries"
,
"0"
,
"mp4"
,
}
sourceAddress
,
err
:=
ipManager
.
GetNextIP
(
useIPv6
)
...
...
@@ -239,6 +248,7 @@ func (v *YoutubeVideo) download(useIPv6 bool) error {
)
}
ytdlArgs
=
append
(
ytdlArgs
,
"https://www.youtube.com/watch?v="
+
v
.
ID
())
runcmd
:
cmd
:=
exec
.
Command
(
"youtube-dl"
,
ytdlArgs
...
)
log
.
Printf
(
"Running command and waiting for it to finish..."
)
...
...
@@ -265,6 +275,9 @@ func (v *YoutubeVideo) download(useIPv6 bool) error {
ipManager
.
SetIpThrottled
(
sourceAddress
,
v
.
stopGroup
)
}
return
errors
.
Err
(
string
(
errorLog
))
}
else
if
strings
.
Contains
(
string
(
errorLog
),
"giving up after 0 fragment retries"
)
&&
qualityIndex
<
len
(
qualities
)
-
1
{
qualityIndex
++
goto
runcmd
}
return
errors
.
Err
(
err
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment