various bug fixes

This commit is contained in:
Niko Storni 2019-06-06 23:25:31 +02:00
parent ccebab35da
commit 10ad46f464
5 changed files with 12 additions and 5 deletions

View file

@ -2,8 +2,6 @@ package manager
import ( import (
"fmt" "fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"strings" "strings"
"syscall" "syscall"
"time" "time"
@ -13,6 +11,9 @@ import (
"github.com/lbryio/lbry.go/extras/errors" "github.com/lbryio/lbry.go/extras/errors"
"github.com/lbryio/lbry.go/extras/util" "github.com/lbryio/lbry.go/extras/util"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
) )

View file

@ -444,6 +444,7 @@ func (s *Sync) fixDupes(claims []jsonrpc.Claim) (bool, error) {
} }
//updateRemoteDB counts the amount of videos published so far and updates the remote db if some videos weren't marked as published //updateRemoteDB counts the amount of videos published so far and updates the remote db if some videos weren't marked as published
//additionally it removes all entries in the database indicating that a video is published when it's actually not
func (s *Sync) updateRemoteDB(claims []jsonrpc.Claim) (total, fixed, removed int, err error) { func (s *Sync) updateRemoteDB(claims []jsonrpc.Claim) (total, fixed, removed int, err error) {
count := 0 count := 0
videoIDMap := make(map[string]string, len(claims)) videoIDMap := make(map[string]string, len(claims))
@ -581,7 +582,7 @@ func (s *Sync) doSync() error {
} }
if s.LbryChannelName == "@UCBerkeley" { if s.LbryChannelName == "@UCBerkeley" {
err = errors.Err("UCB is not supported on this version of YTSYNC") err = errors.Err("UCB is not supported in this version of YTSYNC")
} else { } else {
err = s.enqueueYoutubeVideos() err = s.enqueueYoutubeVideos()
} }
@ -695,7 +696,7 @@ func (s *Sync) startWorker(workerNum int) {
} }
s.AppendSyncedVideo(v.ID(), false, err.Error(), "") s.AppendSyncedVideo(v.ID(), false, err.Error(), "")
err = s.Manager.apiConfig.MarkVideoStatus(s.YoutubeChannelID, v.ID(), VideoStatusFailed, existingClaimID, existingClaimName, err.Error(), existingClaimSize, 1) err = s.Manager.apiConfig.MarkVideoStatus(s.YoutubeChannelID, v.ID(), VideoStatusFailed, existingClaimID, existingClaimName, err.Error(), existingClaimSize, 0)
if err != nil { if err != nil {
SendErrorToSlack("Failed to mark video on the database: %s", err.Error()) SendErrorToSlack("Failed to mark video on the database: %s", err.Error())
} }

View file

@ -214,7 +214,9 @@ func (a *APIConfig) MarkVideoStatus(channelID string, videoID string, status str
vals.Add("published_at", strconv.FormatInt(time.Now().Unix(), 10)) vals.Add("published_at", strconv.FormatInt(time.Now().Unix(), 10))
vals.Add("claim_id", claimID) vals.Add("claim_id", claimID)
vals.Add("claim_name", claimName) vals.Add("claim_name", claimName)
vals.Add("metadata_version", fmt.Sprintf("%d", metadataVersion)) if metadataVersion > 0 {
vals.Add("metadata_version", fmt.Sprintf("%d", metadataVersion))
}
if size != nil { if size != nil {
vals.Add("size", strconv.FormatInt(*size, 10)) vals.Add("size", strconv.FormatInt(*size, 10))
} }

View file

@ -471,6 +471,7 @@ func (v *YoutubeVideo) reprocess(daemon *jsonrpc.Client, params SyncParams, exis
return nil, errors.Err("the video must be republished as we can't get the right size") return nil, errors.Err("the video must be republished as we can't get the right size")
} }
} }
v.size = util.PtrToInt64(int64(videoSize))
var fee *jsonrpc.Fee var fee *jsonrpc.Fee
if params.Fee != nil { if params.Fee != nil {
feeAmount, err := decimal.NewFromString(params.Fee.Amount) feeAmount, err := decimal.NewFromString(params.Fee.Amount)

View file

@ -145,6 +145,7 @@ const (
Juggling = "UC2fhTIbnQlFYaFzyTcmPkXg" Juggling = "UC2fhTIbnQlFYaFzyTcmPkXg"
JustJuggling = "UCftqelpjmbFrUwr3VVzzVwA" JustJuggling = "UCftqelpjmbFrUwr3VVzzVwA"
JordanBPeterson = "UCL_f53ZEJxp8TtlOkHwMV9Q" JordanBPeterson = "UCL_f53ZEJxp8TtlOkHwMV9Q"
DavidPakman = "UCvixJtaXuNdMPUGdOPcY8Ag"
) )
var channelWideTags = map[string][]string{ var channelWideTags = map[string][]string{
@ -153,6 +154,7 @@ var channelWideTags = map[string][]string{
Juggling: {"juggling", "circus arts", "malabares"}, Juggling: {"juggling", "circus arts", "malabares"},
JustJuggling: {"juggling", "circus arts", "malabares"}, JustJuggling: {"juggling", "circus arts", "malabares"},
JordanBPeterson: {"postmodernism", "psychology", "news"}, JordanBPeterson: {"postmodernism", "psychology", "news"},
DavidPakman: {"news"},
} }
var tagsToSkip = map[string]*struct{}{ var tagsToSkip = map[string]*struct{}{
"#hangoutsonair": nil, "#hangoutsonair": nil,