Add support for new SDK (0.37.*) and support for upgrading channels and claims to new metadata #28

Merged
nikooo777 merged 37 commits from metadata_upgrade into master 2019-06-13 20:14:14 +02:00
6 changed files with 17 additions and 12 deletions
Showing only changes of commit aecfc67f84 - Show all commits

2
go.mod
View file

@ -17,7 +17,7 @@ require (
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/kr/pretty v0.1.0 // indirect github.com/kr/pretty v0.1.0 // indirect
github.com/lbryio/errors.go v0.0.0-20180223142025-ad03d3cc6a5c github.com/lbryio/errors.go v0.0.0-20180223142025-ad03d3cc6a5c
github.com/lbryio/lbry.go v0.0.0-20190507162721-81773617141d github.com/lbryio/lbry.go v0.0.0-20190508210757-f6d02e29ec8e
github.com/lusis/slack-test v0.0.0-20190408224659-6cf59653add2 // indirect github.com/lusis/slack-test v0.0.0-20190408224659-6cf59653add2 // indirect
github.com/mitchellh/go-ps v0.0.0-20170309133038-4fdf99ab2936 github.com/mitchellh/go-ps v0.0.0-20170309133038-4fdf99ab2936
github.com/mitchellh/mapstructure v1.1.2 // indirect github.com/mitchellh/mapstructure v1.1.2 // indirect

4
go.sum
View file

@ -125,8 +125,8 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/lbryio/errors.go v0.0.0-20180223142025-ad03d3cc6a5c h1:BhdcWGsuKif/XoSZnqVGNqJ1iEmH0czWR5upj+AuR8M= github.com/lbryio/errors.go v0.0.0-20180223142025-ad03d3cc6a5c h1:BhdcWGsuKif/XoSZnqVGNqJ1iEmH0czWR5upj+AuR8M=
github.com/lbryio/errors.go v0.0.0-20180223142025-ad03d3cc6a5c/go.mod h1:muH7wpUqE8hRA3OrYYosw9+Sl681BF9cwcjzE+OCNK8= github.com/lbryio/errors.go v0.0.0-20180223142025-ad03d3cc6a5c/go.mod h1:muH7wpUqE8hRA3OrYYosw9+Sl681BF9cwcjzE+OCNK8=
github.com/lbryio/lbry.go v0.0.0-20190507162721-81773617141d h1:ePvpcE0wKmRmwpQQVh+150jWG5aLus9/pqilRGdnbhc= github.com/lbryio/lbry.go v0.0.0-20190508210757-f6d02e29ec8e h1:7WEfDKlKA3pGrNQt42UfNd1koRG+OVwIZXg55IYJ8dU=
github.com/lbryio/lbry.go v0.0.0-20190507162721-81773617141d/go.mod h1:rAREtjHq/Wkkqy4+yt89Er/7JAVu6uMo3v8nevCEEIA= github.com/lbryio/lbry.go v0.0.0-20190508210757-f6d02e29ec8e/go.mod h1:rAREtjHq/Wkkqy4+yt89Er/7JAVu6uMo3v8nevCEEIA=
github.com/lbryio/lbryschema.go v0.0.0-20190428231007-c54836bca002 h1:urfYK5ElpUrAv90auPLldoVC60LwiGAcY0OE6HJB9KI= github.com/lbryio/lbryschema.go v0.0.0-20190428231007-c54836bca002 h1:urfYK5ElpUrAv90auPLldoVC60LwiGAcY0OE6HJB9KI=
github.com/lbryio/lbryschema.go v0.0.0-20190428231007-c54836bca002/go.mod h1:dAzPCBj3CKKWBGYBZxK6tKBP5SCgY2tqd9SnQd/OyKo= github.com/lbryio/lbryschema.go v0.0.0-20190428231007-c54836bca002/go.mod h1:dAzPCBj3CKKWBGYBZxK6tKBP5SCgY2tqd9SnQd/OyKo=
github.com/lbryio/ozzo-validation v0.0.0-20170323141101-d1008ad1fd04/go.mod h1:fbG/dzobG8r95KzMwckXiLMHfFjZaBRQqC9hPs2XAQ4= github.com/lbryio/ozzo-validation v0.0.0-20170323141101-d1008ad1fd04/go.mod h1:fbG/dzobG8r95KzMwckXiLMHfFjZaBRQqC9hPs2XAQ4=

View file

@ -112,7 +112,7 @@ func (s *Sync) walletSetup() error {
} else if claimAddress == nil { } else if claimAddress == nil {
return errors.Err("could not get unused address") return errors.Err("could not get unused address")
} }
s.claimAddress = string((*claimAddress)[0]) s.claimAddress = string((*claimAddress)[0]) //TODO: remove claimAddress completely
if s.claimAddress == "" { if s.claimAddress == "" {
return errors.Err("found blank claim address") return errors.Err("found blank claim address")
} }

