Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f3f40c41ef | ||
|
|
05b65c4cb5 | ||
|
|
69ad13848b | ||
|
|
e496ad670a | ||
|
|
9d8eb32f9f | ||
|
|
6668840b11 |
No files matched your search
+4
-4
@@ -90,12 +90,12 @@ func (s *Sync) walletSetup() error {
|
||||
}
|
||||
s.syncedVideosMux.RUnlock()
|
||||
|
||||
log.Debugf("We already allocated credits for %d videos", publishedCount)
|
||||
log.Debugf("We already allocated credits for %d published videos and %d failed videos", publishedCount, failedCount)
|
||||
|
||||
if videosOnYoutube > s.Manager.videosLimit {
|
||||
videosOnYoutube = s.Manager.videosLimit
|
||||
}
|
||||
unallocatedVideos := videosOnYoutube - publishedCount
|
||||
unallocatedVideos := videosOnYoutube - (publishedCount + failedCount)
|
||||
requiredBalance := float64(unallocatedVideos)*(publishAmount+estimatedMaxTxFee) + channelClaimAmount
|
||||
if s.Manager.upgradeMetadata {
|
||||
requiredBalance += float64(notUpgradedCount) * 0.001
|
||||
@@ -103,7 +103,7 @@ func (s *Sync) walletSetup() error {
|
||||
|
||||
refillAmount := 0.0
|
||||
if balance < requiredBalance || balance < minimumAccountBalance {
|
||||
refillAmount = math.Max(requiredBalance-requiredBalance, minimumRefillAmount)
|
||||
refillAmount = math.Max(requiredBalance-balance, minimumRefillAmount)
|
||||
}
|
||||
|
||||
if s.Refill > 0 {
|
||||
@@ -169,7 +169,7 @@ func (s *Sync) ensureEnoughUTXOs() error {
|
||||
|
||||
for _, utxo := range *utxolist {
|
||||
amount, _ := strconv.ParseFloat(utxo.Amount, 64)
|
||||
if !utxo.IsClaim && !utxo.IsSupport && !utxo.IsUpdate && amount != 0.0 {
|
||||
if !utxo.IsClaim && !utxo.IsSupport && !utxo.IsUpdate && amount > 0.001 {
|
||||
count++
|
||||
}
|
||||
}
|
||||
|
||||
+15
-5
@@ -480,7 +480,7 @@ func (s *Sync) updateRemoteDB(claims []jsonrpc.Claim) (total, fixed, removed int
|
||||
if claimIDDiffers {
|
||||
log.Debugf("%s: Mismatch in database for claimID. DB: %s - Blockchain: %s", videoID, pv.ClaimID, c.ClaimID)
|
||||
}
|
||||
if claimIDDiffers {
|
||||
if claimNameDiffers {
|
||||
log.Debugf("%s: Mismatch in database for claimName. DB: %s - Blockchain: %s", videoID, pv.ClaimName, c.Name)
|
||||
}
|
||||
if claimMarkedUnpublished {
|
||||
@@ -675,19 +675,29 @@ func (s *Sync) startWorker(workerNum int) {
|
||||
"Watch this video on YouTube.",
|
||||
"have blocked it on copyright grounds",
|
||||
"the video must be republished as we can't get the right size",
|
||||
"Invalid status code: 403",
|
||||
}
|
||||
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)
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
@@ -71,6 +71,8 @@ func SanitizeTags(tags []string, youtubeChannelID string) ([]string, error) {
|
||||
return sanitizedTags, nil
|
||||
}
|
||||
|
||||
const TagMaxLength = 255
|
||||
|
||||
func normalizeTag(t string) (string, error) {
|
||||
t = strings.ToLower(t)
|
||||
multipleSpaces := regexp.MustCompile(`\s{2,}`)
|
||||
@@ -87,7 +89,10 @@ func normalizeTag(t string) (string, error) {
|
||||
if weirdChars.MatchString(t) {
|
||||
log.Debugf("tag '%s' has weird stuff in it, skipping\n", t)
|
||||
return "", nil
|
||||
|
||||
}
|
||||
if len(t) > TagMaxLength {
|
||||
log.Debugf("tag '%s' is too long, skipping\n", t)
|
||||
return "", nil
|
||||
}
|
||||
return t, nil
|
||||
}
|
||||
@@ -488,7 +493,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"},
|
||||
|
||||
+5
-4
@@ -61,10 +61,11 @@ func (u *thumbnailUploader) uploadThumbnail() error {
|
||||
uploader := s3manager.NewUploader(s3Session)
|
||||
|
||||
_, err = uploader.Upload(&s3manager.UploadInput{
|
||||
Bucket: aws.String("thumbnails.lbry.com"),
|
||||
Key: key,
|
||||
Body: thumb,
|
||||
ACL: aws.String("public-read"),
|
||||
Bucket: aws.String("thumbnails.lbry.com"),
|
||||
Key: key,
|
||||
Body: thumb,
|
||||
ACL: aws.String("public-read"),
|
||||
ContentType: aws.String("image/jpeg"),
|
||||
})
|
||||
u.mirroredUrl = ThumbnailEndpoint + u.name
|
||||
return errors.Err(err)
|
||||
|
||||
Reference in new issue
Block a user