Compare commits

...
10 Commits
Author SHA1 Message Date
Niko Storni 03161a5a02 prefer 1080p videos 2019-08-05 20:08:46 +02:00
Niko Storni 6dc2c39ee6 limit description length
rather than limiting lines count
2019-08-02 10:01:33 -04:00
Niko Storni 87211e802d reduce tags length 2019-08-02 09:05:24 -04:00
Niko Storni 3ba0c97634 fix flags 2019-07-25 18:33:05 -04:00
Niko Storni 9d65fce6bc do not apply limits if disabled 2019-07-25 18:22:56 -04:00
Niko Storni d5ed4ce753 facilitate streaming by moving the moov atom 2019-07-25 18:15:14 -04:00
Niko Storni 0aedf80386 limit throttling to only queued channels 2019-07-22 16:24:13 -04:00
Niko Storni c193dae95a temporary throttling of channels to sync for tom to review them 2019-07-22 16:16:23 -04:00
Niko Storni 0c47510785 revert quoting paths 2019-07-22 02:51:13 +02:00
Niko Storni 8f556a86c8 fix missing fragments for good
never retry them again
2019-07-22 02:45:38 +02:00
4 changed files with 33 additions and 17 deletions

No files matched your search

+4
View File
@@ -153,6 +153,10 @@ func (s *SyncManager) Start() error {
queuesToSync = append(queuesToSync, StatusSyncing, StatusQueued)
}
for _, q := range queuesToSync {
//temporary override for sync-until to give tom the time to review the channels
if q == StatusQueued {
s.syncProperties.SyncUntil = time.Now().AddDate(0, 0, -1).Unix()
}
channels, err := s.apiConfig.FetchChannels(q, s.syncProperties)
if err != nil {
return err
+2
View File
@@ -657,6 +657,7 @@ func (s *Sync) startWorker(workerNum int) {
"have blocked it on copyright grounds",
"the video must be republished as we can't get the right size",
"HTTP Error 403",
"giving up after 0 fragment retries",
}
if util.SubstringInSlice(err.Error(), errorsNoRetry) {
log.Println("This error should not be retried at all")
@@ -863,6 +864,7 @@ func (s *Sync) processVideo(v video) (err error) {
"no compatible format available for this video",
"Watch this video on YouTube.",
"have blocked it on copyright grounds",
"giving up after 0 fragment retries",
}
if ok && !sv.Published && util.SubstringInSlice(sv.FailureReason, neverRetryFailures) {
log.Println(v.ID() + " can't ever be published")
+26 -16
View File
@@ -162,17 +162,17 @@ func (v *YoutubeVideo) getFullPath() string {
}
func (v *YoutubeVideo) getAbbrevDescription() string {
maxLines := 10
maxLength := 2800
description := strings.TrimSpace(v.description)
additionalDescription := "\nhttps://www.youtube.com/watch?v=" + v.id
khanAcademyClaimID := "5fc52291980268b82413ca4c0ace1b8d749f3ffb"
if v.lbryChannelID == khanAcademyClaimID {
additionalDescription = additionalDescription + "\nNote: All Khan Academy content is available for free at (www.khanacademy.org)"
}
if strings.Count(description, "\n") < maxLines {
return description + "\n..." + additionalDescription
if len(description) > maxLength {
description = description[:maxLength]
}
return strings.Join(strings.Split(description, "\n")[:maxLines], "\n") + "\n..." + additionalDescription
return description + "\n..." + additionalDescription
}
func (v *YoutubeVideo) download(useIPv6 bool) error {
@@ -191,7 +191,7 @@ func (v *YoutubeVideo) download(useIPv6 bool) error {
return nil
}
qualities := []string{
//"1080",
"1080",
"720",
"480",
"320",
@@ -199,18 +199,27 @@ func (v *YoutubeVideo) download(useIPv6 bool) error {
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<=" + qualities[qualityIndex] + "]+bestaudio[ext!=webm]",
"-o\"" + strings.TrimSuffix(v.getFullPath(), ".mp4") + "\"",
"-o" + strings.TrimSuffix(v.getFullPath(), ".mp4"),
"--merge-output-format",
"mp4",
"--postprocessor-args",
"-movflags faststart",
"--abort-on-unavailable-fragment",
"--fragment-retries",
"0",
}
if v.maxVideoSize > 0 {
ytdlArgs = append(ytdlArgs,
"--max-filesize",
fmt.Sprintf("%dM", v.maxVideoSize),
)
}
if v.maxVideoLength > 0 {
ytdlArgs = append(ytdlArgs,
"--match-filter",
fmt.Sprintf("duration <= %d", int(math.Round(v.maxVideoLength*3600))),
)
}
sourceAddress, err := ipManager.GetNextIP(useIPv6)
if err != nil {
if sourceAddress == "throttled" {
@@ -249,9 +258,10 @@ 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...)
argsWithFilters := append(ytdlArgs, "-fbestvideo[ext=mp4][height<="+qualities[qualityIndex]+"]+bestaudio[ext!=webm]")
cmd := exec.Command("youtube-dl", argsWithFilters...)
log.Printf("Running command youtube-dl %s", strings.Join(ytdlArgs, " "))
log.Printf("Running command youtube-dl %s", strings.Join(argsWithFilters, " "))
stderr, err := cmd.StderrPipe()
if err != nil {
@@ -273,11 +283,11 @@ runcmd:
if strings.Contains(err.Error(), "exit status 1") {
if strings.Contains(string(errorLog), "HTTP Error 429") {
ipManager.SetIpThrottled(sourceAddress, v.stopGroup)
} else if strings.Contains(string(errorLog), "giving up after 0 fragment retries") && qualityIndex < len(qualities)-1 {
qualityIndex++
goto runcmd
}
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)
}
+1 -1
View File
@@ -71,7 +71,7 @@ func SanitizeTags(tags []string, youtubeChannelID string) ([]string, error) {
return sanitizedTags, nil
}
const TagMaxLength = 255
const TagMaxLength = 50
func normalizeTag(t string) (string, error) {
t = strings.ToLower(t)