ytsync/sources/shared.go
Niko Storni 01590306a1 Add support for SDK 0.35
Implement thumbnails uploader
Fetch more data from youtube for additional metadata
2019-04-18 21:22:51 -04:00

28 lines
725 B
Go

package sources
import (
"strings"
"github.com/lbryio/lbry.go/extras/jsonrpc"
"github.com/lbryio/ytsync/namer"
)
type SyncSummary struct {
ClaimID string
ClaimName string
}
func publishAndRetryExistingNames(daemon *jsonrpc.Client, title, filename string, amount float64, options jsonrpc.StreamCreateOptions, namer *namer.Namer) (*SyncSummary, error) {
for {
name := namer.GetNextName(title)
response, err := daemon.StreamCreate(name, filename, amount, options)
if err != nil {
if strings.Contains(err.Error(), "failed: Multiple claims (") {
continue
}
return nil, err
}
PublishedClaim := response.Outputs[0]
return &SyncSummary{ClaimID: PublishedClaim.ClaimID, ClaimName: name}, nil
}
}