diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-03-11 18:55:59 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-03-11 18:55:59 (GMT) |
commit | abe9916c72d1e5ab282f9fde26948e6d74bfb266 (patch) | |
tree | 06a096deb4f63e2b986a32e383e0fd03e19c9df7 /src/rhimportd/ctrlTelnet.go | |
parent | ff37f7cf351287ff6d20f197e2ff2fa2401470cc (diff) |
added support for filepolicy to telnet and watchdir control
Diffstat (limited to 'src/rhimportd/ctrlTelnet.go')
-rw-r--r-- | src/rhimportd/ctrlTelnet.go | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/rhimportd/ctrlTelnet.go b/src/rhimportd/ctrlTelnet.go index 6e859e4..4cbb412 100644 --- a/src/rhimportd/ctrlTelnet.go +++ b/src/rhimportd/ctrlTelnet.go @@ -58,6 +58,7 @@ func telnetHelp(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb. c.Sayln(" UserName string username to use for rdxport interface") c.Sayln(" Password string password to use for rdxport interface") c.Sayln(" SourceUri string uri to the file to import") + c.Sayln(" SourceFilePolicy enum values: auto | keep | delete | delete-with-dir") c.Sayln(" ShowId uint the RHRD show id to import to") c.Sayln(" ClearShowCarts bool clear all show-carts before importing?") c.Sayln(" GroupName string name of music-pool group to import to") @@ -146,6 +147,12 @@ func telnetSetBool(c *telgo.Client, param *bool, val string) { } } +func telnetSetFilePolicy(c *telgo.Client, param *rhimport.FilePolicy, val string) { + if err := param.FromString(val); err != nil { + c.Sayln("invalid value (%s)", err) + } +} + func telnetSet(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.DBChan) bool { if len(args) != 3 { c.Sayln("wrong number of arguments") @@ -167,6 +174,8 @@ func telnetSet(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.D ctx.Password = args[2] case "sourceuri": ctx.SourceUri = args[2] + case "sourcefilepolicy": + telnetSetFilePolicy(c, &ctx.SourceFilePolicy, args[2]) case "showid": telnetSetUint(c, &ctx.ShowId, args[2]) case "clearshowcarts": @@ -214,6 +223,7 @@ func telnetShow(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb. c.Sayln(" UserName: %q", ctx.UserName) c.Sayln(" Password: %q", ctx.Password) c.Sayln(" SourceUri: %q", ctx.SourceUri) + c.Sayln(" SourceFilePolicy: %s", ctx.SourceFilePolicy.String()) c.Sayln(" ShowId: %v", ctx.ShowId) c.Sayln(" ClearShowCarts: %v", ctx.ClearShowCarts) c.Sayln(" GroupName: %q", ctx.GroupName) @@ -268,9 +278,9 @@ func telnetRun(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.D } else { c.Sayln("") if res.ResponseCode == http.StatusOK { - c.Sayln("File got succesfully imported into Cart/Cut %d/%d", res.Cart, res.Cut) + c.Sayln("File got succesfully imported into Cart/Cut %d/%d, Source: '%s'", res.Cart, res.Cut, res.SourceFile) } else { - c.Sayln("Fileimport has failed (Cart/Cut %d/%d): %s", res.Cart, res.Cut, res.ErrorString) + c.Sayln("Fileimport has failed (Cart/Cut %d/%d, Source: '%s'): %s", res.Cart, res.Cut, res.SourceFile, res.ErrorString) } } return false |