View file

@ -393,7 +393,6 @@ var thumbnailHosts = []string{
} }
func isYtsyncClaim(c jsonrpc.Claim) bool { func isYtsyncClaim(c jsonrpc.Claim) bool {
if !util.InSlice(c.Type, []string{"claim", "update"}) || c.Value.GetStream() == nil { if !util.InSlice(c.Type, []string{"claim", "update"}) || c.Value.GetStream() == nil {
return false return false
} }
@ -402,7 +401,12 @@ func isYtsyncClaim(c jsonrpc.Claim) bool {
return false return false
} }
return util.InSlice(c.Value.GetThumbnail().GetUrl(), thumbnailHosts) for _, th := range thumbnailHosts {
if strings.Contains(c.Value.GetThumbnail().GetUrl(), th) {
return true
}
}
return false
} }
// fixDupes abandons duplicate claims // fixDupes abandons duplicate claims
@ -777,6 +781,7 @@ func (s *Sync) processVideo(v video) (err error) {
sv, ok := s.syncedVideos[v.ID()] sv, ok := s.syncedVideos[v.ID()]
s.syncedVideosMux.RUnlock() s.syncedVideosMux.RUnlock()
alreadyPublished := ok && sv.Published alreadyPublished := ok && sv.Published
isUpgradeSync := s.Manager.syncStatus == StatusPendingUpgrade
neverRetryFailures := []string{ neverRetryFailures := []string{
"Error extracting sts from embedded url response", "Error extracting sts from embedded url response",
@ -792,7 +797,7 @@ func (s *Sync) processVideo(v video) (err error) {
return nil return nil
} }
if alreadyPublished { if alreadyPublished && !isUpgradeSync {
log.Println(v.ID() + " already published") log.Println(v.ID() + " already published")
return nil return nil
} }
@ -814,7 +819,6 @@ func (s *Sync) processVideo(v video) (err error) {
MaxVideoLength: s.Manager.maxVideoLength, MaxVideoLength: s.Manager.maxVideoLength,
} }
isUpgradeSync := s.Manager.syncStatus == StatusPendingUpgrade
summary, err := v.Sync(s.daemon, sp, &sv, isUpgradeSync) summary, err := v.Sync(s.daemon, sp, &sv, isUpgradeSync)
if err != nil { if err != nil {
return err return err

View file

@ -183,6 +183,7 @@ 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", "2")
if size != nil { if size != nil {
vals.Add("size", strconv.FormatInt(*size, 10)) vals.Add("size", strconv.FormatInt(*size, 10))
} }

View file

@ -328,7 +328,7 @@ func (v *YoutubeVideo) getMetadata() (languages []string, locations []jsonrpc.Lo
} }
locations = nil locations = nil
if v.youtubeInfo.RecordingDetails.Location != nil { if v.youtubeInfo.RecordingDetails != nil && v.youtubeInfo.RecordingDetails.Location != nil {
locations = []jsonrpc.Location{{ locations = []jsonrpc.Location{{
Latitude: util.PtrToString(fmt.Sprintf("%.7f", v.youtubeInfo.RecordingDetails.Location.Latitude)), Latitude: util.PtrToString(fmt.Sprintf("%.7f", v.youtubeInfo.RecordingDetails.Location.Latitude)),
Longitude: util.PtrToString(fmt.Sprintf("%.7f", v.youtubeInfo.RecordingDetails.Location.Longitude)), Longitude: util.PtrToString(fmt.Sprintf("%.7f", v.youtubeInfo.RecordingDetails.Location.Longitude)),
@ -392,14 +392,14 @@ func (v *YoutubeVideo) reprocess(daemon *jsonrpc.Client, params SyncParams, exis
Duration: util.PtrToUint64(uint64(math.Ceil(videoDuration.ToDuration().Seconds()))), Duration: util.PtrToUint64(uint64(math.Ceil(videoDuration.ToDuration().Seconds()))),
ChannelID: &v.lbryChannelID, ChannelID: &v.lbryChannelID,
}, },
FileSize: util.PtrToString(fmt.Sprintf("%d", videoSize)), FileSize: &videoSize,
}) })
if err != nil { if err != nil {
return nil, err return nil, err
} }
return &SyncSummary{ return &SyncSummary{
ClaimID: pr.ClaimID, ClaimID: pr.Outputs[0].ClaimID,
ClaimName: pr.Output.Name, ClaimName: pr.Outputs[0].Name,
}, nil }, nil
} }