Add var/tmp volume for ytsync tmp files communicated between lbrynet and ytsync
Add reference to wallet dir env var for when the wallet file is uploaded so it is cleared properly when testing locally
This commit is contained in:
parent
517c2c56a3
commit
73937a541b
3 changed files with 15 additions and 8 deletions
|
@ -51,3 +51,5 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- "./persist/.lbrynet:/home/lbrynet"
|
- "./persist/.lbrynet:/home/lbrynet"
|
||||||
- ".:/etc/lbry" #Put your daemon_settings.yml here
|
- ".:/etc/lbry" #Put your daemon_settings.yml here
|
||||||
|
# /private/var/tmp for OSX and /var/tmp for Linux
|
||||||
|
- "/private/var/tmp:/var/tmp"
|
||||||
|
|
|
@ -194,6 +194,11 @@ func (s *Sync) uploadWallet() error {
|
||||||
key = aws.String("/regtest/" + s.YoutubeChannelID)
|
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) {
|
if _, err := os.Stat(defaultWalletDir); os.IsNotExist(err) {
|
||||||
return errors.Err("default_wallet does not exist")
|
return errors.Err("default_wallet does not exist")
|
||||||
}
|
}
|
||||||
|
@ -283,7 +288,7 @@ func (s *Sync) FullCycle() (e error) {
|
||||||
|
|
||||||
defer s.stopAndUploadWallet(&e)
|
defer s.stopAndUploadWallet(&e)
|
||||||
|
|
||||||
s.videoDirectory, err = ioutil.TempDir("", "ytsync")
|
s.videoDirectory, err = ioutil.TempDir(os.Getenv("TMP_DIR"), "ytsync")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, 0)
|
return errors.Wrap(err, 0)
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ import (
|
||||||
"github.com/lbryio/ytsync/tagsManager"
|
"github.com/lbryio/ytsync/tagsManager"
|
||||||
"github.com/lbryio/ytsync/thumbs"
|
"github.com/lbryio/ytsync/thumbs"
|
||||||
|
|
||||||
"github.com/ChannelMeter/iso8601duration"
|
duration "github.com/ChannelMeter/iso8601duration"
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/shopspring/decimal"
|
"github.com/shopspring/decimal"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
|
@ -294,16 +294,16 @@ runcmd:
|
||||||
log.Debugln(string(outLog))
|
log.Debugln(string(outLog))
|
||||||
|
|
||||||
if strings.Contains(string(outLog), "does not pass filter duration") {
|
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")
|
return errors.Err("video is too long to process")
|
||||||
}
|
}
|
||||||
if strings.Contains(string(outLog), "File is larger than max-filesize") {
|
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")
|
return errors.Err("the video is too big to sync, skipping for now")
|
||||||
}
|
}
|
||||||
if string(errorLog) != "" {
|
if string(errorLog) != "" {
|
||||||
log.Printf("Command finished with error: %v", errors.Err(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))
|
return errors.Err(string(errorLog))
|
||||||
}
|
}
|
||||||
fi, err := os.Stat(v.getFullPath())
|
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")
|
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()
|
videoPath, err := v.getDownloadedPath()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorln(err)
|
log.Errorln(err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = os.Remove(videoPath)
|
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 {
|
if err != nil {
|
||||||
err = errors.Prefix("delete error", err)
|
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)
|
summary, err := v.publish(daemon, params)
|
||||||
//delete the video in all cases (and ignore the error)
|
//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)
|
return summary, errors.Prefix("publish error", err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue