From 6668840b118a4f84b5cb4df85622ab418a4cb156 Mon Sep 17 00:00:00 2001 From: Niko Storni Date: Thu, 13 Jun 2019 19:33:58 +0200 Subject: [PATCH] fix description not containing youtube link add workaround to SDK bug not spending the right UTXOs fix bug in assignments --- manager/ytsync.go | 17 +++++++++++++---- sources/youtubeVideo.go | 6 +++--- tagsManager/tags_mapping.go | 2 +- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/manager/ytsync.go b/manager/ytsync.go index 143c98f..476da5c 100644 --- a/manager/ytsync.go +++ b/manager/ytsync.go @@ -676,18 +676,27 @@ 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", } - if util.SubstringInSlice(err.Error(), errorsNoRetry) { + if strings.Contains(err.Error(), "txn-mempool-conflict") || + strings.Contains(err.Error(), "too-long-mempool-chain") { + log.Println("waiting for a block before retrying") + err := s.waitForNewBlock() + if err != nil { + s.grp.Stop() + SendErrorToSlack("something went wrong while waiting for a block: %v", err) + break + } + } else if util.SubstringInSlice(err.Error(), errorsNoRetry) { log.Println("This error should not be retried at all") } else if tryCount < s.MaxTries { if util.SubstringInSlice(err.Error(), []string{ "Not enough funds to cover this transaction", "failed: Not enough funds", "Error in daemon: Insufficient funds, please deposit additional LBC", - "txn-mempool-conflict", - "too-long-mempool-chain", + // "txn-mempool-conflict", //TODO: uncomment the two lines when the SDK will start spending confirmed UTXOs before failing + //"too-long-mempool-chain", }) { log.Println("checking funds and UTXOs before retrying...") - err = s.walletSetup() + err := s.walletSetup() if err != nil { s.grp.Stop() SendErrorToSlack("failed to setup the wallet for a refill: %v", err) diff --git a/sources/youtubeVideo.go b/sources/youtubeVideo.go index 1757139..c0a7f52 100644 --- a/sources/youtubeVideo.go +++ b/sources/youtubeVideo.go @@ -162,14 +162,14 @@ func (v *YoutubeVideo) getFullPath() string { func (v *YoutubeVideo) getAbbrevDescription() string { maxLines := 10 description := strings.TrimSpace(v.description) - if strings.Count(description, "\n") < maxLines { - return 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 + } return strings.Join(strings.Split(description, "\n")[:maxLines], "\n") + "\n..." + additionalDescription } diff --git a/tagsManager/tags_mapping.go b/tagsManager/tags_mapping.go index 93c636f..8fb5ecd 100644 --- a/tagsManager/tags_mapping.go +++ b/tagsManager/tags_mapping.go @@ -488,7 +488,7 @@ var channelWideTags = map[string][]string{ shogogarcia: {"learning"}, alphalifestyleacademy: {"learning"}, NileRed: {"learning", "science"}, - veritasium: {"learning"}, + veritasium: {"learning", "science"}, stevecronin: {"learning"}, jeranism: {"learning"}, MinutePhysics: {"learning", "science"},