summaryrefslogtreecommitdiff
path: root/src/rhimportd/ctrlTelnet.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/rhimportd/ctrlTelnet.go')
-rw-r--r--src/rhimportd/ctrlTelnet.go14
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