diff --git a/e2e/docker-compose.yml b/e2e/docker-compose.yml index 5c36dc9..bf07474 100644 --- a/e2e/docker-compose.yml +++ b/e2e/docker-compose.yml @@ -51,3 +51,5 @@ services: volumes: - "./persist/.lbrynet:/home/lbrynet" - ".:/etc/lbry" #Put your daemon_settings.yml here + # /private/var/tmp for OSX and /var/tmp for Linux + - "/private/var/tmp:/var/tmp" diff --git a/manager/ytsync.go b/manager/ytsync.go index 2391eb0..14e8611 100644 --- a/manager/ytsync.go +++ b/manager/ytsync.go @@ -194,6 +194,11 @@ func (s *Sync) uploadWallet() error { key = aws.String("/regtest/" + s.YoutubeChannelID) } + walletPath := os.Getenv("LBRYNET_WALLETS_DIR") + if walletPath != "" { + defaultWalletDir = walletPath + "/wallets/default_wallet" + } + if _, err := os.Stat(defaultWalletDir); os.IsNotExist(err) { return errors.Err("default_wallet does not exist") } @@ -283,7 +288,7 @@ func (s *Sync) FullCycle() (e error) { defer s.stopAndUploadWallet(&e) - s.videoDirectory, err = ioutil.TempDir("", "ytsync") + s.videoDirectory, err = ioutil.TempDir(os.Getenv("TMP_DIR"), "ytsync") if err != nil { return errors.Wrap(err, 0) } diff --git a/sources/youtubeVideo.go b/sources/youtubeVideo.go index 8ede581..aba0a6e 100644 --- a/sources/youtubeVideo.go +++ b/sources/youtubeVideo.go @@ -24,7 +24,7 @@ import ( "github.com/lbryio/ytsync/tagsManager" "github.com/lbryio/ytsync/thumbs" - "github.com/ChannelMeter/iso8601duration" + duration "github.com/ChannelMeter/iso8601duration" "github.com/aws/aws-sdk-go/aws" "github.com/shopspring/decimal" log "github.com/sirupsen/logrus" @@ -294,16 +294,16 @@ runcmd: log.Debugln(string(outLog)) if strings.Contains(string(outLog), "does not pass filter duration") { - _ = v.delete() + _ = v.delete("does not pass filter duration") return errors.Err("video is too long to process") } if strings.Contains(string(outLog), "File is larger than max-filesize") { - _ = v.delete() + _ = v.delete("File is larger than max-filesize") return errors.Err("the video is too big to sync, skipping for now") } if string(errorLog) != "" { log.Printf("Command finished with error: %v", errors.Err(string(errorLog))) - _ = v.delete() + _ = v.delete("due to error") return errors.Err(string(errorLog)) } fi, err := os.Stat(v.getFullPath()) @@ -338,14 +338,14 @@ func (v *YoutubeVideo) getDownloadedPath() (string, error) { return "", errors.Err("could not find any downloaded videos") } -func (v *YoutubeVideo) delete() error { +func (v *YoutubeVideo) delete(reason string) error { videoPath, err := v.getDownloadedPath() if err != nil { log.Errorln(err) return err } err = os.Remove(videoPath) - log.Debugf("%s deleted from disk (%s)", v.id, videoPath) + log.Debugf("%s deleted from disk for '%s' (%s)", v.id, reason, videoPath) if err != nil { err = errors.Prefix("delete error", err) @@ -451,7 +451,7 @@ func (v *YoutubeVideo) downloadAndPublish(daemon *jsonrpc.Client, params SyncPar summary, err := v.publish(daemon, params) //delete the video in all cases (and ignore the error) - _ = v.delete() + _ = v.delete("finished download and publish") return summary, errors.Prefix("publish error", err) }